// -----------------------------------------------------------------------
//
// Copyright 2014 MIT Licence. See licence.md for more information.
//
// -----------------------------------------------------------------------
namespace Perspex.Threading
{
using System;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
public class PerspexScheduler : LocalScheduler
{
private static readonly PerspexScheduler instance = new PerspexScheduler();
public static PerspexScheduler Instance
{
get { return instance; }
}
public override IDisposable Schedule(TState state, TimeSpan dueTime, Func action)
{
return DispatcherTimer.Run(() =>
{
action(this, state);
return false;
}, dueTime);
}
}
}