aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs
blob: f261ace12a311f489c1dcb014093161ca47a42ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Media;
using System.IO;

namespace ShiftOS.Engine.WindowManager
{
    public partial class InfoboxTemplate : UserControl
    {
        Stream str;
        public int buttonChoice;
        public int buttonSelected;
        public InfoboxTemplate(buttonType type)
        {
            InitializeComponent();
            switch (type)
            {
                case buttonType.OK:
                    btnOpt1.Text = "OK";
                    btnOpt2.Hide();
                    btnOpt1.Location = new Point(122, 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;
            }
        }
        public enum buttonType
        {
            YesNo,
            OKCancel,
            OK
        }

        private void btnOpt1_Click(object sender, EventArgs e)
        {
            switch (btnOpt1.Text)
            {
                case "OK":
                    buttonSelected = 1;
                    ParentForm.Close();
                    break;
                case "Yes":
                    buttonSelected = 2;
                    ParentForm.Close();
                    break;
            }
        }

        private void btnOpt2_Click(object sender, EventArgs e)
        {
            switch (btnOpt2.Text)
            {
                case "No":
                    buttonSelected = 3;
                    break;
                case "Cancel":
                    buttonSelected = 4;
                    break;
            }
        }
        public void Play()
        {
            str = Properties.Resources.infobox;
            SoundPlayer sp = new SoundPlayer(str);
            sp.Play();
            sp.Stream.Position = 0;
        }

        private void InfoboxTemplate_Load(object sender, EventArgs e)
        {
            Play();
        }
    }
}