当前位置: 首页>>代码示例>>C#>>正文


C# ICommunity.AddFact方法代码示例

本文整理汇总了C#中ICommunity.AddFact方法的典型用法代码示例。如果您正苦于以下问题:C# ICommunity.AddFact方法的具体用法?C# ICommunity.AddFact怎么用?C# ICommunity.AddFact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICommunity的用法示例。


在下文中一共展示了ICommunity.AddFact方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DefineConference

 private static Conference DefineConference(ICommunity community, Catalog catalog, string name, string imageUrl, DateTime startDate, DateTime endDate, string city)
 {
     var conference = community.AddFact(new Conference());
     var header = community.AddFact(new ConferenceHeader(catalog, conference));
     header.Name = name;
     header.ImageUrl = imageUrl;
     header.StartDate = startDate;
     header.EndDate = endDate;
     header.City = city;
     header.Address = "111 Main Street";
     header.HomePageUrl = "awesomefest.com";
     header.Description.SetString(
         "Awesomeness!! Go to AwesomeFest!!!",
         value => header.Description = value,
         community);
     return conference;
 }
开发者ID:michaellperry,项目名称:MyCon,代码行数:17,代码来源:ConferenceViewModelFactory.cs

示例2: Initialize

        public void Initialize()
        {
            MemoryCommunicationStrategy sharedCommunication = new MemoryCommunicationStrategy();
            _serverCommunity = new Community(new MemoryStorageStrategy())
                .AddCommunicationStrategy(sharedCommunication)
                .Register<CorrespondenceModel>()
                .Subscribe(() => _service);
            _clientCommunity = new Community(new MemoryStorageStrategy())
                .AddCommunicationStrategy(sharedCommunication)
                .Register<CorrespondenceModel>()
                .Subscribe(() => _identity.Claims)
                .Subscribe(() => _identity);
            _otherClientCommunity = new Community(new MemoryStorageStrategy())
                .AddCommunicationStrategy(sharedCommunication)
                .Register<CorrespondenceModel>()
                .Subscribe(() => _otherIdentity.Claims);

            _service = _serverCommunity.AddFact(new IdentityService());
            _identity = _clientCommunity.AddFact(new Identity("liveid:12345"));
            _otherIdentity = _otherClientCommunity.AddFact(new Identity("liveid:12345"));
        }
开发者ID:michaellperry,项目名称:Reversi,代码行数:21,代码来源:IdentityServiceTest.cs

示例3: Create

        public static ConferenceListViewModel Create(string environment, ICommunity community, ConferenceSelection conferenceSelection)
        {
            var catalog = community.AddFact(new Catalog(environment));

            if (LoadSampleData && !catalog.ConferenceHeaders.Ensure().Any())
            {
                DefineConference(
                    community,
                    catalog,
                    "Cowtown Code Camp 2013",
                    "http://cdn.marketplaceimages.windowsphone.com/v8/images/2a24b5e4-d79a-448e-8818-4040ff0d51a6?imageType=ws_icon_large",
                    new DateTime(2013, 3, 17),
                    new DateTime(2013, 3, 17),
                    "Fort Worth, TX");
                DefineConference(
                    community,
                    catalog,
                    "AwesomeFest 2014",
                    "http://files.g4tv.com/ImageDb3/284724_S/darth-vader-rock-guitarist.jpg",
                    new DateTime(2014, 2, 27),
                    new DateTime(2014, 2, 28),
                    "Allen, TX");
                var conference = DefineConference(
                    community,
                    catalog,
                    "That Conference 2013",
                    "http://www.thatconference.com/Images/mainLogo.png",
                    new DateTime(2013, 8, 16),
                    new DateTime(2013, 8, 19),
                    "Wisconsin Dells, WI");
                DefineConferenceSessions(community, conference);
            }

            Func<ConferenceHeader, ConferenceHeaderViewModel> makeConferenceHeaderViewModel =
                conferenceHeader =>
                    new ConferenceHeaderViewModel(conferenceHeader);

            return new ConferenceListViewModel(catalog, conferenceSelection, makeConferenceHeaderViewModel);
        }
开发者ID:michaellperry,项目名称:MyCon,代码行数:39,代码来源:ConferenceViewModelFactory.cs

示例4: DefineConferenceSessions

        private static void DefineConferenceSessions(ICommunity community, Conference conference)
        {
            var developer = community.AddFact(new Track(conference));
            developer.Name = "Developer";

            var michael = community.AddFact(new Speaker(conference));
            michael.Name = "Michael L Perry";
            michael.ImageUrl = "http://qedcode.com/extras/Perry_Headshot_Medium.jpg";
            michael.Contact = "@michaellperry";
            michael.Bio.SetString(
                "Software is math. Michael L Perry has built upon the works of mathematicians like Bertrand Meyer, James Rumbaugh, and Donald Knuth to develop a mathematical system for software development. He has captured this system in a set of open source projects, Update Controls and Correspondence. As a Principal Consultant at Improving Enterprises, he applies mathematical concepts to building scalable and robust enterprise systems. You can find out more at qedcode.com.",
                v => michael.Bio = v,
                community);

            var provable = community.AddFact(new Session(michael));
            provable.Title = "4 Ways to Prevent Code Abuse";
            provable.Description.SetString(
                "Your code is right. Other people are just using it wrong!" +
                "Learn 4 simple techniques to prevent people from using your code incorrectly. We'll apply those techniques to a class in the .NET Framework that is really easy to get wrong. By the time we're done, you'll have to try really hard to mess it up." +
                "Some APIs will throw exceptions when you get something wrong. That's not helpful! I'll show you how to write an API that guides you toward correct code. It won't even compile unless you get it right." +
                "These 4 techniques are built into the C# language today, so take advantage of them! Everybody on your team will thank you. And you'll spend less time fixing their bugs.",
                v => provable.Description = v,
                community);

            community.AddFact(new SessionTrack(provable, developer, new List<SessionTrack>()));

            var eight = community.AddFact(new Time(conference));
            eight.StartTime = new DateTime(2013, 7, 12, 8, 0, 0, DateTimeKind.Local);

            var room100 = community.AddFact(new Room(conference));
            room100.RoomNumber = "100";

            var room100AtEight = community.AddFact(new Slot(eight, room100));

            community.AddFact(new SessionSlot(provable, room100AtEight, new List<SessionSlot>()));
        }
开发者ID:michaellperry,项目名称:MyCon,代码行数:36,代码来源:ConferenceViewModelFactory.cs


注:本文中的ICommunity.AddFact方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。