using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;
using Tango.MachineStudio.Common.Threading;
namespace Tango.MachineStudio.UI.Threading
{
///
/// Represents the default PPC which will invoke action on the current application dispatcher.
///
///
public class DefaultDispatcherProvider : IDispatcherProvider
{
private Dispatcher _dispatcher;
///
/// Initializes a new instance of the class.
///
/// The dispatcher.
public DefaultDispatcherProvider(Dispatcher dispatcher)
{
_dispatcher = dispatcher;
}
///
/// Invokes the specified action asynchronously.
///
/// The action.
public void Invoke(Action action)
{
_dispatcher.BeginInvoke(action);
}
///
/// Invokes the specified action synchronously.
///
/// The action.
public void InvokeSync(Action action)
{
_dispatcher.Invoke(action);
}
}
}