コード例 #1
0
        private void Initialize()
        {
            Cursor.Current = Cursors.WaitCursor;

            ConflictedFiles.MultiSelect = false;
            int oldSelectedRow = 0;

            if (ConflictedFiles.SelectedRows.Count > 0)
            {
                oldSelectedRow = ConflictedFiles.SelectedRows[0].Index;
            }
            ConflictedFiles.DataSource = Module.GetConflicts();
            ConflictedFiles.Columns[0].DataPropertyName = "Filename";
            if (ConflictedFiles.Rows.Count > oldSelectedRow)
            {
                ConflictedFiles.Rows[oldSelectedRow].Selected = true;

                if (oldSelectedRow < ConflictedFiles.FirstDisplayedScrollingRowIndex ||
                    oldSelectedRow > (ConflictedFiles.FirstDisplayedScrollingRowIndex + ConflictedFiles.DisplayedRowCount(false)))
                {
                    ConflictedFiles.FirstDisplayedScrollingRowIndex = oldSelectedRow;
                }
            }

            InitMergetool();

            ConflictedFilesContextMenu.Text = _conflictedFilesContextMenuText.Text;
            OpenMergetool.Text    = _openMergeToolItemText.Text + " " + _mergetool;
            openMergeToolBtn.Text = _button1Text.Text + " " + _mergetool;

            if (Module.InTheMiddleOfRebase())
            {
                Reset.Text = _resetItemRebaseText.Text;
                ContextChooseLocal.Text  = _contextChooseLocalRebaseText.Text;
                ContextChooseRemote.Text = _contextChooseRemoteRebaseText.Text;
            }
            else
            {
                Reset.Text = _resetItemMergeText.Text;
                ContextChooseLocal.Text  = _contextChooseLocalMergeText.Text;
                ContextChooseRemote.Text = _contextChooseRemoteMergeText.Text;
            }

            if (!Module.InTheMiddleOfConflictedMerge() && _thereWhereMergeConflicts)
            {
                UICommands.UpdateSubmodules(this);

                if (!Module.InTheMiddleOfPatch() && !Module.InTheMiddleOfRebase() && _offerCommit)
                {
                    if (MessageBox.Show(this, allConflictsResolved.Text, allConflictsResolvedCaption.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        UICommands.StartCommitDialog(this);
                    }
                }

                Close();
            }

            Cursor.Current = Cursors.Default;
        }
コード例 #2
0
        private void MergetoolClick(object sender, EventArgs e)
        {
            Module.RunExternalCmdShowConsole(AppSettings.GitCommand, "mergetool");

            if (MessageBox.Show(this, _allMergeConflictSolvedQuestion.Text, _allMergeConflictSolvedQuestionCaption.Text,
                                MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }
            UICommands.StartCommitDialog(this);
        }
コード例 #3
0
        private void MergetoolClick(object sender, EventArgs e)
        {
            Module.RunMergeTool();

            if (MessageBox.Show(this, _allMergeConflictSolvedQuestion.Text, _allMergeConflictSolvedQuestionCaption.Text,
                                MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }

            UICommands.StartCommitDialog(this);
        }
コード例 #4
0
        public EmptyRepoControl(bool isBareRepository)
        {
            InitializeComponent();
            InitializeComplete();

            lblEmptyRepository.Text = _repoHasNoCommits.Text;

            if (isBareRepository)
            {
                btnEditGitIgnore.Visible  = false;
                btnOpenCommitForm.Visible = false;
            }
            else
            {
                btnEditGitIgnore.Click  += (_, e) => UICommands.StartEditGitIgnoreDialog(this, localExcludes: false);
                btnOpenCommitForm.Click += (_, e) => UICommands.StartCommitDialog(this);
            }

            Dock = DockStyle.Fill;
        }
コード例 #5
0
 private void CommitButtonClick(object sender, EventArgs e)
 {
     UICommands.StartCommitDialog(this);
     EnableButtons();
 }
コード例 #6
0
        private void Initialize()
        {
            Cursor.Current = Cursors.WaitCursor;

            int oldSelectedRow = 0;

            if (ConflictedFiles.SelectedRows.Count > 0)
            {
                oldSelectedRow = ConflictedFiles.SelectedRows[0].Index;
            }

            ConflictedFiles.DataSource = Module.GetConflicts();
            ConflictedFiles.Columns[0].DataPropertyName = "Filename";
            if (ConflictedFiles.Rows.Count > oldSelectedRow)
            {
                ConflictedFiles.Rows[oldSelectedRow].Selected = true;

                if (oldSelectedRow < ConflictedFiles.FirstDisplayedScrollingRowIndex ||
                    oldSelectedRow > (ConflictedFiles.FirstDisplayedScrollingRowIndex + ConflictedFiles.DisplayedRowCount(false)))
                {
                    try
                    {
                        ConflictedFiles.FirstDisplayedScrollingRowIndex = oldSelectedRow;
                    }
                    catch (InvalidOperationException)
                    {
                        // ignore the exception - setting the row index is not so important to crash the app
                        // see the #2975 issues for details
                    }
                }
            }

            if (!InitMergetool())
            {
                Close();
                return;
            }

            ConflictedFilesContextMenu.Text = _conflictedFilesContextMenuText.Text;
            OpenMergetool.Text    = _openMergeToolItemText.Text + " " + _mergetool;
            openMergeToolBtn.Text = _button1Text.Text + " " + _mergetool;

            if (Module.InTheMiddleOfRebase())
            {
                Reset.Text = _resetItemRebaseText.Text;
                ContextChooseLocal.Text  = _contextChooseLocalRebaseText.Text;
                ContextChooseRemote.Text = _contextChooseRemoteRebaseText.Text;
            }
            else
            {
                Reset.Text = _resetItemMergeText.Text;
                ContextChooseLocal.Text  = _contextChooseLocalMergeText.Text;
                ContextChooseRemote.Text = _contextChooseRemoteMergeText.Text;
            }

            if (!Module.InTheMiddleOfConflictedMerge() && _thereWhereMergeConflicts)
            {
                UICommands.UpdateSubmodules(this);

                if (!Module.InTheMiddleOfPatch() && !Module.InTheMiddleOfRebase() && _offerCommit)
                {
                    if (AppSettings.DontConfirmCommitAfterConflictsResolved ||
                        MessageBox.Show(this, _allConflictsResolved.Text, _allConflictsResolvedCaption.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        UICommands.StartCommitDialog(this);
                    }
                }

                Close();
            }

            Cursor.Current = Cursors.Default;
        }