|
|
@ -1,5 +1,6 @@ |
|
|
|
using DyeingComputer.View; |
|
|
|
using ScottPlot.Palettes; |
|
|
|
using ScottPlot.TickGenerators.TimeUnits; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Data; |
|
|
@ -49,16 +50,13 @@ namespace DyeingComputer.Windows |
|
|
|
P3.Text = DAT.Field<double>("Parameter3").ToString(); |
|
|
|
P4.Text = DAT.Field<double>("Parameter4").ToString(); |
|
|
|
P5.Text = DAT.Field<double>("Parameter5").ToString(); |
|
|
|
/* P1.Visibility = Visibility.Collapsed; |
|
|
|
P1N.Visibility = Visibility.Collapsed; |
|
|
|
P2.Visibility = Visibility.Collapsed; |
|
|
|
P2N.Visibility = Visibility.Collapsed; |
|
|
|
P3.Visibility = Visibility.Collapsed; |
|
|
|
P3N.Visibility = Visibility.Collapsed; |
|
|
|
P4.Visibility = Visibility.Collapsed; |
|
|
|
P4N.Visibility = Visibility.Collapsed; |
|
|
|
P5.Visibility = Visibility.Collapsed; |
|
|
|
P5N.Visibility = Visibility.Collapsed;*/ |
|
|
|
|
|
|
|
dat_P = 1; |
|
|
|
Setp(DAT.Field<string>("StepID_S1")); |
|
|
|
dat_P = 2; |
|
|
|
Setp(DAT.Field<string>("StepID_S2")); |
|
|
|
dat_P = 3; |
|
|
|
Setp(DAT.Field<string>("StepID_S3")); |
|
|
|
} |
|
|
|
|
|
|
|
private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//输入事件
|
|
|
@ -112,8 +110,9 @@ namespace DyeingComputer.Windows |
|
|
|
P5.Text = P5.Text.Trim(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private readonly string[] a = {"001","007","008","013","015" ,"017", "020", "022", "031", "035", "036", "039", "040", "041", "049", "050", |
|
|
|
private readonly string[] id_dat = {"001","007","008","013","015" ,"017", "020", "022", "031", "035", "036", "039", "040", "041", "049", "050", |
|
|
|
"051", "054", "055", "056","064","065","066","067","090","091","093","094" }; |
|
|
|
private readonly string[] id_datp = {"","001","007","008","013","015" ,"017", "020", "022", "031", "035", "036", "039", "040", "041", "049", "050", |
|
|
|
"051", "054", "055", "056","064","065","066","067","090","091","093","094" }; |
|
|
|
|
|
|
|
private void Form1_Load() |
|
|
@ -147,6 +146,8 @@ namespace DyeingComputer.Windows |
|
|
|
this.boxID.Items.Add(Properties.Resources.PHDetection);//ph检测093
|
|
|
|
this.boxID.Items.Add(Properties.Resources.PHControl);//ph控制094
|
|
|
|
|
|
|
|
|
|
|
|
this.boxIDp.Items.Add("");//温度控制001
|
|
|
|
this.boxIDp.Items.Add(Properties.Resources.TemperatureControl);//温度控制001
|
|
|
|
this.boxIDp.Items.Add(Properties.Resources.AddWater + "(" + Properties.Resources.WaterLevel + ")");//水位进水007
|
|
|
|
this.boxIDp.Items.Add(Properties.Resources.AddWater + "(" + Properties.Resources.Flowmeter + ")");//流量进水008
|
|
|
@ -176,7 +177,7 @@ namespace DyeingComputer.Windows |
|
|
|
this.boxIDp.Items.Add(Properties.Resources.PHDetection);//ph检测093
|
|
|
|
this.boxIDp.Items.Add(Properties.Resources.PHControl);//ph控制094
|
|
|
|
// boxNAME.Text = datid;
|
|
|
|
} |
|
|
|
}//创建
|
|
|
|
|
|
|
|
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)//输入事件
|
|
|
|
{ |
|
|
@ -184,11 +185,11 @@ namespace DyeingComputer.Windows |
|
|
|
string text = boxNAME.Text.ToString(); |
|
|
|
if (l == 3) |
|
|
|
{ |
|
|
|
int g = Array.IndexOf(a, text);//数组索引
|
|
|
|
int g = Array.IndexOf(id_dat, text);//数组索引
|
|
|
|
if (g != -1) |
|
|
|
{ |
|
|
|
boxID.SelectedIndex = g;//有效索引传入
|
|
|
|
Set(a[g]); |
|
|
|
Set(id_dat[g]); |
|
|
|
} else |
|
|
|
{ |
|
|
|
boxID.SelectedIndex =-1; |
|
|
@ -201,8 +202,8 @@ namespace DyeingComputer.Windows |
|
|
|
if (boxID.SelectedIndex !=-1) |
|
|
|
{ |
|
|
|
int i = boxID.SelectedIndex; |
|
|
|
boxNAME.Text = a.ElementAt(i); |
|
|
|
Set(a[i]); |
|
|
|
boxNAME.Text = id_dat.ElementAt(i); |
|
|
|
Set(id_dat[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
private void boxIDp_SelectionChanged(object sender, SelectionChangedEventArgs e) |
|
|
@ -210,15 +211,15 @@ namespace DyeingComputer.Windows |
|
|
|
if (boxIDp.SelectedIndex != -1) |
|
|
|
{ |
|
|
|
int i = boxIDp.SelectedIndex; |
|
|
|
boxNAMEp.Text = a.ElementAt(i); |
|
|
|
Setp(a[i]); |
|
|
|
boxNAMEp.Text = id_datp.ElementAt(i); |
|
|
|
Setp(id_datp[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
private void YES_Click(object sender, RoutedEventArgs e)//确认
|
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(boxID.Text)) |
|
|
|
{ |
|
|
|
var args1 = new AddressUpdateEventArgs(data, "", "", "", "0", "0", "0", "0", "0"); |
|
|
|
var args1 = new AddressUpdateEventArgs(data, "", "", "", dat_D); |
|
|
|
AddressUpdated(this, args1); |
|
|
|
this.Close(); //关闭窗口
|
|
|
|
return; |
|
|
@ -230,14 +231,13 @@ namespace DyeingComputer.Windows |
|
|
|
if (P4N.Visibility == Visibility.Visible) name += P4N.Text + ":[" + P4.Text + "]"; |
|
|
|
if (P5N.Visibility == Visibility.Visible) name += P5N.Text + ":[" + P5.Text + "]"; |
|
|
|
|
|
|
|
var args = new AddressUpdateEventArgs(data, boxNAME.Text, boxID.Text, name.ToString(), P1.Text, P2.Text, P3.Text, P4.Text, P5.Text); |
|
|
|
var args = new AddressUpdateEventArgs(data, boxNAME.Text, boxID.Text, name.ToString(), dat_D); |
|
|
|
AddressUpdated(this, args); |
|
|
|
this.Close(); //关闭窗口
|
|
|
|
} |
|
|
|
|
|
|
|
private void NO_Click(object sender, RoutedEventArgs e)//关闭
|
|
|
|
{ |
|
|
|
var args = new AddressUpdateEventArgs(data, "", "", "","0","0", "0", "0", "0"); |
|
|
|
var args = new AddressUpdateEventArgs(data, "", "", "", dat_D); |
|
|
|
AddressUpdated(this, args); |
|
|
|
this.Close(); //关闭窗口
|
|
|
|
} |
|
|
@ -1405,28 +1405,20 @@ namespace DyeingComputer.Windows |
|
|
|
} |
|
|
|
public class AddressUpdateEventArgs : System.EventArgs |
|
|
|
{ |
|
|
|
public AddressUpdateEventArgs(string dStep, string dStepID, string dStepNAME, string dPNAME, string dP1, string dP2, string dP3, string dP4, string dP5) |
|
|
|
public AddressUpdateEventArgs(string dStep, string dStepID, string dStepNAME, string dPNAME, DataRow dRow_DAT) |
|
|
|
{ |
|
|
|
this.StepID = dStepID; |
|
|
|
this.Step = dStep; |
|
|
|
this.StepNAME = dStepNAME; |
|
|
|
this.PNAME = dPNAME; |
|
|
|
this.P1 = dP1; |
|
|
|
this.P2 = dP2; |
|
|
|
this.P3 = dP3; |
|
|
|
this.P4 = dP4; |
|
|
|
this.P5 = dP5; |
|
|
|
this.Row_DAT = dRow_DAT; |
|
|
|
} |
|
|
|
|
|
|
|
public string Step { get; set; } |
|
|
|
public string StepID { get; set; } |
|
|
|
public string StepNAME { get; set; } |
|
|
|
public string PNAME { get; set; } |
|
|
|
public string P1 { get; set; } |
|
|
|
public string P2 { get; set; } |
|
|
|
public string P3 { get; set; } |
|
|
|
public string P4 { get; set; } |
|
|
|
public string P5 { get; set; } |
|
|
|
public DataRow Row_DAT { get; set; } |
|
|
|
} |
|
|
|
|
|
|
|
private void imageP1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
|
|
@ -1449,6 +1441,12 @@ namespace DyeingComputer.Windows |
|
|
|
((Image)sender).RenderTransform = Transform.Identity; |
|
|
|
dat_P = 1; |
|
|
|
Sub.Text = Properties.Resources.Subroutine + ": "+dat_P.ToString(); |
|
|
|
boxNAMEp.Text = dat_D.Field<string>("StepName_S1"); |
|
|
|
P1P.Text = dat_D.Field<double>("Parameter1_S1").ToString(); |
|
|
|
P2P.Text = dat_D.Field<double>("Parameter2_S1").ToString(); |
|
|
|
P3P.Text = dat_D.Field<double>("Parameter3_S1").ToString(); |
|
|
|
P4P.Text = dat_D.Field<double>("Parameter4_S1").ToString(); |
|
|
|
P5P.Text = dat_D.Field<double>("Parameter5_S1").ToString(); |
|
|
|
} |
|
|
|
|
|
|
|
private void imageP2_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) |
|
|
@ -1456,6 +1454,12 @@ namespace DyeingComputer.Windows |
|
|
|
((Image)sender).RenderTransform = Transform.Identity; |
|
|
|
dat_P = 2; |
|
|
|
Sub.Text = Properties.Resources.Subroutine + ": "+ dat_P.ToString(); |
|
|
|
boxNAMEp.Text = dat_D.Field<string>("StepName_S2"); |
|
|
|
P1P.Text = dat_D.Field<double>("Parameter1_S2").ToString(); |
|
|
|
P2P.Text = dat_D.Field<double>("Parameter2_S2").ToString(); |
|
|
|
P3P.Text = dat_D.Field<double>("Parameter3_S2").ToString(); |
|
|
|
P4P.Text = dat_D.Field<double>("Parameter4_S2").ToString(); |
|
|
|
P5P.Text = dat_D.Field<double>("Parameter5_S2").ToString(); |
|
|
|
} |
|
|
|
|
|
|
|
private void imageP3_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) |
|
|
@ -1463,6 +1467,12 @@ namespace DyeingComputer.Windows |
|
|
|
((Image)sender).RenderTransform = Transform.Identity; |
|
|
|
dat_P = 3; |
|
|
|
Sub.Text = Properties.Resources.Subroutine + ": "+ dat_P.ToString(); |
|
|
|
boxNAMEp.Text = dat_D.Field<string>("StepName_S2"); |
|
|
|
P1P.Text = dat_D.Field<double>("Parameter1_S3").ToString(); |
|
|
|
P2P.Text = dat_D.Field<double>("Parameter2_S3").ToString(); |
|
|
|
P3P.Text = dat_D.Field<double>("Parameter3_S3").ToString(); |
|
|
|
P4P.Text = dat_D.Field<double>("Parameter4_S3").ToString(); |
|
|
|
P5P.Text = dat_D.Field<double>("Parameter5_S3").ToString(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|