/// <summary> /// Executes the specified delegate asynchronously with the specified arguments on the thread that the Dispatcher was created on. /// </summary> /// <param name="method">The method.</param> /// <param name="args">The arguments to pass into the method.</param> /// <returns>The task representing the action.</returns> public virtual Task InvokeAsync(Delegate method, params object[] args) { var dispatcher = CurrentDispatcher; return(DispatcherExtensions.InvokeAsync(dispatcher, method, args)); }
/// <summary> /// Executes the specified asynchronous operation on the thread that the Dispatcher was created on with the ability to return value with supporting of CancellationToken /// </summary> /// <typeparam name="T">The type of the result of the asynchronous operation</typeparam> /// <param name="funcAsync">The asynchronous operation which returns a value and supports cancelling</param> /// <param name="cancellationToken">The cancellation token</param> /// <returns>The task representing the asynchronous operation with the returning value</returns> public virtual Task <T> InvokeTaskAsync <T>(Func <CancellationToken, Task <T> > funcAsync, CancellationToken cancellationToken) { var dispatcher = CurrentDispatcher; return(DispatcherExtensions.InvokeAsync(dispatcher, funcAsync, cancellationToken)); }
/// <summary> /// Executes the specified asynchronous operation on the thread that the Dispatcher was created on /// </summary> /// <param name="actionAsync">The asynchronous operation without returning a value</param> /// <returns>The task representing the asynchronous operation</returns> public virtual Task InvokeTaskAsync(Func <Task> actionAsync) { var dispatcher = CurrentDispatcher; return(DispatcherExtensions.InvokeAsync(dispatcher, actionAsync)); }
/// <summary> /// Executes the specified asynchronous operation on the thread that the Dispatcher was created on with the ability to return value. /// </summary> /// <typeparam name="T">The type of the result of the asynchronous operation</typeparam> /// <param name="funcAsync">The asynchronous operation which returns a value</param> /// <returns>The task representing the asynchronous operation with the returning value</returns> public virtual Task <T> InvokeTaskAsync <T>(Func <Task <T> > funcAsync) { var dispatcher = CurrentDispatcher; return(DispatcherExtensions.InvokeAsync(dispatcher, funcAsync)); }
/// <summary> /// Executes the specified asynchronous operation on the thread that the Dispatcher was created on with supporting of CancellationToken /// </summary> /// <param name="actionAsync">The asynchronous operation without returning a value</param> /// <param name="cancellationToken">The cancellation token</param> /// <returns>The task representing the asynchronous operation</returns> public Task InvokeTaskAsync(Func <CancellationToken, Task> actionAsync, CancellationToken cancellationToken) { var dispatcher = CurrentDispatcher; return(DispatcherExtensions.InvokeAsync(dispatcher, actionAsync, cancellationToken)); }