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