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


C# EventPublisher类代码示例

本文整理汇总了C#中EventPublisher的典型用法代码示例。如果您正苦于以下问题:C# EventPublisher类的具体用法?C# EventPublisher怎么用?C# EventPublisher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Start

 // Use this for initialization
 void Start()
 {
     m_behaviour = GetComponent<CartoonBehaviour>();
     m_spinRate = m_behaviour.m_spinRate;
     m_content = new GUIContent(m_text);
     eventPublisher = ObjectFinder.FindOrCreateComponent<EventPublisher>();
 }
开发者ID:RIsoTopes,项目名称:MolecularMission,代码行数:8,代码来源:DialogueMarkerBehaviour.cs

示例2: GetCategoryService

		private ICategoryService GetCategoryService(UnitOfWork uow) {
			ICategoryRepository cateRepo = new CategoryRepository(uow);

			IState request = new DummyRequest();

			ILogger logger = new ConsoleLogger();

			IUserRepository userRepo = new UserRepository(uow);
			User user = userRepo.Create(new User {
				Name = "D. Ummy",
				ProviderId = "12345678",
				FullName = "Mr. Doh Ummy",
				EmailAddress = "[email protected]",
				Culture = "th-TH",
				TimeZone = "GMT Standard Time"
			});

			List<IEventSubscriber> subscribers = new List<IEventSubscriber>();

			IEventPublisher eventPublisher = new EventPublisher(subscribers, logger, request);
			IUserProvider userProvider = new DummyUserProvider(user);
			IPermissionService permService = new PermissionService();

			return new CategoryService(userProvider, cateRepo, eventPublisher, logger, permService);
		}
开发者ID:razzles67,项目名称:NForum,代码行数:25,代码来源:SetGetTests.cs

示例3: WhenSourceEventRaised_ThenCollectedSubscriberIsNotNotified

        public void WhenSourceEventRaised_ThenCollectedSubscriberIsNotNotified()
        {
            var source = new EventSource();
            var publisher = new EventPublisher(source);
            var subscriber = new EventSubscriber();

            var subscription = publisher.PropertyChanged.Subscribe(subscriber.OnChanged);

            try
            {
                subscriber = null;
                subscription.Dispose();
                GC.Collect();
                GC.WaitForFullGCApproach(-1);
                GC.WaitForFullGCComplete(-1);
                GC.WaitForPendingFinalizers();

                source.RaisePropertyChanged("Foo");

                Assert.Equal(0, EventSubscriber.ChangedProperties.Count);

            }
            finally
            {
                //subscription.Dispose();
            }
        }
开发者ID:NuPattern,项目名称:NuPattern,代码行数:27,代码来源:Misc.cs

示例4: GetPostService

		private void GetPostService(UnitOfWork uow, out ICategoryService categoryService, out IForumService forumService, out ITopicService topicService, out IPostService postService) {
			ICategoryRepository cateRepo = new CategoryRepository(uow);
			IForumRepository forumRepo = new ForumRepository(uow);
			ITopicRepository topicRepo = new TopicRepository(uow);
			IPostRepository postRepo = new PostRepository(uow);
			IForumConfigurationRepository configRepo = new ForumConfigurationRepository(uow);

			IState request = new DummyRequest();

			ILogger logger = new ConsoleLogger();

			IUserRepository userRepo = new UserRepository(uow);
			User user = userRepo.Create(new User {
				Name = "D. Ummy",
				ProviderId = "12345678",
				FullName = "Mr. Doh Ummy",
				EmailAddress = "[email protected]",
				Culture = "th-TH",
				TimeZone = "GMT Standard Time"
			});

			List<IEventSubscriber> subscribers = new List<IEventSubscriber>();

			IEventPublisher eventPublisher = new EventPublisher(subscribers, logger, request);
			IUserProvider userProvider = new DummyUserProvider(user);
			IPermissionService permService = new PermissionService();
			IForumConfigurationService confService = new ForumConfigurationService(configRepo);

			categoryService = new CategoryService(userProvider, cateRepo, eventPublisher, logger, permService);
			forumService = new ForumService(userProvider, cateRepo, forumRepo, topicRepo, postRepo, eventPublisher, logger, permService);
			topicService = new TopicService(userProvider, forumRepo, topicRepo, postRepo, eventPublisher, logger, permService, confService);
			postService = new PostService(userProvider, forumRepo, topicRepo, postRepo, eventPublisher, logger, permService, confService);
		}
开发者ID:razzles67,项目名称:NForum,代码行数:33,代码来源:TestCustomPropertiesHolders.cs

示例5: Start

 //need to have Start() so we can disable this.
 void Start()
 {
     if (GameObject.Find ("Level") != null) {
         eventPublisher = GameObject.Find ("Level").GetComponent<EventPublisher> ();
     } else {
         Debug.Log ("No level game object in scene: " + Application.loadedLevelName);
     }
 }
开发者ID:RIsoTopes,项目名称:MolecularMission,代码行数:9,代码来源:CollectableBehaviour.cs

示例6: SubscribeToEvents

 private void SubscribeToEvents()
 {
     _eventPublisher = new EventPublisher();
     var numberCountedObserver = Observer.Create<NumberCountedEvent>(new Action<NumberCountedEvent>(OnNumberCounted));
     _eventPublisher.GetEvent<NumberCountedEvent>()
         .ObserveOnDispatcher()
         .Subscribe(numberCountedObserver);
 }
开发者ID:renlesterdg,项目名称:nothix9_library,代码行数:8,代码来源:MainWindow.xaml.cs

示例7: Context

			protected override void Context()
			{
				EventPublisher publisher = new EventPublisher();

				publisher.Publish(new EventData("1st"));
				publisher.Publish(new EventData("2nd"));

				eventData = publisher.GetMostRecentPublication<EventData>();
			}
开发者ID:derickbailey,项目名称:appcontroller.cf,代码行数:9,代码来源:CachedEventDataSpecs.cs

示例8: EventEnvelopeCannotBeNull

            public void EventEnvelopeCannotBeNull()
            {
                var messageFactory = new Mock<ICreateMessages>();
                var messageBus = new Mock<ISendMessages<EventEnvelope>>();
                var publisher = new EventPublisher(messageFactory.Object, messageBus.Object);

                var ex = Assert.Throws<ArgumentNullException>(() => publisher.Publish(HeaderCollection.Empty, null));

                Assert.Equal("payload", ex.ParamName);
            }
开发者ID:SparkSoftware,项目名称:infrastructure,代码行数:10,代码来源:EventPublisherTests.cs

示例9: Main

        private static void Main(string[] args)
        {
            var testEventHappened = new TestEventHappened
            {
                Message = "Hello Eventing World!"
            };
            var eventPublisher = new EventPublisher<TestEventHappened>();

            eventPublisher.Publish<object>(testEventHappened);
        }
开发者ID:rajeshdlabz,项目名称:leanandmean,代码行数:10,代码来源:Program.cs

示例10: HeadersCanBeNull

            public void HeadersCanBeNull()
            {
                var messageFactory = new Mock<ICreateMessages>();
                var messageBus = new Mock<ISendMessages<EventEnvelope>>();
                var publisher = new EventPublisher(messageFactory.Object, messageBus.Object);

                publisher.Publish(null, EventEnvelope.Empty);

                messageFactory.Verify(mock => mock.Create(null, EventEnvelope.Empty), Times.Once);
                messageBus.Verify(mock => mock.Send(It.IsAny<Message<EventEnvelope>>()), Times.Once);
            }
开发者ID:SparkSoftware,项目名称:infrastructure,代码行数:11,代码来源:EventPublisherTests.cs

示例11: EventPublisherPublish_UnitTest_RegisteredType_FindsSubjectAndInvokesOnNext

        // ReSharper disable InconsistentNaming
        public void EventPublisherPublish_UnitTest_RegisteredType_FindsSubjectAndInvokesOnNext()
        // ReSharper restore InconsistentNaming
        {
            var memo = new DesignValidationMemo();

            var publisher = new EventPublisher();
            var subscription = publisher.GetEvent<DesignValidationMemo>().Subscribe(m => Assert.AreSame(memo, m));

            publisher.Publish(memo);
            subscription.Dispose();
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:12,代码来源:EventPublisherTests.cs

示例12: EventPublisherGetEvent_UnitTest_FirstTimeForType_New

        // ReSharper disable InconsistentNaming
        public void EventPublisherGetEvent_UnitTest_FirstTimeForType_New()
        // ReSharper restore InconsistentNaming
        {
            var publisher = new EventPublisher();
            Assert.AreEqual(0, publisher.Count);

            var actual = publisher.GetEvent<object>();
            Assert.AreEqual(1, publisher.Count);
            Assert.IsNotNull(actual);
            Assert.IsInstanceOfType(actual, typeof(IObservable<object>));
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:12,代码来源:EventPublisherTests.cs

示例13: Context

            protected override void Context()
            {
                _handler = MockRepository.GenerateMock<IEventHandler<EventData>>();

                IEventPublisher eventPublisher = new EventPublisher();

                eventPublisher.RegisterHandler(_handler);
                eventPublisher.UnregisterHandler(_handler);

                eventPublisher.Publish(new EventData("My Event Data"));
            }
开发者ID:panshuiqing,项目名称:appcontroller,代码行数:11,代码来源:EventAggregatorSpecs.cs

示例14: WithEventStore

 public static IApplicationServer WithEventStore(Func<ILogger, IEnumerable<IApplicationService>, ICommandRouter> routerFactory, Func<IEventStore> eventStoreFactory, IEnumerable<Func<IEventStore, IEventPublisher, IApplicationService>> appServiceFactories, Func<IEnumerable<IProjection>> projections, Func<IEnumerable<IReceptor>> receptors)
 {
     var logger = new ConsoleLogger();
     var eventListner = new EventListener(projections());
     var eventPublisher = new EventPublisher(new List<IEventListener> { eventListner }, new ReceptorSubject(receptors(), logger), logger);
     var observableEventStore = new ObservableEventStore(eventStoreFactory());
     var router = routerFactory(logger, appServiceFactories.Select(fac => fac(observableEventStore, eventPublisher)));
     var appServer = new ApplicationServer(router, logger);
     observableEventStore.Subscribe(eventPublisher);
     eventPublisher.Subscribe(cmd => appServer.DispatchAsync(cmd));
     return appServer;
 }
开发者ID:perokvist,项目名称:Treefort,代码行数:12,代码来源:Configuration.cs

示例15: Context

			protected override void Context()
			{
				_handler = MockRepository.GenerateMock<IEventHandler<EventData>>();
				_handler.Stub(h => h.Handle(null)).IgnoreArguments().Callback(delegate(EventData data)
					{
						_eventData = data.SomeData;
						return true;
					});

				IEventPublisher eventPublisher = new EventPublisher();
				eventPublisher.RegisterHandler(_handler);
				eventPublisher.Publish(new EventData("My Event Data"));
			}
开发者ID:derickbailey,项目名称:appcontroller.cf,代码行数:13,代码来源:EventAggregatorSpecs.cs


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