本文整理汇总了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()));
}
示例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);
}