/// <summary> /// Show a message informing the user, with GUI or not. /// </summary> /// <param name="message">The message to show.</param> /// <param name="title">The title of the message.</param> /// <param name="customDialog">If true, use CustomDialog form.</param> /// <param name="button1">The first button text for CustomDialog form.</param> /// <param name="button2">The second button text for CustomDialog form.</param> /// <param name="button3">The third button text for CustomDialog form.</param> public static void Message(string message, string title = "Information", bool customDialog = false, string button1 = "OK", string button2 = "", string button3 = "") { if (Config.Configure.useGui) { if (customDialog) { CustomDialog.Show(message, title, button1, button2, button3); } else { MessageBox.Show(message, title); } } else { Console.WriteLine(title); } }
/// <summary> /// Shows a custom dialog with a new Title, Message, and up to three buttons with at least one button required. /// The custom dialog shows the button pressed in a buttonPressed public field. /// </summary> /// <param name="message">The message of the custom dialog.</param> /// <param name="title">The title of the custom dialog.</param> /// <param name="button1Text">Required. The text of the first button.</param> /// <param name="button2Text">Optional. The text of the second button.</param> /// <param name="button3Text">Optional. The text of the third button.</param> public static DialogResult Show(string message, string title, string button1Text, string button2Text = "", string button3Text = "") { CustomDialog customDialog = new CustomDialog(message, title, button1Text, button2Text, button3Text); DialogResult result = customDialog.ShowDialog(); return result; }
private void backgroundWorker3_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { //var dialogComplete = new CustomDialog(); DialogResult result = new DialogResult(); // Check to see if an error occurred in the // background process. if (e.Error != null) { MessageBox.Show(e.Error.Message); } else // Check to see if the background process was cancelled. if (e.Cancelled) { MessageBox.Show("Processing cancelled."); } else { // Everything completed normally. // process the response using e.Result Analyze processor = e.Result as Analyze; var dialogComplete = new CustomDialog("Merging complete!", "Confirm", "OK", "Convert", "View in Explorer"); result = dialogComplete.ShowDialog(); //result = CustomDialog.Show("Merging complete!\n\nBut!\n\nWait!\n\nThere's more to it than it seems apparently through your boggling eyes (Yes, that's a new English word).\n\nOkay.", "Confirm", "OK", "Convert", "View in Explorer"); if (result == DialogResult.OK) { if (dialogComplete.buttonPressed == "View in Explorer") processor.LaunchInExplorer(); else if (dialogComplete.buttonPressed == "Convert") { Analyze analyzeMerged = new Analyze(); var mergedAnalyze = new ProgressForm(Analyze.outputGroups.ToArray(), analyzeMerged); mergedAnalyze.ShowDialog(); analyzeMerged = mergedAnalyze.analyzeData; var mergedConvert = new ProgressForm(2, analyzeMerged); mergedConvert.ShowDialog(); } else this.Close(); } } this.Close(); }