2017-09-24 21:55:03 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.IO;
|
2017-11-05 23:47:46 +00:00
|
|
|
|
using System.Media;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using ShiftOS.Engine.Properties;
|
2017-09-24 21:55:03 +00:00
|
|
|
|
|
|
|
|
|
namespace ShiftOS.Engine.WindowManager
|
|
|
|
|
{
|
2017-11-05 23:47:46 +00:00
|
|
|
|
public partial class InfoboxTemplate : UserControl
|
|
|
|
|
{
|
|
|
|
|
public enum ButtonType
|
|
|
|
|
{
|
|
|
|
|
YesNo,
|
|
|
|
|
OkCancel,
|
|
|
|
|
Ok
|
|
|
|
|
}
|
2017-09-27 22:32:16 +00:00
|
|
|
|
|
2017-11-05 23:47:46 +00:00
|
|
|
|
public enum DialogResult
|
|
|
|
|
{
|
|
|
|
|
Yes,
|
|
|
|
|
No,
|
|
|
|
|
Cancel,
|
|
|
|
|
Ok
|
|
|
|
|
}
|
2017-09-24 21:55:03 +00:00
|
|
|
|
|
2017-11-05 23:47:46 +00:00
|
|
|
|
int _buttonChoice;
|
|
|
|
|
int _buttonSelected;
|
|
|
|
|
Stream _str;
|
2017-11-05 20:13:06 +00:00
|
|
|
|
|
2017-11-05 23:47:46 +00:00
|
|
|
|
public InfoboxTemplate(ButtonType type)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2017-11-19 16:21:34 +00:00
|
|
|
|
|
2017-11-05 23:47:46 +00:00
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case ButtonType.Ok:
|
|
|
|
|
btnOpt1.Text = "OK";
|
|
|
|
|
btnOpt2.Hide();
|
|
|
|
|
btnOpt1.Location = new Point(109, 134);
|
|
|
|
|
_buttonChoice = 1;
|
|
|
|
|
break;
|
|
|
|
|
case ButtonType.OkCancel:
|
|
|
|
|
btnOpt1.Text = "OK";
|
|
|
|
|
btnOpt2.Text = "Cancel";
|
|
|
|
|
_buttonChoice = 2;
|
|
|
|
|
break;
|
|
|
|
|
case ButtonType.YesNo:
|
|
|
|
|
btnOpt1.Text = "Yes";
|
|
|
|
|
btnOpt2.Text = "No";
|
|
|
|
|
_buttonChoice = 3;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-09-27 22:32:16 +00:00
|
|
|
|
|
2017-11-05 23:47:46 +00:00
|
|
|
|
void btnOpt1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
switch (btnOpt1.Text)
|
|
|
|
|
{
|
|
|
|
|
case "OK":
|
|
|
|
|
ParentForm?.Close();
|
|
|
|
|
break;
|
|
|
|
|
case "Yes":
|
|
|
|
|
_buttonSelected = 2;
|
|
|
|
|
ParentForm?.Close();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-09-24 21:55:03 +00:00
|
|
|
|
|
2017-11-05 23:47:46 +00:00
|
|
|
|
void btnOpt2_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
switch (btnOpt2.Text)
|
|
|
|
|
{
|
|
|
|
|
case "No":
|
|
|
|
|
_buttonSelected = 3;
|
|
|
|
|
break;
|
|
|
|
|
case "Cancel":
|
|
|
|
|
_buttonSelected = 4;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Play()
|
|
|
|
|
{
|
|
|
|
|
_str = Resources.infobox;
|
|
|
|
|
var sp = new SoundPlayer(_str);
|
|
|
|
|
sp.Play();
|
|
|
|
|
sp.Stream.Position = 0;
|
|
|
|
|
}
|
2017-09-25 22:49:40 +00:00
|
|
|
|
|
2017-11-05 23:47:46 +00:00
|
|
|
|
void InfoboxTemplate_Load(object sender, EventArgs e)
|
|
|
|
|
=> Play();
|
|
|
|
|
}
|
|
|
|
|
}
|