本文整理汇总了C#中ISubject.ToProperty方法的典型用法代码示例。如果您正苦于以下问题:C# ISubject.ToProperty方法的具体用法?C# ISubject.ToProperty怎么用?C# ISubject.ToProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISubject
的用法示例。
在下文中一共展示了ISubject.ToProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DownloadVM
public DownloadVM(
IDiversityServiceClient Service,
IConnectivityService Connectivity,
IFieldDataService Storage,
IKeyMappingService Mappings,
EventHierarchyLoader HierarchyLoader,
[Dispatcher] IScheduler Dispatcher
)
{
this.Service = Service;
this.Connectivity = Connectivity;
this.Storage = Storage;
this.Mappings = Mappings;
this.HierarchyLoader = HierarchyLoader;
QueryResult = new ReactiveCollection<Event>();
_IsOnlineAvailable = Connectivity.Status().Select(s => s == ConnectionStatus.Wifi).Do(_ => { this.GetType(); }, ex => { }, () => { })
.ToProperty(this, x => x.IsOnlineAvailable);
_HaveMaxResults = QueryResult.CollectionCountChanged
.Select(c => c >= MAX_RESULTS)
.ToProperty(this, x => x.HaveMaxResults, false);
SearchEvents = new ReactiveAsyncCommand(this.WhenAny(x => x.IsOnlineAvailable, x => x.Value));
SearchEvents.ShowInFlightNotification(Notifications, DiversityResources.Download_SearchingEvents);
SearchEvents.ThrownExceptions
.ShowServiceErrorNotifications(Notifications)
.ShowErrorNotifications(Notifications)
.Subscribe();
SearchEvents
.RegisterAsyncObservable(query =>
Service.GetEventsByLocality(query as string ?? string.Empty)
.TakeUntil(this.OnDeactivation())
)
.Do(_ => QueryResult.Clear())
.Subscribe(QueryResult.AddRange);
CancelDownload = new ReactiveCommand();
DownloadElement = new ReactiveAsyncCommand(this.WhenAny(x => x.IsOnlineAvailable, x => x.Value));
DownloadElement.ThrownExceptions
.ShowServiceErrorNotifications(Notifications)
.ShowErrorNotifications(Notifications)
.Subscribe();
DownloadElement
.RegisterAsyncObservable(ev => IfNotDownloadedYet(ev as Event)
.Select(HierarchyLoader.downloadAndStoreDependencies)
.SelectMany(dl => dl.TakeUntil(CancelDownload))
.Scan(0, (acc, _) => ++acc)
.Do(_ElementsDownloadedSubject.OnNext)
);
_IsDownloading = DownloadElement.ItemsInflight
.Select(x => x > 0)
.ToProperty(this, x => x.IsDownloading);
this.OnDeactivation()
.Subscribe(_ => Messenger.SendMessage(EventMessage.Default, MessageContracts.INIT));
_ElementsDownloadedSubject = new Subject<int>();
_ElementsDownloaded = _ElementsDownloadedSubject.ToProperty(this, x => x.ElementsDownloaded, 0, Dispatcher);
}