Files
SourceCode/PROMS/Volian.Controls.Library/CustomMessageBox.cs

59 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Volian.Controls.Library
{
public partial class CustomMessageBox : Form
{
//Custome Message Box Class to allow renaming of buttons
// originally devleoped for use with
// C2025-062 When Search clicked - Load the Incoming transitions for the Active Procedure
// in order to allow the user to decide if they wanted to search on the selected step or the selected procedure
public CustomMessageBox(string message, string title, string button1Text = "OK", string button2Text = "")
{
InitializeComponent();
this.Text = title;
lblMessage.Text = message;
btn1.Text = button1Text;
if (!string.IsNullOrEmpty(button2Text))
{
btn2.Text = button2Text;
btn2.Visible = true;
}
else
{
btn2.Visible = false;
}
}
private void Btn1_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Yes;
Close();
}
private void Btn2_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.No;
Close();
}
//static method for calling custommessagebox directly
public static DialogResult Show(string message, string title, string button1Text = "OK", string button2Text = "")
{
using (var messageBox = new CustomMessageBox(message, title, button1Text, button2Text))
{
return messageBox.ShowDialog();
}
}
}
}