aboutsummaryrefslogtreecommitdiff
path: root/Histacom2/GlobalPrograms/WinClassicInstaller.cs
blob: 3d16381756b0100e23194457e8ce3c26de8067d7 (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
using System;
using System.Windows.Forms;

namespace Histacom2.GlobalPrograms
{
    public partial class WinClassicInstaller : UserControl
    {
        public string progName;
        public int state = 0;

        public event EventHandler InstallCompleted;

        protected void OnInstallCompleted(EventArgs e)
        {
            if (InstallCompleted != null) InstallCompleted(this, e);
        }

        public WinClassicInstaller(string prog)
        {
            InitializeComponent();
            progName = prog;
        }

        private void WinClassicInstaller_Load(object sender, EventArgs e)
        {
            var welkom = new InstallerPanes.WelcomePane();
            welkom.Parent = panel1;
        }

        private void classicButton2_Click(object sender, EventArgs e)
        {
            classicButton3.Show();

            panel1.Controls.Clear();

            if (state == 0)
            {
                var eula = new InstallerPanes.EULAPane();
                eula.Parent = panel1;
                state = 1;
                classicButton2.Enabled = false;
            }
            else if (state == 1)
            {
                var dir = new InstallerPanes.DirectoryPane();
                dir.Parent = panel1;
                state = 2;
            }
            else if (state == 2)
            {
                classicButton3.Hide();
                classicButton1.Enabled = false;
                classicButton2.Enabled = false;
                var p = new InstallerPanes.ProgressPane();
                p.Parent = panel1;
                state = 3;
            }
            else if (state == 3)
            {
                OnInstallCompleted(EventArgs.Empty);
                var c = new InstallerPanes.CompletePane();
                c.Parent = panel1;
                classicButton3.Enabled = false;
                classicButton2.Enabled = true;
                classicButton2.Text = "Finish";
                classicButton2.Invalidate();
                state = 4;
            }
            else ParentForm.Close();
        }
    }
}