MetroMDI.cs
13.5 KB
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using MetroFramework.Components;
using System.Windows.Forms;
using MetroFramework.Controls;
using Comm;
using MachineDll;
using Dal;
namespace App
{
using FrmAdjustQuotietyA = FrmAdjustQuotiety2;
public partial class MetroMDI : FrmBase
{
private readonly TheMachine theMachine;
private LoginManager _loginManager;
private float minWidth;
private float minHeight;
private bool flag = false;//用来标识界面是否已经加载完成
private Dictionary<Control, Rectangle> controlsSize = new Dictionary<Control, Rectangle>();
public MetroMDI(LoginManager loginManager)
{
theMachine = GetMachineFromMe.GetMachine;
InitializeComponent();
this.ControlBox = true;
_loginManager = loginManager;
_loginManager.IsExit = true;
this.SetLanguage(this);
//if ("admin".Equals(Fuction.m_UserName))
//{
this.Account.Visible = true;
//}
//else
//{
// this.Account.Visible = false;
//}
Init();
}
private void Init()
{
if (Fuction.m_Language == Const.LANGUAGE_ENGLISH)
{
this.label1.Text = getMsg("FrmMDItsmi_Dynamic") + " " + getMsg("FrmMDItabTest");
this.label4.Text = getMsg("FrmMDItsmi_Static") + " " + getMsg("FrmMDItabTest");
}
else
{
this.label1.Text = getMsg("FrmMDItsmi_Dynamic") + getMsg("FrmMDItabTest");
this.label4.Text = getMsg("FrmMDItsmi_Static") + getMsg("FrmMDItabTest");
}
this.label2.Text = getMsg("FrmProduct");
this.label3.Text = getMsg("FrmTestResult");
this.label5.Text = getMsg("frmLoginManageckb_AMMaintenance4");
//统计分析
this.label6.Text = getMsg("FrmStatisticAnalysis");
this.label7.Text = getMsg("frmLoginbtnSetting");
this.Text = getMsg("ContaminationExplorerTesting");
this.label8.Text = getMsg("frmLoginManageckb_AMAccountManage3");
}
private void MetroMDI_Resize(object sender, EventArgs e)
{
//if (( flag == true ) && (( this.WindowState == FormWindowState.Maximized ) || ( this.WindowState == FormWindowState.Normal )))
//{
// float scaleX;
// float scaleY;
// string[] pos = new string[4];
// float[] sizeInfo = new float[4];
// scaleX = (float)(this.Width / minWidth);
// scaleY = (float)(this.Height / minHeight);
// foreach (Control ctl in homePanel.Controls)
// {
// pos = ctl.Tag.ToString().Split(',');
// for(int i=0 ; i<pos.Length ; i++)
// {
// sizeInfo[i] = (float)(Convert.ToDouble(pos[i]));
// }
// ctl.Top = (int)(sizeInfo[0] * scaleX);
// ctl.Left = (int)(sizeInfo[1] * scaleY);
// ctl.Width = (int)(sizeInfo[2] * scaleY);
// ctl.Height = (int)(sizeInfo[3] * scaleX);
// }
//}
}
private void MetroMDI_Load(object sender, EventArgs e)
{
//minWidth = (float)this.Width;
//minHeight = (float)this.Height;
//foreach (Control ctl in homePanel.Controls)
//{
// ctl.Tag = ctl.Top + "," + ctl.Left + "," + ctl.Width + "," + ctl.Height ;
//}
//this.flag = true;
this.label1.Left = (this.DynamicTesting.Width - this.label1.Width) / 2;
this.label1.Top = (this.DynamicTesting.Height - this.label1.Height) / 2;
this.label2.Left = (this.Product.Width - this.label2.Width) / 2;
this.label2.Top = (this.Product.Height - this.label2.Height) / 2;
this.label3.Left = (this.TestResult.Width - this.label3.Width) / 2;
this.label3.Top = (this.TestResult.Height - this.label3.Height) / 2;
this.label4.Left = (this.StaticTesting.Width - this.label4.Width) / 2;
this.label4.Top = (this.StaticTesting.Height - this.label4.Height) / 2;
this.label5.Left = (this.adjusting.Width - this.label5.Width) / 2;
this.label5.Top = (this.adjusting.Height - this.label5.Height) / 2;
this.label6.Left = (this.StatisticAnalysis.Width - this.label6.Width) / 2;
this.label6.Top = (this.StatisticAnalysis.Height - this.label6.Height) / 2;
this.label7.Left = (this.setting.Width - this.label7.Width) / 2;
this.label7.Top = (this.setting.Height - this.label7.Height) / 2;
this.label8.Left = (this.Account.Width - this.label8.Width) / 2;
this.label8.Top = (this.Account.Height - this.label8.Height) / 2;
}
private void Setting_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
//打开校准参数
FrmAdjustQuotietyA frm = new FrmAdjustQuotietyA("",_loginManager);
//frm.Owner = this;
this.ShowInTaskbar = false;
frm.ShowInTaskbar = true;
//this.Hide();//菜单选择窗口隐藏
this.Close();
frm.Show();
}
private void DynamicTesting_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
//打开动态测试
MetroDynamicTesting frm = new MetroDynamicTesting(_loginManager);
//frm.Owner = this;
this.ShowInTaskbar = false;
frm.ShowInTaskbar = true;
//this.Hide();//菜单选择窗口隐藏
this.Close();
frm.Show();
}
private void Product_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
//打开产品
MetroProduct frm = new MetroProduct(Const.OPERATION_ADD, "",_loginManager);
//frm.Owner = this;
this.ShowInTaskbar = false;
frm.ShowInTaskbar = true;
//this.Hide();//菜单选择窗口隐藏
frm.WindowState = FormWindowState.Maximized;
this.Close();
frm.Show();
}
private void StaticTesting_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
this.Close();
//打开静态测试
MetroStaticTesting frm = new MetroStaticTesting(_loginManager);
this.ShowInTaskbar = false;
frm.ShowInTaskbar = true;
frm.Show();
frm.Activate();
//frm.Owner = this;
////this.Hide();//菜单选择窗口隐藏
//frm.Show();
}
private void TestResult_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
//打开测试结果
MetroTestResult frm = new MetroTestResult(_loginManager,"");
//frm.Owner = this;
if (frm.isOpen)
{
this.ShowInTaskbar = false;
frm.ShowInTaskbar = true;
//this.Hide();//菜单选择窗口隐藏
this.Close();
frm.Show();
}
}
private void StatisticAnalysis_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
//统计分析
MetroStatisticAnalysis frm = new MetroStatisticAnalysis(_loginManager);
//frm.Owner = this;
this.ShowInTaskbar = false;
frm.ShowInTaskbar = true;
//this.Hide();//菜单选择窗口隐藏
this.Close();
frm.Show();
}
private void MetroMDI_FormClosed(object sender, FormClosedEventArgs e)
{
//this.notifyIcon1.Visible = false;
if (_loginManager.IsExit)
{
Application.Exit();
}
}
private void MetroMDI_FormClosing(object sender, FormClosingEventArgs e)
{
//this.notifyIcon1.Visible = false;
}
//private void notifyIcon1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
//{
// this.Visible = true; this.WindowState = FormWindowState.Maximized;
// this.Activate(); this.notifyIcon1.Visible = false;
//}
//private void pictureBox1_Click(object sender, EventArgs e)
//{
//}
//private void pictureBox1_MouseHover(object sender, EventArgs e)
//{
// ToolTip tt = new ToolTip();
// tt.SetToolTip(this.pictureBox1, getMsg("systemSetting"));
//}
private void metroTile1_Click(object sender, EventArgs e)
{
//打开设置
this._loginManager.IsExit = false;
MetroSetting frm = new MetroSetting(_loginManager);
//this.ShowInTaskbar = true;
frm.ShowInTaskbar = true;
this.Close();
frm.Show();
}
private void label1_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
//打开动态测试
//FrmTestManage ftm = new FrmTestManage();
//ftm.MaximizeBox = true;
//ftm.Show();
MetroDynamicTesting frm = new MetroDynamicTesting(_loginManager);
//frm.Owner = this;
this.ShowInTaskbar = false;
frm.ShowInTaskbar = true;
//this.Hide();//菜单选择窗口隐藏
this.Close();
frm.Show();
}
private void label2_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
//打开产品
MetroProduct frm = new MetroProduct(Const.OPERATION_ADD, "", _loginManager);
//frm.Owner = this;
this.ShowInTaskbar = false;
frm.ShowInTaskbar = true;
//this.Hide();//菜单选择窗口隐藏
frm.WindowState = FormWindowState.Maximized;
this.Close();
frm.Show();
}
private void label3_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
//打开测试结果
MetroTestResult frm = new MetroTestResult(_loginManager,"");
if (frm.isOpen)
{
//frm.Owner = this;
this.ShowInTaskbar = false;
frm.ShowInTaskbar = true;
//this.Hide();//菜单选择窗口隐藏
this.Close();
frm.Show();
}
}
private void label4_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
this.Close();
//打开静态测试
MetroStaticTesting frm = new MetroStaticTesting(_loginManager);
this.ShowInTaskbar = false;
frm.ShowInTaskbar = true;
frm.Show();
frm.Activate();
}
private void label5_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
//打开校准参数
FrmAdjustQuotietyA frm = new FrmAdjustQuotietyA("", _loginManager);
//frm.Owner = this;
this.ShowInTaskbar = false;
frm.ShowInTaskbar = true;
//this.Hide();//菜单选择窗口隐藏
this.Close();
frm.Show();
}
private void label6_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
//统计分析
MetroStatisticAnalysis frm = new MetroStatisticAnalysis(_loginManager);
//frm.Owner = this;
this.ShowInTaskbar = false;
frm.ShowInTaskbar = true;
//this.Hide();//菜单选择窗口隐藏
this.Close();
frm.Show();
}
private void label7_Click(object sender, EventArgs e)
{
//打开设置
this._loginManager.IsExit = false;
MetroSetting frm = new MetroSetting(_loginManager);
//this.ShowInTaskbar = true;
frm.ShowInTaskbar = true;
this.Close();
frm.Show();
}
//点击账号管理
private void label8_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
MetroAccount ma = new MetroAccount(_loginManager);
ma.ShowInTaskbar = true;
ma.WindowState = FormWindowState.Maximized;
this.Close();
ma.Show();
}
//点击账号管理
private void Account_Click(object sender, EventArgs e)
{
this._loginManager.IsExit = false;
MetroAccount ma = new MetroAccount(_loginManager);
ma.ShowInTaskbar = true;
ma.WindowState = FormWindowState.Maximized;
this.Close();
ma.Show();
}
private void DynamicTesting_Paint(object sender, PaintEventArgs e)
{
}
private void StaticTesting_Paint(object sender, PaintEventArgs e)
{
}
}
}