mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
7bd28e4357
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@2304 21ef857c-d57f-4fe0-8362-d861dc6d29cd
85 lines
2.2 KiB
C#
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();
|
|
}
|
|
}
|
|
}
|