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


C# ReactiveList.LastOrDefault方法代码示例

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


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

示例1: TrackingControlViewModel

        public TrackingControlViewModel(ITrackPresenter TrackPresenter, IMappingService MappingService, TrackFormatterManager TrackFormatterManager)
        {
            _trackPresenter = TrackPresenter;
            _trackFormatterManager = TrackFormatterManager;
            _mappingService = MappingService;

            _track = new ReactiveList<EarthPoint>();
            _track.Changed
                  .Subscribe(_ => RefreshTrack());

            LoadTrack = ReactiveCommand.CreateAsyncTask(LoadTrackImpl);
            SaveTrack = ReactiveCommand.CreateAsyncTask(SaveTrackImpl);
            ReactiveCommand<object> clearCommand = ReactiveCommand.Create(_track.IsEmptyChanged.Select(e => !e));
            clearCommand.Subscribe(_ => _track.Clear());
            ClearTrack = clearCommand;

            IConnectableObservable<TrackPathRider> prp =
                _track.Changed
                      .Select(_ => new TrackPathRider(new GpsTrack(_track.ToList())))
                      .Publish();
            PathRider = prp;
            prp.Connect();

            _mappingService.Clicks
                           .Where(c => c.Action == MouseAction.LeftClick)
                           .Subscribe(c => AppendPointToTrack(c.Point));

            _mappingService.Clicks
                           .Where(c => c.Action == MouseAction.RightClick)
                           .Subscribe(c => _track.Remove(_track.LastOrDefault()));
        }
开发者ID:NpoSaut,项目名称:netEMapTools,代码行数:31,代码来源:TrackingControlViewModel.cs

示例2: OperationViewModel

        public OperationViewModel(IScheduler scheduler)
        {
            dialogService = Locator.CurrentMutable.GetService<IDialogService>();
            stopWatch = new Stopwatch();

            Start = ReactiveCommand.Create(this.WhenAny(m => m.TimerState, m => m.Value != TimerState.Running));
            Start.Subscribe(_ => StartImpl());
            Stop = ReactiveCommand.Create(this.WhenAny(m => m.TimerState, m => m.Value != TimerState.Initial));
            Stop.Subscribe(_ => StopImpl());

            LapTimes = new ReactiveList<LapTime>();
            Lap = ReactiveCommand.CreateAsyncObservable(this.WhenAny(m => m.TimerState, m => m.Value == TimerState.Running), _ => Observable.Return(stopWatch.Elapsed));
            Lap.Subscribe(x => LapTimes.Add(new LapTime(x, x - (LapTimes.LastOrDefault()?.Elapsed ?? TimeSpan.Zero))));
            this.WhenAny(vm => vm.TimerState, oc => oc.Value == TimerState.Initial).Subscribe(_ => LapTimes.Reset());

            Observable.Interval(TimeSpan.FromMilliseconds(10d))
                .Select(_ => GetFormattedElapsed(stopWatch.Elapsed))
                .ToProperty(this, vm => vm.Elapsed, out elapsed, GetFormattedElapsed(TimeSpan.Zero), scheduler);
        }
开发者ID:ailen0ada,项目名称:RxUISimpleTimer,代码行数:19,代码来源:OperationViewModel.cs


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