Files
wj32 7bd28e4357 moved branches, tags, trunk to 1.x branch
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@2304 21ef857c-d57f-4fe0-8362-d861dc6d29cd
2009-10-25 02:22:46 +00:00

85 lines
2.2 KiB
C#

using System.Windows.Forms;
namespace ProcessHacker
{
public delegate bool DialogButtonClickedDelegate();
public partial class MessageBoxWindow : Form
{
public event DialogButtonClickedDelegate OkButtonClicked;
public MessageBoxWindow()
{
InitializeComponent();
this.AddEscapeToClose();
this.SetTopMost();
comboIcon.SelectedItem = "None";
}
public MessageBoxIcon MessageBoxIcon
{
get
{
switch (comboIcon.SelectedItem.ToString())
{
case "None":
return MessageBoxIcon.None;
case "Error":
return MessageBoxIcon.Error;
case "Information":
return MessageBoxIcon.Information;
case "Question":
return MessageBoxIcon.Question;
case "Warning":
return MessageBoxIcon.Warning;
default:
return MessageBoxIcon.None;
}
}
}
public string MessageBoxText
{
get { return textText.Text; }
set { textText.Text = value; }
}
public int MessageBoxTimeout
{
get
{
int timeout = 0;
int.TryParse(textTimeout.Text, out timeout);
return timeout;
}
}
public string MessageBoxTitle
{
get { return textTitle.Text; }
set { textTitle.Text = value; }
}
private void buttonOK_Click(object sender, System.EventArgs e)
{
if (OkButtonClicked != null)
{
if (OkButtonClicked())
{
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}
private void buttonCancel_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
}
}