public static T Do <T>(this ValueTask <T> Task, T Default = default(T)) { T Result = Default; using (System.Threading.AutoResetEvent Wait = new System.Threading.AutoResetEvent(false)) { using (AsyncHelper.AsyncBridge Helper = AsyncHelper.Wait) Helper.Run(Task, (ValueTask <T> CallBack) => { Result = CallBack.Result; Wait.Set(); }); Wait.WaitOne(); } return(Result); }
public static void Do <TProgress>(this global::Windows.Foundation.IAsyncActionWithProgress <TProgress> Task) { using (AsyncHelper.AsyncBridge Helper = AsyncHelper.Wait) Helper.Run(Task.AsTask()); }
public static void Do(this Task Task) { using (AsyncHelper.AsyncBridge Helper = AsyncHelper.Wait) Helper.Run(Task); }