-
Notifications
You must be signed in to change notification settings - Fork 0
/
MenuEvents.cs
212 lines (159 loc) · 6.04 KB
/
MenuEvents.cs
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
// Copyright Eric Chauvin 2018 - 2019.
using System;
// using System.Collections.Generic;
using System.Text;
// using System.Threading.Tasks;
// using System.IO;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace ClimateModel
{
public class MenuEvents
{
private MainForm MForm;
internal MenuStrip menuStrip1;
private ToolStripMenuItem fileToolStripMenuItem;
private ToolStripMenuItem exitToolStripMenuItem;
private ToolStripMenuItem showToolStripMenuItem;
private ToolStripMenuItem earthSceneToolStripMenuItem;
private ToolStripMenuItem testToolStripMenuItem;
private ToolStripMenuItem testToolStripMenuItem1;
private MenuEvents()
{
}
internal MenuEvents( MainForm UseForm )
{
MForm = UseForm;
}
internal void FreeEverything()
{
menuStrip1.Dispose();
fileToolStripMenuItem.Dispose();
exitToolStripMenuItem.Dispose();
showToolStripMenuItem.Dispose();
earthSceneToolStripMenuItem.Dispose();
testToolStripMenuItem.Dispose();
testToolStripMenuItem1.Dispose();
}
internal void InitializeGuiComponents()
{
try
{
menuStrip1 = new System.Windows.Forms.MenuStrip();
fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
showToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
earthSceneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
testToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
testToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
menuStrip1.SuspendLayout();
menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
fileToolStripMenuItem,
showToolStripMenuItem,
testToolStripMenuItem });
// helpToolStripMenuItem
menuStrip1.Location = new System.Drawing.Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new System.Drawing.Size(632, 28);
menuStrip1.TabIndex = 0;
menuStrip1.Text = "menuStrip1";
fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
// OpenPageToolStripMenuItem,
exitToolStripMenuItem});
fileToolStripMenuItem.Name = "fileToolStripMenuItem";
fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24);
fileToolStripMenuItem.Text = "&File";
exitToolStripMenuItem.Name = "exitToolStripMenuItem";
exitToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
exitToolStripMenuItem.Text = "E&xit";
exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
showToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
earthSceneToolStripMenuItem});
showToolStripMenuItem.Name = "showToolStripMenuItem";
showToolStripMenuItem.Size = new System.Drawing.Size(57, 24);
showToolStripMenuItem.Text = "&Show";
earthSceneToolStripMenuItem.Name = "earthSceneToolStripMenuItem";
earthSceneToolStripMenuItem.Size = new System.Drawing.Size(161, 26);
earthSceneToolStripMenuItem.Text = "&Earth Scene";
earthSceneToolStripMenuItem.Click += new System.EventHandler(this.earthSceneToolStripMenuItem_Click);
testToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
testToolStripMenuItem1});
testToolStripMenuItem.Name = "testToolStripMenuItem";
testToolStripMenuItem.Size = new System.Drawing.Size(47, 24);
testToolStripMenuItem.Text = "&Test";
testToolStripMenuItem1.Name = "testToolStripMenuItem1";
testToolStripMenuItem1.Size = new System.Drawing.Size(181, 26);
testToolStripMenuItem1.Text = "&Test";
testToolStripMenuItem1.Click += new System.EventHandler(this.testToolStripMenuItem1_Click);
menuStrip1.Font = new System.Drawing.Font("Segoe UI", 28F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
}
catch( Exception Except )
{
string ShowS = "Exception in MenuEvents.InitializeGuiComponents(): " + Except.Message;
MessageBox.Show( ShowS, MainForm.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop );
}
}
internal void ResumeLayout()
{
try
{
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
}
catch( Exception Except )
{
string ShowS = "Exception in MenuEvents.ResumeLayout(): " + Except.Message;
MessageBox.Show( ShowS, MainForm.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop );
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
MForm.Close();
}
private void earthSceneToolStripMenuItem_Click(object sender, EventArgs e)
{
MForm.ShowEarthScene();
}
/*
private void OpenPageToolStripMenuItem_Click( object sender, EventArgs e )
{
MForm.ShowStatus( "Testing Page." );
//////
Where do I want to call a function at?
I mean I don't want a lot of unrelated code
in here.
///////
string FileName = "C:\\Eric\\BrowserEC\\bin\\Release\\TestDownload.txt";
LexicalAnalysis1 Lex1 = new LexicalAnalysis1( MForm );
Lex1.ProcessSyntax( FileName );
/////
Page TestPage = new Page( MForm );
TestPage.MakeNewFromFile( "Test Title",
"https://www.google.com",
"C:\\Eric\\BrowserEC\\bin\\Release\\TestDownload.txt" );
///////
}
*/
private void testToolStripMenuItem1_Click(object sender, EventArgs e)
{
MessageBox.Show( "Check this.", MainForm.MessageBoxTitle, MessageBoxButtons.OK );
/*
try
{
ShowStatus( "Testing: QuaternionEC.TestMultiply()." );
QuaternionEC.TestBasics();
ShowStatus( "Test OK." );
}
catch( Exception Except )
{
ShowStatus( "Exception in the test: " + Except.Message );
MessageBox.Show( "Exception in the test: " + Except.Message, MessageBoxTitle, MessageBoxButtons.OK );
return;
}
*/
}
}
}