public Task RevertAsync(RevertControl control, IProgress <OperationProgress> progress) { Verify.State.IsFalse(IsDisposed, "Repository is disposed."); switch (control) { case RevertControl.Abort: if (progress != null) { progress.Report(new OperationProgress(Resources.StrsAbortingRevert.AddEllipsis())); } break; case RevertControl.Continue: if (progress != null) { progress.Report(new OperationProgress(Resources.StrsContinuingRevert.AddEllipsis())); } break; case RevertControl.Quit: if (progress != null) { progress.Report(new OperationProgress(Resources.StrsQuitingRevert.AddEllipsis())); } break; default: throw new ArgumentException( "Unknown RevertControl value: {0}".UseAsFormat(control), "control"); } var block = Monitor.BlockNotifications( RepositoryNotifications.BranchChanged, RepositoryNotifications.WorktreeUpdated, RepositoryNotifications.IndexUpdated); return(Accessor.Revert.InvokeAsync(new RevertParameters(control), progress, CancellationToken.None) .ContinueWith( t => { block.Dispose(); _head.Refresh(); _status.Refresh(); OnStateChanged(); OnUpdated(); TaskUtility.PropagateFaultedStates(t); })); }
private void InvokeRevertControl(RevertControl control) { var parent = _guiProvider.Environment.MainForm; GuiCommands.Revert(parent, Repository, control); }
/// <summary>Create <see cref="CherryPickParameters"/>.</summary> public RevertParameters(RevertControl control) { Control = control; }
public static GuiCommandStatus Revert(IWin32Window parent, Repository repository, RevertControl control) { Verify.Argument.IsNotNull(repository, nameof(repository)); try { ProgressForm.MonitorTaskAsModalWindow(parent, Resources.StrRevert, p => repository.RevertAsync(control, p)); return(GuiCommandStatus.Completed); } catch (OperationCanceledException) { return(GuiCommandStatus.Canceled); } catch (GitException exc) { GitterApplication.MessageBoxService.Show( parent, exc.Message, Resources.ErrFailedToRevert, MessageBoxButton.Close, MessageBoxIcon.Error); return(GuiCommandStatus.Faulted); } }
/// <summary>Create <see cref="CherryPickParameters"/>.</summary> public RevertParameters(RevertControl control) { Control = control; }
public Command GetRevertCommand(RevertControl control) { switch(control) { case RevertControl.Continue: return new RevertCommand(RevertCommand.Continue()); case RevertControl.Quit: return new RevertCommand(RevertCommand.Quit()); case RevertControl.Abort: return new RevertCommand(RevertCommand.Abort()); default: throw new ArgumentException("Unknown enum value.", "control"); } }
private void InvokeRevertControl(RevertControl control) { var parent = _guiProvider.Environment.MainForm; GuiCommands.Revert(parent, Repository, control); }
public Task RevertAsync(RevertControl control, IProgress<OperationProgress> progress) { Verify.State.IsFalse(IsDisposed, "Repository is disposed."); switch(control) { case RevertControl.Abort: if(progress != null) { progress.Report(new OperationProgress(Resources.StrsAbortingRevert.AddEllipsis())); } break; case RevertControl.Continue: if(progress != null) { progress.Report(new OperationProgress(Resources.StrsContinuingRevert.AddEllipsis())); } break; case RevertControl.Quit: if(progress != null) { progress.Report(new OperationProgress(Resources.StrsQuitingRevert.AddEllipsis())); } break; default: throw new ArgumentException( "Unknown RevertControl value: {0}".UseAsFormat(control), "control"); } var block = Monitor.BlockNotifications( RepositoryNotifications.BranchChanged, RepositoryNotifications.WorktreeUpdated, RepositoryNotifications.IndexUpdated); return Accessor.Revert.InvokeAsync(new RevertParameters(control), progress, CancellationToken.None) .ContinueWith( t => { block.Dispose(); _head.Refresh(); _status.Refresh(); OnStateChanged(); OnUpdated(); TaskUtility.PropagateFaultedStates(t); }); }