aboutsummaryrefslogtreecommitdiff
path: root/Histacom2/OS/Win95/Win95Apps/WinClassicIE3.cs
blob: 34828ccac0fc19f524ca035a50d3571991bcc4d0 (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
98
99
100
101
102
103
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 Histacom2.OS.Win95.Win95Apps.IE3Sites;

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

        public WinClassicIE3()
        {
            InitializeComponent();
            browsingArea = _browsingArea;
            addressbar = _addressbar;

            BackButton.MouseEnter += (s, e) => BackButton.BackgroundImage = Properties.Resources.IE3_BackHover;
            BackButton.MouseLeave += (s, e) => BackButton.BackgroundImage = Properties.Resources.IE3_Back;
            ForwardButton.MouseEnter += (s, e) => ForwardButton.BackgroundImage = Properties.Resources.IE3_ForwardHover;
            ForwardButton.MouseLeave += (s, e) => ForwardButton.BackgroundImage = Properties.Resources.IE3_Forward;
            StopButton.MouseEnter += (s, e) => StopButton.BackgroundImage = Properties.Resources.IE3_StopHover;
            StopButton.MouseLeave += (s, e) => StopButton.BackgroundImage = Properties.Resources.IE3_Stop;
            RefreshButton.MouseEnter += (s, e) => RefreshButton.BackgroundImage = Properties.Resources.IE3_RefreshHover;
            RefreshButton.MouseLeave += (s, e) => RefreshButton.BackgroundImage = Properties.Resources.IE3_Refresh;
        }

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

            switch (url)
            {
                case "www.microsoft.com/windows/ie/default.htm":
                    uc = new IE3Start();
                    break;
                case "www.google.com":
                    uc = new GoogleHome();
                    break;
                case "www.google.stanford.edu":
                    uc = new GooglePrototype();
                    break;
                case "www.12padams.com":
                    uc = new _12padams1998();
                    break;
                case "12padams.com":
                    uc = new _12padams1998();
                    newURL = "www.12padams.com";
                    break;
                case "google.com":
                    uc = new GoogleHome();
                    newURL = "www.google.com";
                    break;
                case "google.stanford.edu":
                    uc = new GooglePrototype();
                    newURL = "www.google.stanford.edu";
                    break;
                default:
                    uc = new IENoPage();
                    break;
            }

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

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

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

            if (url == "www.12padams.com") Story.Hack1.StartObjective();
        }

        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();
            }
        }
    }
}