void ShowAssertionDialog(string message, string detailMessage, string stackTrace, bool canDebug)
        {
            message = message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace;
            List <string> buttonTexts = new List <string> {
                "Show Stacktrace", "Debug", "Ignore", "Ignore All"
            };

            if (!canDebug)
            {
                buttonTexts.RemoveAt(1);
            }
            CustomDialog inputBox = new CustomDialog("Assertion Failed", message.TakeStartEllipsis(750), -1, 2, buttonTexts.ToArray());

            try {
                while (true)                   // show the dialog repeatedly until an option other than 'Show Stacktrace' is selected
                {
                    if (SD.MainThread.InvokeRequired)
                    {
                        inputBox.ShowDialog();
                    }
                    else
                    {
                        inputBox.ShowDialog(SD.WinForms.MainWin32Window);
                    }
                    int result = inputBox.Result;
                    if (!canDebug && result >= 1)
                    {
                        result++;
                    }
                    switch (result)
                    {
                    case 0:
                        ExceptionBox.ShowErrorBox(null, message);
                        break;                                 // show the custom dialog again

                    case 1:
                        Debugger.Break();
                        return;

                    case 2:
                        return;

                    case 3:
                        lock (ignoredStacks) {
                            ignoredStacks.Add(stackTrace);
                        }
                        return;
                    }
                }
            } finally {
                dialogIsOpen.Reset();
                inputBox.Dispose();
            }
        }
 public void ReparseReferences()
 {
     if (reparseReferencesStartedButNotYetRunning.Set())
     {
         SD.ParserService.LoadSolutionProjectsThread.AddJob(
             monitor => {
             reparseReferencesStartedButNotYetRunning.Reset();
             DoResolveReferences(monitor);
         },
             "Loading " + project.Name + "...", LoadingReferencesWorkAmount);
     }
 }
 public void ReparseCode()
 {
     if (reparseCodeStartedButNotYetRunning.Set())
     {
         var filesToParse = (
             from item in project.Items.OfType <FileProjectItem>()
             where IsParseableFile(item)
             select item.FileName
             ).ToList();
         SD.ParserService.LoadSolutionProjectsThread.AddJob(
             monitor => {
             reparseCodeStartedButNotYetRunning.Reset();
             DoReparseCode(filesToParse, monitor);
         },
             "Loading " + project.Name + "...", filesToParse.Count);
     }
 }
        void ShowAssertionDialog(string message, string detailMessage, string stackTrace, ref bool debug)
        {
            message = message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace;
            string[]     buttonTexts = { "Show Stacktrace", "Debug", "Ignore", "Ignore All" };
            CustomDialog inputBox    = new CustomDialog("Assertion Failed", message.TakeStartEllipsis(750), -1, 2, buttonTexts);

            try {
                while (true)                   // show the dialog repeatedly until an option other than 'Show Stacktrace' is selected
                {
                    inputBox.ShowDialog();
                    int result = inputBox.Result;
                    switch (result)
                    {
                    case 0:
                        ExceptionBox.ShowErrorBox(null, message);
                        break;                                 // show the custom dialog again

                    case 1:
                        debug = true;
                        return;

                    case 2:
                        return;

                    case 3:
                        lock (ignoredStacks) {
                            ignoredStacks.Add(stackTrace);
                        }
                        return;
                    }
                }
            } finally {
                dialogIsOpen.Reset();
                inputBox.Dispose();
            }
        }