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 !));
public static async ValueTask <bool> TryInvokeSyncOnAsync( this UIThreadAccessorInstance accessor, Action action) { if (await UIThread.TryBind()) { action(); return(true); } else { return(false); } }
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); } }