DispatcherObservable
Provides a set of extension methods for scheduling actions performed through observable sequences on UI dispatchers.
using System.Reactive.Concurrency;
using Windows.UI.Core;
using Windows.UI.Xaml;
namespace System.Reactive.Linq
{
[CLSCompliant(false)]
public static class DispatcherObservable
{
public static IObservable<TSource> ObserveOn<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<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<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<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> ObserveOnDispatcher<TSource>(this IObservable<TSource> source)
{
if (source == null)
throw new ArgumentNullException("source");
return Synchronization.ObserveOn(source, CoreDispatcherScheduler.Current);
}
public static IObservable<TSource> ObserveOnDispatcher<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<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<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<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<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> SubscribeOnDispatcher<TSource>(this IObservable<TSource> source)
{
if (source == null)
throw new ArgumentNullException("source");
return Synchronization.SubscribeOn(source, CoreDispatcherScheduler.Current);
}
public static IObservable<TSource> SubscribeOnDispatcher<TSource>(this IObservable<TSource> source, CoreDispatcherPriority priority)
{
if (source == null)
throw new ArgumentNullException("source");
return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(CoreDispatcherScheduler.Current.Dispatcher, priority));
}
}
}