ShowDialogOnError() public méthode

public ShowDialogOnError ( ) : void
Résultat void
Exemple #1
0
        private void stageFile(string filename)
        {
            var processStart = new FormStatus.ProcessStart
                               (
                delegate(FormStatus form)
            {
                form.AddOutput(string.Format(stageFilename.Text, filename));
                string output = Settings.Module.RunCmd
                                (
                    Settings.GitCommand, "add -- \"" + filename + "\""
                                );
                form.AddOutput(output);
                form.Done(string.IsNullOrEmpty(output));
            }
                               );
            var process = new FormStatus(processStart, null)
            {
                Text = string.Format(stageFilename.Text, filename)
            };

            process.ShowDialogOnError(this);
        }
 private void stageFile(string filename)
 {
     var processStart = new FormStatus.ProcessStart
         (
             delegate(FormStatus form)
             {
                 form.AddOutput(string.Format(stageFilename.Text, filename));
                 string output = Settings.Module.RunCmd
                     (
                     Settings.GitCommand, "add -- \"" + filename + "\""
                     );
                 form.AddOutput(output);
                 form.Done(string.IsNullOrEmpty(output));
             }
         );
     var process = new FormStatus(processStart, null) { Text = string.Format(stageFilename.Text, filename) };
     process.ShowDialogOnError(this);
 }
        private void Stage(ICollection<GitItemStatus> gitItemStatusses)
        {
            EnableStageButtons(false);
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                toolStripProgressBar1.Visible = true;
                toolStripProgressBar1.Maximum = gitItemStatusses.Count * 2;
                toolStripProgressBar1.Value = 0;

                var files = new List<GitItemStatus>();

                foreach (var gitItemStatus in gitItemStatusses)
                {
                    toolStripProgressBar1.Value = Math.Min(toolStripProgressBar1.Maximum - 1, toolStripProgressBar1.Value + 1);
                    files.Add(gitItemStatus);
                }

                if (Settings.ShowErrorsWhenStagingFiles)
                {
                    FormStatus.ProcessStart processStart =
                        form =>
                        {
                            form.AddOutput(string.Format(_stageFiles.Text,
                                                         files.Count));
                            var output = GitCommandHelpers.StageFiles(files);
                            form.AddOutput(output);
                            form.Done(string.IsNullOrEmpty(output));
                        };
                    var process = new FormStatus(processStart, null) { Text = _stageDetails.Text };
                    process.ShowDialogOnError();
                }
                else
                {
                    GitCommandHelpers.StageFiles(files);
                }

                InitializedStaged();
                var stagedFiles = (List<GitItemStatus>)Staged.GitItemStatuses;
                var unStagedFiles = (List<GitItemStatus>)Unstaged.GitItemStatuses;
                Unstaged.GitItemStatuses = null;

                unStagedFiles.RemoveAll(item => stagedFiles.Exists(i => i.Name == item.Name || i.OldName == item.Name) && files.Exists(i => i.Name == item.Name));

                Unstaged.GitItemStatuses = unStagedFiles;

                toolStripProgressBar1.Value = toolStripProgressBar1.Maximum;

                toolStripProgressBar1.Visible = false;
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
            EnableStageButtons(true);

            Commit.Enabled = true;
            Amend.Enabled = true;
            AcceptButton = Commit;
            Commit.Focus();
            Cursor.Current = Cursors.Default;

            if (Settings.RevisionGraphShowWorkingDirChanges)
                NeedRefresh = true;
        }
        private void Stage(IEnumerable<GitItemStatus> gitItemStatusses)
        {
            EnableStageButtons(false);
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                Unstaged.StoreNextIndexToSelect();
                toolStripProgressBar1.Visible = true;
                toolStripProgressBar1.Maximum = gitItemStatusses.Count() * 2;
                toolStripProgressBar1.Value = 0;

                var files = new List<GitItemStatus>();

                foreach (var gitItemStatus in gitItemStatusses)
                {
                    toolStripProgressBar1.Value = Math.Min(toolStripProgressBar1.Maximum - 1, toolStripProgressBar1.Value + 1);
                    files.Add(gitItemStatus);
                }

                bool wereErrors = false;
                if (Settings.ShowErrorsWhenStagingFiles)
                {
                    FormStatus.ProcessStart processStart =
                        form =>
                        {
                            form.AddMessageLine(string.Format(_stageFiles.Text,
                                                         files.Count));
                            var output = Module.StageFiles(files, out wereErrors);
                            form.AddMessageLine(output);
                            form.Done(string.IsNullOrEmpty(output));
                        };
                    using (var process = new FormStatus(processStart, null) { Text = _stageDetails.Text })
                        process.ShowDialogOnError(this);
                }
                else
                {
                    Module.StageFiles(files, out wereErrors);
                }
                if (wereErrors)
                    RescanChanges();
                else
                {
                    InitializedStaged();
                    var unStagedFiles = (List<GitItemStatus>)Unstaged.GitItemStatuses;
                    Unstaged.GitItemStatuses = null;

                    unStagedFiles.RemoveAll(item => files.Exists(i => i.Name == item.Name || i.OldName == item.Name) && files.Exists(i => i.Name == item.Name));

                    Unstaged.GitItemStatuses = unStagedFiles;
                    Unstaged.SelectStoredNextIndex();
                }

                toolStripProgressBar1.Value = toolStripProgressBar1.Maximum;

                toolStripProgressBar1.Visible = false;
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
            EnableStageButtons(true);

            Commit.Enabled = true;
            Amend.Enabled = true;
            AcceptButton = Commit;
            Cursor.Current = Cursors.Default;

            if (Settings.RevisionGraphShowWorkingDirChanges)
                NeedRefresh = true;
        }
Exemple #5
0
        private void Stage(IList<GitItemStatus> gitItemStatusses)
        {
            UnstageFiles.Enabled = false;
            AddFiles.Enabled = false;
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                //Loading.Visible = true;
                progressBar.Visible = true;
                progressBar.Maximum = gitItemStatusses.Count * 2;
                progressBar.Value = 0;

                List<GitItemStatus> files = new List<GitItemStatus>();

                foreach (GitItemStatus gitItemStatus in gitItemStatusses)
                {
                    progressBar.Value = Math.Min(progressBar.Maximum - 1, progressBar.Value + 1);
                    files.Add(gitItemStatus);
                }

                /*OutPut.Text = */
                FormStatus.ProcessStart processStart = new FormStatus.ProcessStart
                    (
                        delegate(FormStatus form)
                        {
                            form.AddOutput(string.Format(stageFiles.Text, files.Count));
                            string output = GitCommands.GitCommands.StageFiles(files);
                            form.AddOutput(output);
                            form.Done(string.IsNullOrEmpty(output));
                        }
                    );
                FormStatus process = new FormStatus(processStart, null);
                process.Text = stageDetails.Text;
                process.ShowDialogOnError();

                InitializedStaged();
                List<GitItemStatus> stagedFiles = (List<GitItemStatus>)Staged.GitItemStatusses;
                List<GitItemStatus> unStagedFiles = (List<GitItemStatus>)Unstaged.GitItemStatusses;
                Unstaged.GitItemStatusses = null;

                unStagedFiles.RemoveAll(item => stagedFiles.Exists(i => i.Name == item.Name));

                Unstaged.GitItemStatusses = unStagedFiles;

                progressBar.Value = progressBar.Maximum;

                //Initialize();
                progressBar.Visible = false;
            }
            catch
            {
            }
            UnstageFiles.Enabled = true;
            AddFiles.Enabled = true;

            Commit.Enabled = true;
            Amend.Enabled = true;
            AcceptButton = Commit;
            Commit.Focus();
        }
        private void Stage(ICollection <GitItemStatus> gitItemStatusses)
        {
            EnableStageButtons(false);
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                toolStripProgressBar1.Visible = true;
                toolStripProgressBar1.Maximum = gitItemStatusses.Count * 2;
                toolStripProgressBar1.Value   = 0;

                var files = new List <GitItemStatus>();

                foreach (var gitItemStatus in gitItemStatusses)
                {
                    toolStripProgressBar1.Value = Math.Min(toolStripProgressBar1.Maximum - 1, toolStripProgressBar1.Value + 1);
                    files.Add(gitItemStatus);
                }

                if (Settings.ShowErrorsWhenStagingFiles)
                {
                    FormStatus.ProcessStart processStart =
                        form =>
                    {
                        form.AddOutput(string.Format(_stageFiles.Text,
                                                     files.Count));
                        var output = GitCommandHelpers.StageFiles(files);
                        form.AddOutput(output);
                        form.Done(string.IsNullOrEmpty(output));
                    };
                    var process = new FormStatus(processStart, null)
                    {
                        Text = _stageDetails.Text
                    };
                    process.ShowDialogOnError();
                }
                else
                {
                    GitCommandHelpers.StageFiles(files);
                }

                InitializedStaged();
                var stagedFiles   = (List <GitItemStatus>)Staged.GitItemStatuses;
                var unStagedFiles = (List <GitItemStatus>)Unstaged.GitItemStatuses;
                Unstaged.GitItemStatuses = null;

                unStagedFiles.RemoveAll(item => stagedFiles.Exists(i => i.Name == item.Name || i.OldName == item.Name) && files.Exists(i => i.Name == item.Name));

                Unstaged.GitItemStatuses = unStagedFiles;

                toolStripProgressBar1.Value = toolStripProgressBar1.Maximum;

                toolStripProgressBar1.Visible = false;
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
            EnableStageButtons(true);

            Commit.Enabled = true;
            Amend.Enabled  = true;
            AcceptButton   = Commit;
            Cursor.Current = Cursors.Default;

            if (Settings.RevisionGraphShowWorkingDirChanges)
            {
                NeedRefresh = true;
            }
        }
Exemple #7
0
        private void Stage(ICollection<GitItemStatus> gitItemStatusses)
        {
            UnstageFiles.Enabled = false;
            AddFiles.Enabled = false;
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                progressBar.Visible = true;
                progressBar.Maximum = gitItemStatusses.Count*2;
                progressBar.Value = 0;

                var files = new List<GitItemStatus>();

                foreach (var gitItemStatus in gitItemStatusses)
                {
                    progressBar.Value = Math.Min(progressBar.Maximum - 1, progressBar.Value + 1);
                    files.Add(gitItemStatus);
                }

                FormStatus.ProcessStart processStart =
                    form =>
                        {
                            form.AddOutput(string.Format(_stageFiles.Text,
                                                         files.Count));
                            var output = GitCommands.GitCommands.StageFiles(files);
                            form.AddOutput(output);
                            form.Done(string.IsNullOrEmpty(output));
                        };
                var process = new FormStatus(processStart, null) {Text = _stageDetails.Text};
                process.ShowDialogOnError();

                InitializedStaged();
                var stagedFiles = (List<GitItemStatus>) Staged.GitItemStatusses;
                var unStagedFiles = (List<GitItemStatus>) Unstaged.GitItemStatusses;
                Unstaged.GitItemStatusses = null;

                unStagedFiles.RemoveAll(item => stagedFiles.Exists(i => i.Name == item.Name) && files.Exists(i => i.Name == item.Name));

                Unstaged.GitItemStatusses = unStagedFiles;

                progressBar.Value = progressBar.Maximum;

                progressBar.Visible = false;
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
            UnstageFiles.Enabled = true;
            AddFiles.Enabled = true;

            Commit.Enabled = true;
            Amend.Enabled = true;
            AcceptButton = Commit;
            Commit.Focus();
        }