private void okButton_Click(object sender, EventArgs e)
        {
            if (ResetType == GitResetType.Hard)
            {
                VisualGitMessageBox mb = new VisualGitMessageBox(Context);

                var result = mb.Show(CommandStrings.YouAreAboutToDiscardAllChanges, CommandStrings.ResetCurrentBranch,
                    MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (result != DialogResult.Yes)
                    return;
            }

            DialogResult = DialogResult.OK;
        }
        private void removeButton_Click(object sender, EventArgs e)
        {
            VisualGitMessageBox mb = new VisualGitMessageBox(Context);

            if (DialogResult.OK != mb.Show(OptionsResources.TheSelectedCertificateWillBeRemoved, "", MessageBoxButtons.OKCancel))
                return;

            bool changed = false;
            try
            {
                foreach (CertificateListItem li in credentialList.SelectedItems)
                {
                    ConfigurationService.RemoveCertificate(
                        li.Certificate.Path
                    );

                    changed = true;
                }
            }
            finally
            {
                if (changed)
                    Refreshlist();
            }
        }
Beispiel #3
0
        private void okButton_Click(object sender, EventArgs e)
        {
            bool ok = true;

            if (String.IsNullOrEmpty(urlBox.Text))
            {
                errorProvider1.SetError(urlBox, CommandStrings.SelectAnUrl);
                ok = false;
            }
            else
                errorProvider1.SetError(urlBox, null);

            if (branchRadioBox.Checked && (branchBox.SelectedItem as GitRef) == null)
            {
                errorProvider1.SetError(branchBox, CommandStrings.SelectABranch);
                ok = false;
            }
            else
                errorProvider1.SetError(branchBox, null);

            if (tagRadioBox.Checked && (tagBox.SelectedItem as GitRef) == null)
            {
                errorProvider1.SetError(tagBox, CommandStrings.SelectATag);
                ok = false;
            }
            else
                errorProvider1.SetError(tagBox, null);

            if (String.IsNullOrEmpty(destinationBox.Text))
            {
                errorProvider1.SetError(destinationBox, CommandStrings.SelectADestination);
                ok = false;
            }
            else
                errorProvider1.SetError(destinationBox, null);

            if (ok)
            {
            if (!Directory.Exists(destinationBox.Text))
            {
                VisualGitMessageBox mb = new VisualGitMessageBox(Context);

                var result = mb.Show(CommandStrings.DestinationDoesNotExistCreate, CommandStrings.Clone, MessageBoxButtons.YesNo);

                if (result == System.Windows.Forms.DialogResult.Yes)
                    CreateRecursive(Path.GetFullPath(destinationBox.Text));
                else
                {
                    errorProvider1.SetError(destinationBox, CommandStrings.DestinationDoesNotExistCreate);
                    return;
                }
            }

            Config.GetRecentReposUrls().Add(urlBox.Text);

            DialogResult = DialogResult.OK;
                }
        }