private void HandleException(SmartCardReadOperation operation, Exception exception) { ExceptionPolicy.HandleException(ContainerBootstrapper.Container, exception); OnCompleted(new DriverCardCompletedEventArgs { Exception = exception, Operation = operation }); }
private void SafelyWithRetry(SmartCardReadOperation operation, Action action) { try { Task.Factory.StartNew(() => { var resilient = new Resilient(OnProgress); resilient.ExecuteWithRetry(action); }) .ContinueWith(t => { if (t.IsFaulted) { HandleException(operation, t.Exception); } }); } catch (Exception ex) { HandleException(operation, ex); } }