Beispiel #1
0
        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);
        }
Beispiel #2
0
 public static void Do <TProgress>(this global::Windows.Foundation.IAsyncActionWithProgress <TProgress> Task)
 {
     using (AsyncHelper.AsyncBridge Helper = AsyncHelper.Wait)
         Helper.Run(Task.AsTask());
 }
Beispiel #3
0
 public static void Do(this Task Task)
 {
     using (AsyncHelper.AsyncBridge Helper = AsyncHelper.Wait)
         Helper.Run(Task);
 }