private ChangeItemAction DeleteError(IVirtualItem item, AvailableItemActions available, Exception error)
 {
     ChangeItemAction none = ChangeItemAction.None;
     if (this.OnDeleteError != null)
     {
         ChangeItemErrorEventArgs e = new ChangeItemErrorEventArgs(item, available, error);
         this.OnDeleteError(this, e);
         none = e.Action;
     }
     return none;
 }
 private ChangeItemAction ItemError(EventHandler<ChangeItemErrorEventArgs> handler, IVirtualItem item, AvailableItemActions available, Exception error)
 {
     ChangeItemAction none = ChangeItemAction.None;
     if (handler != null)
     {
         ChangeItemErrorEventArgs e = new ChangeItemErrorEventArgs(item, available, error);
         handler(this, e);
         none = e.Action;
     }
     return none;
 }
 protected bool TryAutoElevate(ChangeItemErrorEventArgs e)
 {
     if (((e.Error is UnauthorizedAccessException) && e.CanElevate) && (this.AutoElevateProcess != null))
     {
         IElevatable item = e.Item as IElevatable;
         if (((item != null) && item.CanElevate) && item.Elevate(this.AutoElevateProcess))
         {
             return true;
         }
         e.CanElevate = false;
     }
     return false;
 }
 private void SyncronizedItemError(object sender, ChangeItemErrorEventArgs e)
 {
     this.ChangeProgressState(ProgressState.Error);
     MessageDialogResult result = this.ProcessUnauthorizedAccessException(e);
     switch (result)
     {
         case MessageDialogResult.None:
         {
             MessageDialogResult[] buttons = e.CanRetry ? ButtonsRetrySkipCancel : ButtonsSkipCancel;
             MessageDialogResult defaultButton = e.CanRetry ? MessageDialogResult.Retry : MessageDialogResult.Skip;
             result = MessageDialog.Show(this, e.Error.Message, this.ItemErrorCaption, buttons, MessageBoxIcon.Hand, defaultButton);
             break;
         }
         case MessageDialogResult.SkipAll:
             if (this.DefaultErrorAction == null)
             {
                 this.DefaultErrorAction = new Dictionary<System.Type, ChangeItemAction>();
             }
             this.DefaultErrorAction.Add(e.Error.GetType(), ChangeItemAction.Skip);
             e.Action = ChangeItemAction.Skip;
             goto Label_00AF;
     }
     e.FromMessageDialogResult(result);
 Label_00AF:
     if (e.Action != ChangeItemAction.Cancel)
     {
         this.ChangeProgressState(ProgressState.Normal);
     }
 }
 protected MessageDialogResult ProcessUnauthorizedAccessException(ChangeItemErrorEventArgs e)
 {
     MessageDialogResult none = MessageDialogResult.None;
     if ((e.Error is UnauthorizedAccessException) && e.CanElevate)
     {
         IElevatable item = e.Item as IElevatable;
         if ((item == null) || !item.CanElevate)
         {
             return none;
         }
         bool checkBoxChecked = true;
         none = MessageDialog.Show(this, string.Format(Resources.sAskElevateOperationPermissions, e.Item.FullName), Resources.sWarning, Resources.sDoThisForAll, ref checkBoxChecked, new MessageDialogResult[] { MessageDialogResult.Shield, MessageDialogResult.Skip, MessageDialogResult.Cancel }, MessageBoxIcon.Exclamation, MessageDialogResult.Shield);
         if (none == MessageDialogResult.Shield)
         {
             if (checkBoxChecked)
             {
                 this.AutoElevateProcess = new ElevatedProcess(true, TimeSpan.FromSeconds(9.0));
             }
             if (item.Elevate(this.AutoElevateProcess ?? new ElevatedProcess()))
             {
                 return MessageDialogResult.Retry;
             }
             if (this.AutoElevateProcess != null)
             {
                 this.AutoElevateProcess.Shutdown();
             }
             this.AutoElevateProcess = null;
             return MessageDialogResult.None;
         }
         if ((none == MessageDialogResult.Retry) && checkBoxChecked)
         {
             none = MessageDialogResult.SkipAll;
         }
     }
     return none;
 }
 protected void ItemError(object sender, ChangeItemErrorEventArgs e)
 {
     ChangeItemAction action;
     if ((this.DefaultErrorAction != null) && this.DefaultErrorAction.TryGetValue(e.Error.GetType(), out action))
     {
         e.Action = action;
     }
     else if (this.TryAutoElevate(e))
     {
         e.Action = ChangeItemAction.Retry;
     }
     else
     {
         this.WorkerTrace.TraceException(TraceEventType.Error, e.Error);
         if (base.InvokeRequired)
         {
             base.Invoke(new EventHandler<ChangeItemErrorEventArgs>(this.SyncronizedItemError), new object[] { sender, e });
         }
         else
         {
             this.SyncronizedItemError(sender, e);
         }
     }
 }
 private void SyncronizedMoveItemError(object sender, ChangeItemErrorEventArgs e)
 {
     this.ChangeProgressState(ProgressState.Error);
     MessageDialogResult result = base.ProcessUnauthorizedAccessException(e);
     if (result == MessageDialogResult.None)
     {
         result = MessageDialog.Show(this, e.Error.Message, Resources.sCaptionErrorMovingFile, MessageDialog.ButtonsRetrySkipCancel, MessageBoxIcon.Hand, MessageDialogResult.Retry);
     }
     e.FromMessageDialogResult(result);
     if (e.Action != ChangeItemAction.Cancel)
     {
         this.ChangeProgressState(ProgressState.Normal);
     }
 }
 private void MoveItemError(object sender, ChangeItemErrorEventArgs e)
 {
     if (base.TryAutoElevate(e))
     {
         e.Action = ChangeItemAction.Retry;
     }
     else
     {
         base.WorkerTrace.TraceException(TraceEventType.Error, e.Error);
         if (base.InvokeRequired)
         {
             base.Invoke(new EventHandler<ChangeItemErrorEventArgs>(this.SyncronizedMoveItemError), new object[] { sender, e });
         }
         else
         {
             this.SyncronizedMoveItemError(sender, e);
         }
     }
 }