Exemplo n.º 1
0
 private async Task CheckAutoStopAsync(Task task)
 {
     try
     {
         await task;
         if (OnAutoClose != null)
         {
             OnAutoClose?.Invoke(this, EventArgs.Empty);
         }
         else if (!IsDisposed && IsHandleCreated)
         {
             BeginInvoke(new MethodInvoker(() =>
             {
                 try
                 {
                     if (!IsDisposed)
                     {
                         Dispose(true);
                     }
                 }
                 catch (Exception ex)
                 {
                     WebErrorLog.ErrorInstence.StartErrorLog(ex);
                 }
             }));
         }
     }
     catch (OperationCanceledException) { }
     catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); }
 }
Exemplo n.º 2
0
 private async Task CheckAutoStopAsync(Task task)
 {
     try
     {
         await task;
         OnAutoClose?.Invoke(this, EventArgs.Empty);
     }
     catch (OperationCanceledException) { }
     catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); }
 }