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


C# Subject.ObserveOnDispatcher方法代码示例

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


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

示例1: ObserveWindowViewModel

        public ObserveWindowViewModel( string filename, IActorRef tailCoordinator )
        {
            _tailCoordinator = tailCoordinator;
            Filename = filename;
            Title = filename;
            Items = new ReactiveList<String>();

            // start coordinator
            _tailCoordinator.Tell( new TailCoordinatorActor.StartTail( filename, this ) );

            // this is how we can update the viewmodel
            // from the actor.
            Lines = new Subject<String>();
            Lines.ObserveOnDispatcher().Subscribe( item =>
            {
                Items.Add( item );

                if ( Items.Count > 1500 )
                {
                    Items.RemoveAt( 0 );
                }

                SelectedLine = Items.Count - 1;

            } );
        }
开发者ID:njimenez,项目名称:AkkaProjects,代码行数:26,代码来源:ObserveWindowViewModel.cs

示例2: StatsWindowViewModel

        /// <summary>
        /// Initializes a new instance of the <see cref="StatsWindowViewModel"/> class.
        /// </summary>
        public StatsWindowViewModel()
        {
            Items = new ReactiveList<StatViewModel>();

            // this is how we can update the viewmodel 
            // from the actor. 
            AddItem = new Subject<PublishMetrics>();
            AddItem.ObserveOnDispatcher().Subscribe(item => HandleNewItemOnList(item));

            m_vmActor = AkkaSystem.System.ActorOf(StatObserver.GetProps(this), "stat-window");
            Publisher = AkkaSystem.System.ActorSelection("/user/" + AkkaSystemMonitorActor.Name);

            // TODO: what to do if publisher not found.
            Publisher.Tell(new SubscribeMonitorMessage(m_vmActor));
        }
开发者ID:m-daniloff,项目名称:DocumentInspector,代码行数:18,代码来源:StatsWindow.xaml.cs

示例3: MainWindowViewModel

        public MainWindowViewModel()
        {
            Extension = "*.docx";
            Folders = @"C:\Test\Test Docs";
            Items = new ReactiveList<ResultItem>();

            CountCommand = ReactiveCommand.Create();
            CountCommand.Subscribe(x => DoCount());

            // this is how we can update the viewmodel 
            // from the actor. 
            AddItem = new Subject<ResultItem>();
            AddItem.ObserveOnDispatcher().Subscribe(item => Items.Add(item));

            m_vmActor = AkkaSystem.System.ActorOf(DocumentInspectorSupervisor.GetProps(this), ActorPaths.DocumentInspectorSupervisor.Name);
        }
开发者ID:m-daniloff,项目名称:DocumentInspector,代码行数:16,代码来源:MainWindowViewModel.cs

示例4: MainWindowViewModel

        public MainWindowViewModel()
        {
            Extension = "*.txt";
            // Folders = @"c:\Users\njimenez\Documents\Projects\CSharp\Games\Poker";
            Folders = @"d:\downloads";
            Items = new ReactiveList<ResultItem>();

            CountCommand = ReactiveCommand.Create();
            CountCommand.Subscribe( x => DoCount() );

            // this is how we can update the viewmodel
            // from the actor.
            AddItem = new Subject<ResultItem>();
            AddItem.ObserveOnDispatcher().Subscribe( item => Items.Add( item ) );

            m_vmActor = AkkaSystem.System.ActorOf( WordCounterSupervisor.GetProps( this ), ActorPaths.WordCounterSupervisorActor.Name );
        }
开发者ID:njimenez,项目名称:AkkaProjects,代码行数:17,代码来源:MainWindowViewModel.cs

示例5: MainWindowViewModel

        public MainWindowViewModel()
        {
            Extension = "*.txt";
            Folders = @"c:\";
            Items = new ReactiveList<FileInfoViewModel>();

            CrawlCommand = ReactiveCommand.Create();
            CrawlCommand.Subscribe( x => Handle() );

            ObserveCommand = ReactiveCommand.Create();
            ObserveCommand.Subscribe( x => ObserveFile() );

            AddItem = new Subject<FileInfoViewModel>();
            AddItem.ObserveOnDispatcher().Subscribe( item => Items.Add( item ) );

            m_vmActor = App.WinTailSystem.ActorOf( WinTailSupervisor.GetProps( this ), "supervisor" );
            m_tailCoordinator = App.WinTailSystem.ActorOf( TailCoordinatorActor.GetProps(), "tailcoordinator" );
        }
开发者ID:njimenez,项目名称:AkkaProjects,代码行数:18,代码来源:MainWindowViewModel.cs

示例6: LauncherFormViewModel

        public LauncherFormViewModel()
        {
            /* INITIALIZE ACTORS */
            var props = Props.Create( () => new MainFormActor( this ) );
            m_mainFormActor = App.GithubSystem.ActorOf( props, ActorPaths.MainFormActor.Name );

            props = Props.Create( () => new GithubCommanderActor() );
            App.GithubSystem.ActorOf( props, ActorPaths.GithubCommanderActor.Name );

            props = Props.Create( () => new GithubValidatorActor( GithubClientFactory.GetClient() ) );
            App.GithubSystem.ActorOf( props, ActorPaths.GithubValidatorActor.Name );

            LaunchSearch = ReactiveCommand.Create( null );
            LaunchSearch.Subscribe( x => DoLaunchSearch() );

            // to be able to launch a window from the actor system
            m_LaunchWindow = new Subject<MainFormActor.LaunchRepoResultsWindow>();
            m_LaunchWindow.ObserveOnDispatcher().Subscribe( x => DoLaunchWindow( x ) );
        }
开发者ID:njimenez,项目名称:AkkaProjects,代码行数:19,代码来源:LauncherForm.xaml.cs

示例7: DispatcherMessageQueueThread

            public DispatcherMessageQueueThread(string name, Action<Exception> handler)
                : base(name)
            {
                _actionSubject = new Subject<Action>();
                _actionObserver = _actionSubject;
                _subscription = _actionSubject
#if WINDOWS_UWP
                    .ObserveOnDispatcher()
#else
                    .ObserveOn(Dispatcher.CurrentDispatcher)
#endif
                    .Subscribe(action =>
                    {
                        try
                        {
                            action();
                        }
                        catch (Exception ex)
                        {
                            handler(ex);
                        }
                    });
            }
开发者ID:chukcha-wtf,项目名称:react-native-windows,代码行数:23,代码来源:MessageQueueThread.cs


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