This commit is contained in:
@@ -14,6 +14,8 @@ namespace 全自动水压检测仪
|
||||
{
|
||||
public partial class ScanImport : UIForm
|
||||
{
|
||||
private NormalTemperatureMode _normalTemperatureMode;
|
||||
|
||||
private ConductivityRepository _repository;
|
||||
public ScanImport()
|
||||
{
|
||||
@@ -24,14 +26,14 @@ namespace 全自动水压检测仪
|
||||
|
||||
private void save_Click(object sender, EventArgs e)
|
||||
{
|
||||
double diffpressure = 0, exit_temperature = 0, dwelltime = 0, temperature = 0;
|
||||
double.TryParse(uiTextBox4.Text, out diffpressure);
|
||||
double.TryParse(uiTextBox9.Text, out exit_temperature);
|
||||
double.TryParse(uiTextBox5.Text, out dwelltime);
|
||||
double.TryParse(uiTextBox1.Text, out temperature);
|
||||
float diffpressure = 0,exit_temperature = 0, dwelltime = 0, temperature = 0;
|
||||
float.TryParse(uiTextBox4.Text, out diffpressure);
|
||||
float.TryParse(uiTextBox9.Text, out exit_temperature);
|
||||
float.TryParse(uiTextBox5.Text, out dwelltime);
|
||||
float.TryParse(uiTextBox1.Text, out temperature);
|
||||
_repository.InsertScanItems(new ScanData
|
||||
{
|
||||
barcode = uiTextBox4.Text,
|
||||
barcode = uiTextBox2.Text,
|
||||
diffpressure = diffpressure,
|
||||
exit_temperature = exit_temperature,
|
||||
dwelltime = dwelltime,
|
||||
@@ -54,5 +56,33 @@ namespace 全自动水压检测仪
|
||||
|
||||
uiDataGridView1.Refresh();
|
||||
}
|
||||
|
||||
private void SwitchWindow<T>(ref T windowInstance, Func<T> createFunc) where T : UIForm
|
||||
{
|
||||
if (windowInstance == null || windowInstance.IsDisposed)
|
||||
{
|
||||
windowInstance = createFunc();
|
||||
windowInstance.FormClosed += (s, e) =>
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
this.Show();
|
||||
this.Activate();
|
||||
}));
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
windowInstance.Activate();
|
||||
return;
|
||||
}
|
||||
this.Hide();
|
||||
windowInstance.Show();
|
||||
}
|
||||
|
||||
private void uiButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
SwitchWindow(ref _normalTemperatureMode, () => new NormalTemperatureMode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user