Skip to content

PureWeen/XamarinDispatchScheduler

Repository files navigation

Xamarin Main Thread Dispatcher

Nuget

Examples

Observable
    .Timer(TimeSpan.FromSeconds(2))
    .ObserveOn(XamarinDispatcherScheduler.Current)
    .Subscribe(_ =>
    {
        lblChangeMe.Text = "Changed";
    });
//Helper to check if you're on the main thread
if (!XamarinDispatcherScheduler.OnMainThread())
{
    throw new Exception("Scheduler fail");
}

I borrowed from the CoreDispatchScheduler From Rx.NET and the Xamarin.Forms BeginInvokeOnMainThread implementations to create a combined Scheduler that will work Cross Platform for Xamarin.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published