Пример #1
0
 public void OnCompleted(Action continuation) =>
 InternalUIThread.ContinueOnUIThread(isBound =>
 {
     this.isBound     = isBound;
     this.IsCompleted = true;
     continuation();
 });
Пример #2
0
 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());
     }
 }
Пример #3
0
 public static ValueTask <bool> IsBoundAsync() =>
 InternalUIThread.IsBoundAsync();
Пример #4
0
 public void OnCompleted(Action continuation) =>
 InternalUIThread.ContinueOnWorkerThread(() =>
 {
     this.IsCompleted = true;
     continuation();
 });