aboutsummaryrefslogtreecommitdiff
path: root/Histacom2.Engine/Template/Infobox95.cs
blob: 64081770f6db1cc45290753138c7601cc9fb7b7d (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
91
92
93
94
95
96
97
using System;
using System.Drawing;
using System.Media;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace Histacom2.Engine.Template
{
    public partial class Infobox95 : UserControl
    {
        int btnStatus = 0;

        public Infobox95(InfoboxType type, InfoboxButtons btns)
        {
            InitializeComponent();
            this.BackColor = SaveSystem.currentTheme.threeDObjectsColor;
            this.programContent.BackColor = SaveSystem.currentTheme.threeDObjectsColor;

            switch (type)
            {
                case InfoboxType.Info:
                    pictureBox1.Image = Properties.Resources.Win95Info;
                    SoundPlayer spa = new SoundPlayer(SaveSystem.currentTheme.asteriskSound);
                    spa.Play();
                    spa.Stream.Position = 0;

                    break;
                case InfoboxType.Question:
                    pictureBox1.Image = Properties.Resources.Win95Question;
                    SoundPlayer spq = new SoundPlayer(SaveSystem.currentTheme.questionSound);
                    spq.Play();
                    spq.Stream.Position = 0;
                    break;
                case InfoboxType.Warning:
                    pictureBox1.Image = Properties.Resources.Win95Warning;
                    SoundPlayer spw = new SoundPlayer(SaveSystem.currentTheme.exclamationSound);
                    spw.Play();
                    spw.Stream.Position = 0;
                    break;
                case InfoboxType.Error:
                    pictureBox1.Image = Properties.Resources.Win95Error;
                    SoundPlayer spe = new SoundPlayer(SaveSystem.currentTheme.critStopSound);
                    spe.Play();
                    spe.Stream.Position = 0;
                    break;
            }

            btnStatus = (int)btns;
            switch (btns)
            {
                case InfoboxButtons.OK:
                    button1.Text = "OK";
                    button2.Hide();
                    button3.Hide();
                    break;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.ParentForm.Close();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (btnStatus == 0) this.ParentForm.Close();
        }

        private void programContent_Paint(object sender, PaintEventArgs e)
        {
            this.BackColor = SaveSystem.currentTheme.threeDObjectsColor;
            this.programContent.BackColor = SaveSystem.currentTheme.threeDObjectsColor;
        }
    }

    public enum InfoboxType
    {
        Info,
        Question,
        Warning,
        Error
    }

    public enum InfoboxButtons
    {
        OK,
        OKCancel,
        YesNo,
        YesNoCancel,
        AbortRetryFail
    }
}