4 using System.Threading.Tasks;
5 using System.Windows.Threading;
7 using SiliconStudio.Presentation.Services;
9 namespace SiliconStudio.Presentation.View
13 private readonly Dispatcher dispatcher;
22 if (dispatcher == null)
throw new ArgumentNullException(
"dispatcher");
23 this.dispatcher = dispatcher;
28 dispatcher.Invoke(callback);
31 public TResult Invoke<TResult>(Func<TResult> callback)
33 return dispatcher.Invoke(callback);
38 return () => dispatcher.Invoke(callback);
43 return dispatcher.InvokeAsync(callback).
Task;
48 return dispatcher.InvokeAsync(callback).
Task;
static DispatcherService Create()
Action Invoked(Action callback)
DispatcherService(Dispatcher dispatcher)
void Invoke(Action callback)
Task InvokeAsync(Action callback)