Beispiel #1
0
        public static async ValueTask <T> InvokeAsync <T>(
            this UIThreadAccessorInstance accessor, Func <ValueTask <T> > action)
        {
            await UIThread.Bind();

            return(await action().ConfigureAwait(false));
        }
Beispiel #2
0
        public static async ValueTask InvokeAsync(
            this UIThreadAccessorInstance accessor, Func <ValueTask> action)
        {
            await UIThread.Bind();

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

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