Ejemplo n.º 1
0
        public StashedStateMenu(StashedState stashedState)
        {
            Verify.Argument.IsValidGitObject(stashedState, nameof(stashedState));

            StashedState = stashedState;

            Items.AddRange(
                new ToolStripItem[]
            {
                GuiItemFactory.GetViewDiffItem <ToolStripMenuItem>(StashedState.GetDiffSource()),
                GuiItemFactory.GetViewTreeItem <ToolStripMenuItem>(StashedState),
                GuiItemFactory.GetSavePatchItem <ToolStripMenuItem>(StashedState),
                new ToolStripSeparator(),
                GuiItemFactory.GetStashPopItem <ToolStripMenuItem>(StashedState),
                GuiItemFactory.GetStashApplyItem <ToolStripMenuItem>(StashedState),
                GuiItemFactory.GetStashDropItem <ToolStripMenuItem>(StashedState),
                new ToolStripSeparator(),
                GuiItemFactory.GetStashToBranchItem <ToolStripMenuItem>(StashedState),
                new ToolStripSeparator(),
                new ToolStripMenuItem(Resources.StrCopyToClipboard, null,
                                      new ToolStripItem[]
                {
                    GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrName, ((IRevisionPointer)StashedState).Pointer),
                    GuiItemFactory.GetCopyHashToClipboardItem <ToolStripMenuItem>(Resources.StrHash, StashedState.Revision.Hash.ToString()),
                    GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrSubject, StashedState.Revision.Subject),
                }),
            });
        }
Ejemplo n.º 2
0
        public StashedStateMenu(StashedState stashedState)
        {
            Verify.Argument.IsValidGitObject(stashedState, "stashedState");

            _stashedState = stashedState;

            Items.AddRange(
                new ToolStripItem[]
                {
                    GuiItemFactory.GetViewDiffItem<ToolStripMenuItem>(StashedState.GetDiffSource()),
                    GuiItemFactory.GetViewTreeItem<ToolStripMenuItem>(StashedState),
                    GuiItemFactory.GetSavePatchItem<ToolStripMenuItem>(StashedState),
                    new ToolStripSeparator(),
                    GuiItemFactory.GetStashPopItem<ToolStripMenuItem>(StashedState),
                    GuiItemFactory.GetStashApplyItem<ToolStripMenuItem>(StashedState),
                    GuiItemFactory.GetStashDropItem<ToolStripMenuItem>(StashedState),
                    new ToolStripSeparator(),
                    GuiItemFactory.GetStashToBranchItem<ToolStripMenuItem>(StashedState),
                    new ToolStripSeparator(),
                    new ToolStripMenuItem(Resources.StrCopyToClipboard, null,
                        new ToolStripItem[]
                        {
                            GuiItemFactory.GetCopyToClipboardItem<ToolStripMenuItem>(Resources.StrName, ((IRevisionPointer)StashedState).Pointer),
                            GuiItemFactory.GetCopyHashToClipboardItem<ToolStripMenuItem>(Resources.StrHash, StashedState.Revision.Hash.ToString()),
                            GuiItemFactory.GetCopyToClipboardItem<ToolStripMenuItem>(Resources.StrSubject, StashedState.Revision.Subject),
                        }),
                });
        }
Ejemplo n.º 3
0
        public StashToBranchDialog(StashedState stashedState)
        {
            Verify.Argument.IsNotNull(stashedState, nameof(stashedState));
            Verify.Argument.IsFalse(stashedState.IsDeleted, nameof(stashedState),
                                    Resources.ExcObjectIsDeleted.UseAsFormat(stashedState.GetType().Name));

            StashedState = stashedState;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                BranchName = new TextBoxInputSource(_txtBranchName),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            SetupReferenceNameInputBox(_txtBranchName, ReferenceType.LocalBranch);

            _txtStashName.Text = ((IRevisionPointer)StashedState).Pointer;

            GitterApplication.FontManager.InputFont.Apply(_txtBranchName, _txtStashName);

            _controller = new StashToBranchController(stashedState)
            {
                View = this
            };
        }
Ejemplo n.º 4
0
        public static GuiCommandStatus ApplyStashedState(IWin32Window parent, StashedState stashedState, bool restoreIndex)
        {
            Verify.Argument.IsNotNull(stashedState, nameof(stashedState));

            try
            {
                ProgressForm.MonitorTaskAsModalWindow(parent, Resources.StrStashApply,
                                                      p => stashedState.ApplyAsync(restoreIndex, p));
                return(GuiCommandStatus.Completed);
            }
            catch (OperationCanceledException)
            {
                return(GuiCommandStatus.Canceled);
            }
            catch (GitException exc)
            {
                GitterApplication.MessageBoxService.Show(
                    parent,
                    exc.Message,
                    string.Format(Resources.ErrFailedToStashApplyState, ((IRevisionPointer)stashedState).Pointer),
                    MessageBoxButton.Close,
                    MessageBoxIcon.Error);
                return(GuiCommandStatus.Faulted);
            }
        }
Ejemplo n.º 5
0
        public StashToBranchDialog(StashedState stashedState)
        {
            Verify.Argument.IsNotNull(stashedState, "stashedState");
            Verify.Argument.IsFalse(stashedState.IsDeleted, "stashedState",
                Resources.ExcObjectIsDeleted.UseAsFormat(stashedState.GetType().Name));

            _stashedState = stashedState;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                _branchNameInput = new TextBoxInputSource(_txtBranchName),
            };
            _errorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            SetupReferenceNameInputBox(_txtBranchName, ReferenceType.LocalBranch);

            _txtStashName.Text = ((IRevisionPointer)_stashedState).Pointer;

            GitterApplication.FontManager.InputFont.Apply(_txtBranchName, _txtStashName);

            _controller = new StashToBranchController(stashedState) { View = this };
        }
Ejemplo n.º 6
0
 public int MeasureStash(Graphics graphics, Font font, StringFormat format, StashedState stash)
 {
     return(MeasureInlineTag(graphics, font, format, GitConstants.StashName));
 }
Ejemplo n.º 7
0
        public int DrawStash(Graphics graphics, Font font, StringFormat format, int x, int y, int right, int h, bool hovered, StashedState stash)
        {
            int w = DrawInlineTag(graphics, font, hovered?StashBrushHovered:StashBrush, format, GitConstants.StashName, x, y, right, h);

            return(w);
        }
Ejemplo n.º 8
0
 public int MeasureStash(Graphics graphics, Font font, StringFormat format, StashedState stash)
 {
     return MeasureInlineTag(graphics, font, format, GitConstants.StashName);
 }
Ejemplo n.º 9
0
 public int DrawStash(Graphics graphics, Font font, StringFormat format, int x, int y, int right, int h, bool hovered, StashedState stash)
 {
     int w = DrawInlineTag(graphics, font, hovered?StashBrushHovered:StashBrush, format, GitConstants.StashName, x, y, right, h);
     return w;
 }
Ejemplo n.º 10
0
        public StashToBranchController(StashedState stashedState)
        {
            Verify.Argument.IsNotNull(stashedState, "stashedState");

            _stashedState = stashedState;
        }
Ejemplo n.º 11
0
        public StashToBranchController(StashedState stashedState)
        {
            Verify.Argument.IsNotNull(stashedState, nameof(stashedState));

            StashedState = stashedState;
        }