<PackageReference Include="System.Reactive" Version="5.0.0-preview.220" />

CoreDispatcherObservable

public static class CoreDispatcherObservable
Provides a set of extension methods for scheduling actions performed through observable sequences on UI dispatchers.
using System.Reactive.Concurrency; using System.Runtime.CompilerServices; using Windows.UI.Core; using Windows.UI.Xaml; namespace System.Reactive.Linq { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] [CLSCompliant(false)] public static class CoreDispatcherObservable { public static IObservable<TSource> ObserveOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher) { if (source == null) throw new ArgumentNullException("source"); if (dispatcher == null) throw new ArgumentNullException("dispatcher"); return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(dispatcher)); } public static IObservable<TSource> ObserveOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher, CoreDispatcherPriority priority) { if (source == null) throw new ArgumentNullException("source"); if (dispatcher == null) throw new ArgumentNullException("dispatcher"); return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(dispatcher, priority)); } public static IObservable<TSource> ObserveOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, DependencyObject dependencyObject) { if (source == null) throw new ArgumentNullException("source"); if (dependencyObject == null) throw new ArgumentNullException("dependencyObject"); return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(dependencyObject.get_Dispatcher())); } public static IObservable<TSource> ObserveOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, DependencyObject dependencyObject, CoreDispatcherPriority priority) { if (source == null) throw new ArgumentNullException("source"); if (dependencyObject == null) throw new ArgumentNullException("dependencyObject"); return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(dependencyObject.get_Dispatcher(), priority)); } public static IObservable<TSource> ObserveOnCoreDispatcher<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source) { if (source == null) throw new ArgumentNullException("source"); return Synchronization.ObserveOn(source, CoreDispatcherScheduler.Current); } public static IObservable<TSource> ObserveOnDispatcher<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, CoreDispatcherPriority priority) { if (source == null) throw new ArgumentNullException("source"); return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(CoreDispatcherScheduler.Current.Dispatcher, priority)); } public static IObservable<TSource> SubscribeOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher) { if (source == null) throw new ArgumentNullException("source"); if (dispatcher == null) throw new ArgumentNullException("dispatcher"); return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(dispatcher)); } public static IObservable<TSource> SubscribeOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher, CoreDispatcherPriority priority) { if (source == null) throw new ArgumentNullException("source"); if (dispatcher == null) throw new ArgumentNullException("dispatcher"); return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(dispatcher, priority)); } public static IObservable<TSource> SubscribeOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, DependencyObject dependencyObject) { if (source == null) throw new ArgumentNullException("source"); if (dependencyObject == null) throw new ArgumentNullException("dependencyObject"); return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(dependencyObject.get_Dispatcher())); } public static IObservable<TSource> SubscribeOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, DependencyObject dependencyObject, CoreDispatcherPriority priority) { if (source == null) throw new ArgumentNullException("source"); if (dependencyObject == null) throw new ArgumentNullException("dependencyObject"); return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(dependencyObject.get_Dispatcher(), priority)); } public static IObservable<TSource> SubscribeOnCoreDispatcher<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source) { if (source == null) throw new ArgumentNullException("source"); return Synchronization.SubscribeOn(source, CoreDispatcherScheduler.Current); } public static IObservable<TSource> SubscribeOnDispatcher<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, CoreDispatcherPriority priority) { if (source == null) throw new ArgumentNullException("source"); return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(CoreDispatcherScheduler.Current.Dispatcher, priority)); } } }