Example #1
0
 /// <inheritdoc />
 public async Task RunWithResultOperation(IHasAlertSource target, Func <Task <IEnumerable <Alert> > > remoteOperation)
 {
     IEnumerable <Alert> result = null;
     await Task.Factory.StartNew(async() =>
     {
         try
         {
             _busyIndicator.ShowIndicator();
             result = await remoteOperation.Invoke();
         }
         catch (TimeoutException exception)
         {
             _errorNotifier.NotifyError("Timeout Exception", exception.Message);
         }
         catch (CommunicationException exception)
         {
             _errorNotifier.NotifyError("Connection Exception", exception.Message);
         }
         finally
         {
             _busyIndicator.HideIndicator();
             target.SetDataSource(result);
         }
     }, TaskCreationOptions.AttachedToParent);
 }