aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Main/OS/Win95/Win95Apps/TempIE4.cs
blob: d41add18fac65f4a56f74debe97f4731ccd9ea7f (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
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 TimeHACK.OS.Win95.Win95Apps.IE4Sites;

namespace TimeHACK.OS.Win95.Win95Apps
{
    public partial class TempIE4 : UserControl
    {
        public static Panel browsingArea = new Panel();
        public static ComboBox addressbar = new ComboBox();

        public TempIE4()
        {
            InitializeComponent();
            browsingArea = _browsingArea;
            addressbar = _addressbar;
        }

        public static async void GoToPage(string url)
        {
            UserControl uc = new UserControl();

            switch (url)
            {
                case "www.microsoft.com/windows/ie/default.htm":
                    uc = new IE4Start();
                    break;
                case "www.google.com":
                    uc = new GoogleHome();
                    break;
                case "www.google.stanford.edu":
                    uc = new GooglePrototype();
                    break;
                default:
                    uc = new IE4NoPage();
                    break;
            }

            addressbar.Text = url;
            uc.Dock = DockStyle.Fill;

            await Task.Delay(new Random().Next(500, 1500));

            browsingArea.Controls.Clear();
            browsingArea.Controls.Add(uc);
        }

        private void TempIE4_Load(object sender, EventArgs e)
        {
            GoToPage("www.microsoft.com/windows/ie/default.htm");
            GoButton.Paint += (s, args) => Engine.Paintbrush.PaintClassicBorders(s, args, 2);
        }

        private void GoButton_Click(object sender, EventArgs e)
        {
            GoToPage(addressbar.Text);
        }

        private void _addressbar_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                GoButton_Click(this, new EventArgs());
                e.SuppressKeyPress = true;
                browsingArea.Focus();
            }
        }
    }
}