FrmPara.cs
9.1 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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Comm;
using Dal;
namespace App
{
public partial class FrmPara : App.FrmBase
{
readonly bool isInit;
readonly Fuction fuction = new Fuction();
private string para_Height;
private string operation;//判断是静态测试还是动态测试
private string testingKind;
private Control parentControl;
private LoginManager _loginManager;
public FrmPara(string o, Control parentControl, LoginManager loginManager)
{
isInit = true;
InitializeComponent();
this._loginManager = loginManager;
this.SetLanguage(this);
this.operation = o;
this.parentControl = parentControl;
isInit = false;
Init();
this.lbl_TestSolvent.Text = getMsg("FrmParalbl_TestSolvent");
this.btn_OK1.Text = getMsg("FrmParabtn_OK1");
this.btn_Cancel1.Text = getMsg("FrmParabtn_Cancel1");
}
private void Init()
{
cmb_TestSolvent.Items.Clear();
cmb_TestSolvent.Items.Add(Const.TESTSOLVENT_50IPA);
cmb_TestSolvent.Items.Add(Const.TESTSOLVENT_75IPA);
cmb_TestSolvent.SelectedIndex = 1;
/**
* 该段代码是添加测试方式:静态测试和动态测试
*/
////cmb_TestMode.Items.Clear();
if("testModeItemDYNAMIC".Equals(this.operation))
{
switch (Fuction.m_Language)
{
case Const.LANGUAGE_ENGLISH:
testingKind = Const.TESTMETHOD_DYNAMIC_EN;
break;
case Const.LANGUAGE_JAPANESE:
testingKind = Const.TESTMETHOD_DYNAMIC_JP;
break;
case Const.LANGUAGE_CHINESE:
testingKind = Const.TESTMETHOD_DYNAMIC_CH;
break;
default:
break;
}
}
else if("testModeItemSTATIC".Equals(this.operation))
{
switch (Fuction.m_Language)
{
case Const.LANGUAGE_ENGLISH:
testingKind = Const.TESTMETHOD_STATIC_EN;
break;
case Const.LANGUAGE_JAPANESE:
testingKind = Const.TESTMETHOD_STATIC_JP;
break;
case Const.LANGUAGE_CHINESE:
testingKind = Const.TESTMETHOD_STATIC_CH;
break;
default:
break;
}
}
////cmb_TestMode.Items.Add(testModeItemDYNAMIC);
////cmb_TestMode.Items.Add(testModeItemSTATIC);
////cmb_TestMode.SelectedIndex = 1;
lbl_TempUnit.Text = Fuction.m_UserTempUnit;
//lbl_LengthUnit.Text = Fuction.m_UserLengthUnit;
para_Height = fuction.GetParameterByParaName(Const.PARA_Height, "currency");
SetHeightVisible(para_Height == "");
}
private void SetHeightVisible(bool visible)
{
//txt_Height.Visible = visible;
//lbl_Height.Visible = visible;
//lbl_LengthUnit.Visible = visible;
}
private void btn_OK1_Click(object sender, EventArgs e)
{
#region checkValid
if (ckb_IfHeat.Checked)
{
if (!CheckNull(this.lbl_HeatTemp.Text, txt_HeatTemp))
return;
try
{
if (Fuction.m_UserTempUnit==Const.TEMPUNIT_C &&
(Convert.ToDecimal(txt_HeatTemp.Text.Trim())<30 ||
Convert.ToDecimal(txt_HeatTemp.Text.Trim()) > 45) ||
Fuction.m_UserTempUnit == Const.TEMPUNIT_F &&
(Convert.ToDecimal(txt_HeatTemp.Text.Trim()) < 86 ||
Convert.ToDecimal(txt_HeatTemp.Text.Trim()) > 113))
{
ShowMessageBox.ShowError(
Const.MESSAGEBOX_TITLE_NOTE, "", Const.ERROR_HEAT_TEMPERATURE);
txt_HeatTemp.Focus();
return;
}
}
catch(Exception ex)
{
LOGGER.Info(ex.StackTrace);
ShowMessageBox.ShowError(
Const.MESSAGEBOX_TITLE_NOTE, "", Const.ERROR_HEAT_TEMPERATURE);
txt_HeatTemp.Focus();
return;
}
}
if (!CheckNull(lbl_TestSolvent.Text, cmb_TestSolvent))
return;
if (para_Height=="")
{
//if (!CheckNull(lbl_Height.Text, txt_Height) ||
//!CheckNumber(lbl_Height.Text, txt_Height))
// return;
//para_Height = fuction.ChangeLUnit(txt_Height.Text);
}
#endregion
string ifHeat = ckb_IfHeat.Checked ? Const.ISHEAT_HEAT : Const.ISHEAT_NOTHEAT;
string HeatTemp = ckb_IfHeat.Checked ?
(Fuction.m_UserTempUnit==Const.TEMPUNIT_C? txt_HeatTemp.Text.Trim() :fuction.ChangeTempUnit(txt_HeatTemp.Text.Trim())):
"";
if (fuction.CreateParaConfig("", Fuction.m_UserLogin, Const.PARA_HEATTEMP, HeatTemp) &&
fuction.CreateParaConfig("", Fuction.m_UserLogin, Const.PARA_ISHEAT, ifHeat) &&
fuction.CreateParaConfig("", Fuction.m_UserLogin, Const.PARA_Height, para_Height) &&
fuction.CreateParaConfig("", Fuction.m_UserLogin, Const.PARA_TESTSOLVENT, cmb_TestSolvent.Text) &&
fuction.CreateParaConfig("", Fuction.m_UserLogin, Const.PARA_TESTMODE, testingKind)
)
{
//////((FrmMDI)this.ParentForm).GetRightInfo(Const.TREE_TESTTEMP, HeatTemp + Fuction.m_UserTempUnit);
//////((FrmMDI)this.ParentForm).GetRightInfo(Const.TREE_TESTSOLVENT, cmb_TestSolvent.Text);
//////((FrmMDI)this.ParentForm).GetRightInfo(Const.TREE_TESTMODE, cmb_TestMode.Text);
//2009年后加功能:选择加热后,提示用户打开加热器加热,如果不选择之后的流程和之前没有变化
if (ckb_IfHeat.Checked)
{
ShowMessageBox.ShowInfo(Const.MESSAGEBOX_TITLE_NOTE, Const.OPEN_HEATER);
}
try
{
//FrmTestManage frmTestManage = new FrmTestManage(HeatTemp, ifHeat, cmb_TestSolvent.Text, testingKind, _loginManager);
//if (this.parentControl.TopLevelControl is MetroDynamicTesting)
//{
// MetroDynamicTesting parentForm = (MetroDynamicTesting)this.parentControl.TopLevelControl;
// parentForm.AddToDynamicPanel(frmTestManage);
//}
//else if (this.parentControl.TopLevelControl is MetroStaticTesting)
//{
// MetroStaticTesting parentForm = (MetroStaticTesting)this.parentControl.TopLevelControl;
// parentForm.AddToStaticPanel(frmTestManage);
//}
}
catch (Exception ex)
{
LOGGER.Error("btn_OK1_Click", ex);
}
//try
//{
// frmTestManage.Show();
// frmTestManage.StartPosition = FormStartPosition.CenterParent;
// frmTestManage.Activate();//激活
//}
//catch (Exception ex)
//{
// Console.WriteLine(ex.StackTrace);
//}
}
else
{
ShowMessageBox.ShowError(Const.MESSAGEBOX_TITLE_NOTE, "", Const.ERROR_OPERATION);
}
this.Close();
}
private void btn_Cancel1_Click(object sender, EventArgs e)
{
this.Close();
}
private void ckb_IfHeat_CheckedChanged(object sender, EventArgs e)
{
if (ckb_IfHeat.Checked)
{
lbl_HeatTemp.Visible = true;
txt_HeatTemp.Visible = true;
lbl_TempUnit.Visible = true;
}
else
{
lbl_HeatTemp.Visible = false;
txt_HeatTemp.Visible = false;
lbl_TempUnit.Visible = false;
}
}
private void FrmPara_Shown(object sender, EventArgs e)
{
this.StartPosition = FormStartPosition.CenterParent;
//ResizeForm();
}
private void FrmPara_LocationChanged(object sender, EventArgs e)
{
if (isInit)
{
this.Location = new Point(0, 0);
}
}
}
}