public Task CherryPickAsync(CherryPickControl control, IProgress <OperationProgress> progress) { Verify.State.IsFalse(IsDisposed, "Repository is disposed."); switch (control) { case CherryPickControl.Abort: if (progress != null) { progress.Report(new OperationProgress(Resources.StrsAbortingCherryPick.AddEllipsis())); } break; case CherryPickControl.Continue: if (progress != null) { progress.Report(new OperationProgress(Resources.StrsContinuingCherryPick.AddEllipsis())); } break; case CherryPickControl.Quit: if (progress != null) { progress.Report(new OperationProgress(Resources.StrsQuitingCherryPick.AddEllipsis())); } break; default: throw new ArgumentException( "Unknown CherryPickControl value: {0}".UseAsFormat(control), "control"); } var block = Monitor.BlockNotifications( RepositoryNotifications.BranchChanged, RepositoryNotifications.WorktreeUpdated, RepositoryNotifications.IndexUpdated); return(Accessor.CherryPick.InvokeAsync(new CherryPickParameters(control), progress, CancellationToken.None) .ContinueWith( t => { block.Dispose(); _head.Refresh(); _status.Refresh(); OnStateChanged(); OnUpdated(); TaskUtility.PropagateFaultedStates(t); })); }
public async Task CherryPickAsync(CherryPickControl control, IProgress <OperationProgress> progress) { Verify.State.IsFalse(IsDisposed, "Repository is disposed."); switch (control) { case CherryPickControl.Abort: progress?.Report(new OperationProgress(Resources.StrsAbortingCherryPick.AddEllipsis())); break; case CherryPickControl.Continue: progress?.Report(new OperationProgress(Resources.StrsContinuingCherryPick.AddEllipsis())); break; case CherryPickControl.Quit: progress?.Report(new OperationProgress(Resources.StrsQuitingCherryPick.AddEllipsis())); break; default: throw new ArgumentException( "Unknown CherryPickControl value: {0}".UseAsFormat(control), nameof(control)); } var block = Monitor.BlockNotifications( RepositoryNotifications.BranchChanged, RepositoryNotifications.WorktreeUpdated, RepositoryNotifications.IndexUpdated); try { await Accessor.CherryPick .InvokeAsync(new CherryPickParameters(control), progress, CancellationToken.None) .ConfigureAwait(continueOnCapturedContext: false); } catch { throw; } finally { block.Dispose(); if (Head.Pointer is Branch branch && !branch.IsRemote) { branch.Refresh(); }
private void InvokeCherryPickControl(CherryPickControl control) { var parent = _guiProvider.Environment.MainForm; GuiCommands.CherryPick(parent, Repository, control); }
/// <summary>Create <see cref="CherryPickParameters"/>.</summary> public CherryPickParameters(CherryPickControl control) { Control = control; }
public static GuiCommandStatus CherryPick(IWin32Window parent, Repository repository, CherryPickControl control) { Verify.Argument.IsNotNull(repository, nameof(repository)); try { ProgressForm.MonitorTaskAsModalWindow(parent, Resources.StrCherryPick, p => repository.CherryPickAsync(control, p)); return(GuiCommandStatus.Completed); } catch (OperationCanceledException) { return(GuiCommandStatus.Canceled); } catch (GitException exc) { GitterApplication.MessageBoxService.Show( parent, exc.Message, Resources.ErrFailedToCherryPick, MessageBoxButton.Close, MessageBoxIcon.Error); return(GuiCommandStatus.Faulted); } }
public Command GetCherryPickCommand(CherryPickControl control) { switch(control) { case CherryPickControl.Continue: return new CherryPickCommand(CherryPickCommand.Continue()); case CherryPickControl.Quit: return new CherryPickCommand(CherryPickCommand.Quit()); case CherryPickControl.Abort: return new CherryPickCommand(CherryPickCommand.Abort()); default: throw new ArgumentException("Unknown enum value.", "control"); } }
public Task CherryPickAsync(CherryPickControl control, IProgress<OperationProgress> progress) { Verify.State.IsFalse(IsDisposed, "Repository is disposed."); switch(control) { case CherryPickControl.Abort: if(progress != null) { progress.Report(new OperationProgress(Resources.StrsAbortingCherryPick.AddEllipsis())); } break; case CherryPickControl.Continue: if(progress != null) { progress.Report(new OperationProgress(Resources.StrsContinuingCherryPick.AddEllipsis())); } break; case CherryPickControl.Quit: if(progress != null) { progress.Report(new OperationProgress(Resources.StrsQuitingCherryPick.AddEllipsis())); } break; default: throw new ArgumentException( "Unknown CherryPickControl value: {0}".UseAsFormat(control), "control"); } var block = Monitor.BlockNotifications( RepositoryNotifications.BranchChanged, RepositoryNotifications.WorktreeUpdated, RepositoryNotifications.IndexUpdated); return Accessor.CherryPick.InvokeAsync(new CherryPickParameters(control), progress, CancellationToken.None) .ContinueWith( t => { block.Dispose(); _head.Refresh(); _status.Refresh(); OnStateChanged(); OnUpdated(); TaskUtility.PropagateFaultedStates(t); }); }