/// <summary> /// Confirms the specified title. /// </summary> /// <param name="title">The title.</param> /// <param name="message">The message.</param> /// <param name="text">The text.</param> /// <returns></returns> public static bool Confirm(string title, string message, MessageBoxText text) { WrappedMessageBox msg = new WrappedMessageBox(); msg.Text = title; msg.Message = message; if (text == MessageBoxText.YesNo) { msg.button1.Text = "Yes"; msg.button2.Text = "No"; } else { msg.button1.Text = "OK"; msg.button2.Text = "Cancel"; } msg.button1.Click += delegate { msg.DialogResult = DialogResult.OK; }; msg.button2.Click += delegate { msg.DialogResult = DialogResult.Cancel; }; return(msg.ShowDialog() == DialogResult.OK); }
/// <summary> /// Shows the message. /// </summary> /// <param name="title">The title.</param> /// <param name="message">The message.</param> public static void ShowMessage(string title, string message) { WrappedMessageBox msg = new WrappedMessageBox(); msg.Text = title; msg.Message = message; msg.button1.Visible = false; msg.button2.Text = "OK"; msg.button2.Click += delegate { msg.DialogResult = DialogResult.OK; }; msg.ShowDialog(); }
/// <summary> /// Confirms the specified title. /// </summary> /// <param name="title">The title.</param> /// <param name="message">The message.</param> /// <param name="text">The text.</param> /// <returns></returns> public static bool Confirm(string title, string message, MessageBoxText text) { WrappedMessageBox msg = new WrappedMessageBox(); msg.Text = title; msg.Message = message; if (text == MessageBoxText.YesNo) { msg.button1.Text = "Yes"; msg.button2.Text = "No"; } else { msg.button1.Text = "OK"; msg.button2.Text = "Cancel"; } msg.button1.Click += delegate { msg.DialogResult = DialogResult.OK; }; msg.button2.Click += delegate { msg.DialogResult = DialogResult.Cancel; }; return msg.ShowDialog() == DialogResult.OK; }