protected Dispose ( bool disposing ) : void | ||
disposing | bool | true if managed resources should be disposed; otherwise, false. |
return | void |
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(); } }
/// <summary> /// Displays a fake progress dialog /// </summary> /// <param name="fakeDelay"></param> /// <param name="message"></param> /// <returns></returns> public static async Task ShowFakeProgressDialog(int fakeDelay, string message = "Please wait") { var progressControl = new FakeProgressDialogControl { Message = message }; var progressDialog = new CustomDialog(progressControl); progressDialog.ShowAsync(); await Task.Delay(fakeDelay); progressDialog.CloseDialog(null); // Fake delay progressDialog.Dispose(); }
int ShowAssertionDialog(string message, string detailMessage, string stackTrace) { message = message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace; string[] buttonTexts = { "Throw", "Debug", "Ignore", "Ignore All" }; CustomDialog inputBox = new CustomDialog("Assertion Failed", message.TakeStartEllipsis(750), -1, 2, buttonTexts); inputBox.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; try { inputBox.ShowDialog(); return(inputBox.Result); } finally { dialogIsOpen = false; inputBox.Dispose(); } }
private int ShowAssertionDialog(string message, string detailMessage, string stackTrace) { message = message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace; string[] buttonTexts = { "Throw", "Debug", "Ignore", "Ignore All" }; CustomDialog inputBox = new CustomDialog("Assertion Failed", message.TakeStartEllipsis(750), -1, 2, buttonTexts); inputBox.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; inputBox.ShowInTaskbar = true; // make this window more visible, because it effectively interrupts the decompilation process. try { inputBox.ShowDialog(); return(inputBox.Result); } finally { dialogIsOpen = false; inputBox.Dispose(); } }
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(); } }