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


C# EventPublisher.GetEvent方法代码示例

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


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

示例1: EventPublisherGetEvent_UnitTest_SecondTimeForType_Existing

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

            var first = publisher.GetEvent<object>();
            Assert.AreEqual(1, publisher.Count);
            Assert.IsNotNull(first);
            Assert.IsInstanceOfType(first, typeof(IObservable<object>));

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

示例2: 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

示例3: 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

示例4: 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

示例5: EventPublisherPublish_RemoveEvent_UnregisteredObjectType_NotRemoved

        // ReSharper disable InconsistentNaming
        public void EventPublisherPublish_RemoveEvent_UnregisteredObjectType_NotRemoved()
        // ReSharper restore InconsistentNaming
        {
            var publisher = new EventPublisher();
            var subscription = publisher.GetEvent<DesignValidationMemo>();
            Assert.AreEqual(1, publisher.Count);

            var result = publisher.RemoveEvent<Memo>();
            Assert.AreEqual(1, publisher.Count);
            Assert.IsFalse(result);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:12,代码来源:EventPublisherTests.cs

示例6: InitEventsLogic

        private void InitEventsLogic()
        {
            EventPublisher = new EventPublisher();
            // klikniecie na kategorie
            EventPublisher.GetEvent<CollectionViewGroup>()
                          .Subscribe(cvg => FilteredUsers = new ObservableCollection<User>(cvg.Items.Cast<User>()));
            // klikniecie na usera
            EventPublisher.GetEvent<User>()
                          .Subscribe(user => SelectedUser = user);
            // inicjalizacja edycji usera
            EventPublisher.GetEvent<EditUserInitEvent>()
                          .Subscribe(
                              _ =>
                                  {
                                      EditUser =
                                          new User
                                              {
                                                  Address = SelectedUser.Address,
                                                  FirstName = SelectedUser.FirstName,
                                                  LastName = SelectedUser.LastName,
                                                  BirthDate = SelectedUser.BirthDate,
                                                  Type = SelectedUser.Type
                                              };
                                      EditModeNewUser = false;
                                  });
            EventPublisher.GetEvent<NewUserInitEvent>().Subscribe(_ =>
                {
                    EditUser = new User();
                    EditModeNewUser = true;
                });
            // obsluga potwierdzenia edycji
            EventPublisher.GetEvent<EditUserFinishedEvent>().Subscribe(_ =>
                {
                    User selected;
                    if (EditModeNewUser)
                    {
                        Users.Add(EditUser);
                        selected = EditUser;
                    }
                    else
                    {
                        SelectedUser.FirstName = EditUser.FirstName;
                        SelectedUser.LastName = EditUser.LastName;
                        SelectedUser.Address = EditUser.Address;
                        SelectedUser.BirthDate = EditUser.BirthDate;
                        SelectedUser.Type = EditUser.Type;
                        selected = SelectedUser;
                    }

                    //refresh powoduje wynullowanie SelectedUser, why?
                    Cvs.View.Refresh();
                    FilteredUsers = new ObservableCollection<User>(Users);
                    SelectedUser = selected;
                });
        }
开发者ID:solarplexus6,项目名称:Oop,代码行数:55,代码来源:MainWindowModel.cs


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