public void OnCompleted(Action continuation) => InternalUIThread.ContinueOnUIThread(isBound => { this.isBound = isBound; this.IsCompleted = true; continuation(); });
private protected virtual async void OnExecute(object?parameter) { try { var _ = await this.OnExecuteAsync(parameter). ConfigureAwait(false); } catch (Exception ex) { // HACK: Because the exception will ignore by 'async void' bottom stack, // (And will reraise delaying UnobservedException on finalizer thread.) // This captures logical task context and reraise on UI thread pumps immediately. var edi = ExceptionDispatchInfo.Capture(ex); InternalUIThread.ContinueOnUIThread(_ => edi.Throw()); } }
public static ValueTask <bool> IsBoundAsync() => InternalUIThread.IsBoundAsync();
public void OnCompleted(Action continuation) => InternalUIThread.ContinueOnWorkerThread(() => { this.IsCompleted = true; continuation(); });