Exemple #1
0
 public static async ValueTask <TryInvokeAsyncResult <T> > TryInvokeAsync <T>(
     this UIThreadAccessorInstance accessor, Func <Task <T> > action)
 {
     if (await UIThread.TryBind())
     {
         return(new TryInvokeAsyncResult <T>(true, await action().ConfigureAwait(false)));
     }
     else
     {
         return(new TryInvokeAsyncResult <T>(false, default !));
Exemple #2
0
 public static async ValueTask <bool> TryInvokeSyncOnAsync(
     this UIThreadAccessorInstance accessor, Action action)
 {
     if (await UIThread.TryBind())
     {
         action();
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #3
0
        public static async ValueTask <bool> TryInvokeAsync(
            this UIThreadAccessorInstance accessor, Func <Task> action)
        {
            if (await UIThread.TryBind())
            {
                await action().ConfigureAwait(false);

                return(true);
            }
            else
            {
                return(false);
            }
        }