DispatcherObservable
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 System.Threading;
using System.Windows.Threading;
namespace System.Reactive.Linq
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public static class DispatcherObservable
{
public static IObservable<TSource> ObserveOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, Dispatcher dispatcher)
{
if (source == null)
throw new ArgumentNullException("source");
if (dispatcher == null)
throw new ArgumentNullException("dispatcher");
return ObserveOn_(source, dispatcher);
}
public static IObservable<TSource> ObserveOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, Dispatcher dispatcher, DispatcherPriority priority)
{
if (source == null)
throw new ArgumentNullException("source");
if (dispatcher == null)
throw new ArgumentNullException("dispatcher");
return ObserveOn_(source, dispatcher, priority);
}
public static IObservable<TSource> ObserveOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, DispatcherScheduler scheduler)
{
if (source == null)
throw new ArgumentNullException("source");
if (scheduler == null)
throw new ArgumentNullException("scheduler");
return ObserveOn_(source, scheduler.Dispatcher, scheduler.Priority);
}
public static IObservable<TSource> ObserveOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, DispatcherObject dispatcherObject)
{
if (source == null)
throw new ArgumentNullException("source");
if (dispatcherObject == null)
throw new ArgumentNullException("dispatcherObject");
return ObserveOn_(source, dispatcherObject.get_Dispatcher());
}
public static IObservable<TSource> ObserveOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, DispatcherObject dispatcherObject, DispatcherPriority priority)
{
if (source == null)
throw new ArgumentNullException("source");
if (dispatcherObject == null)
throw new ArgumentNullException("dispatcherObject");
return ObserveOn_(source, dispatcherObject.get_Dispatcher(), priority);
}
public static IObservable<TSource> ObserveOnDispatcher<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source)
{
if (source == null)
throw new ArgumentNullException("source");
return ObserveOn_(source, DispatcherScheduler.Current.Dispatcher);
}
public static IObservable<TSource> ObserveOnDispatcher<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, DispatcherPriority priority)
{
if (source == null)
throw new ArgumentNullException("source");
return ObserveOn_(source, DispatcherScheduler.Current.Dispatcher, priority);
}
private static IObservable<TSource> ObserveOn_<[System.Runtime.CompilerServices.Nullable(2)] TSource>(IObservable<TSource> source, Dispatcher dispatcher, DispatcherPriority priority)
{
return Synchronization.ObserveOn(source, (SynchronizationContext)new DispatcherSynchronizationContext(dispatcher, priority));
}
private static IObservable<TSource> ObserveOn_<[System.Runtime.CompilerServices.Nullable(2)] TSource>(IObservable<TSource> source, Dispatcher dispatcher)
{
return Synchronization.ObserveOn(source, (SynchronizationContext)new DispatcherSynchronizationContext(dispatcher));
}
public static IObservable<TSource> SubscribeOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, Dispatcher dispatcher)
{
if (source == null)
throw new ArgumentNullException("source");
if (dispatcher == null)
throw new ArgumentNullException("dispatcher");
return SubscribeOn_(source, dispatcher);
}
public static IObservable<TSource> SubscribeOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, Dispatcher dispatcher, DispatcherPriority priority)
{
if (source == null)
throw new ArgumentNullException("source");
if (dispatcher == null)
throw new ArgumentNullException("dispatcher");
return SubscribeOn_(source, dispatcher, priority);
}
public static IObservable<TSource> SubscribeOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, DispatcherScheduler scheduler)
{
if (source == null)
throw new ArgumentNullException("source");
if (scheduler == null)
throw new ArgumentNullException("scheduler");
return SubscribeOn_(source, scheduler.Dispatcher, scheduler.Priority);
}
public static IObservable<TSource> SubscribeOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, DispatcherObject dispatcherObject)
{
if (source == null)
throw new ArgumentNullException("source");
if (dispatcherObject == null)
throw new ArgumentNullException("dispatcherObject");
return SubscribeOn_(source, dispatcherObject.get_Dispatcher());
}
public static IObservable<TSource> SubscribeOn<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, DispatcherObject dispatcherObject, DispatcherPriority priority)
{
if (source == null)
throw new ArgumentNullException("source");
if (dispatcherObject == null)
throw new ArgumentNullException("dispatcherObject");
return SubscribeOn_(source, dispatcherObject.get_Dispatcher(), priority);
}
public static IObservable<TSource> SubscribeOnDispatcher<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source)
{
if (source == null)
throw new ArgumentNullException("source");
return SubscribeOn_(source, DispatcherScheduler.Current.Dispatcher);
}
public static IObservable<TSource> SubscribeOnDispatcher<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, DispatcherPriority priority)
{
if (source == null)
throw new ArgumentNullException("source");
return SubscribeOn_(source, DispatcherScheduler.Current.Dispatcher, priority);
}
private static IObservable<TSource> SubscribeOn_<[System.Runtime.CompilerServices.Nullable(2)] TSource>(IObservable<TSource> source, Dispatcher dispatcher, DispatcherPriority priority)
{
return Synchronization.SubscribeOn(source, (SynchronizationContext)new DispatcherSynchronizationContext(dispatcher, priority));
}
private static IObservable<TSource> SubscribeOn_<[System.Runtime.CompilerServices.Nullable(2)] TSource>(IObservable<TSource> source, Dispatcher dispatcher)
{
return Synchronization.SubscribeOn(source, (SynchronizationContext)new DispatcherSynchronizationContext(dispatcher));
}
}
}