public UserControlCom(UserControlBase ub, string com, SERIALData serialValueData, bool configured = false) { InitializeComponent(); UserControl1 us = ub.parent_ as UserControl1; setTreeNodeStatusDelegate = new setTreeNodeStatusEventHandler(us.setTreeComEthNodeStats); serialValueData_ = serialValueData; //串口名 com_ = com; //configured为true,串口数据加载config_project //configured为false,串口数据加载控制器模板数据 configured_ = configured; if (serialValueData_.terminalResis == HAS_BOTH) { radioButton1.Enabled = true; radioButton2.Enabled = true; } else if (serialValueData_.terminalResis == HAS_RS485) { radioButton2.Enabled = false; } if (serialValueData.databitEnable == DATABIE_DISENABLE) { comboBox_Databit.Enabled = false; } else if (serialValueData_.databitEnable == DATABIE_ENABLE) { comboBox_Databit.Enabled = true; } initDone = false; if (configured_) { Init(); setDataToUI(); } else { Init(); } initDone = true; //数据管理里的串口数组 //UserControlBase.dataManage.serialDic.Add(com_, serialValueData); setButtonEnable(false); }
public UserControlEth(UserControlBase ub, string name, ETHERNETData ethernetValueData, bool configured = false) { InitializeComponent(); UserControl1 us = ub.parent_ as UserControl1; setTreeNodeStatusDelegate = new setTreeNodeStatusEventHandler(us.setTreeComEthNodeStats); ethernetValueData_ = ethernetValueData; configured_ = configured; etherName = name; var v = ipAddressControl_ipaddr.IPAddress; setButtonEnable(false); init(); //数据管理里的网口数组 LocalPLC一般是1个网口 //UserControlBase.dataManage.ethernetDic.Add(etherName, ethernetValueData_); var s = "0.0.0.0"; string maskAddress = "0.0.0.0"; try { //IP ipAddressControl_ipaddr.IPAddress = System.Net.IPAddress.Parse(ethernetValueData_.ipAddress); //mask ipAddressControl_maskaddr.IPAddress = System.Net.IPAddress.Parse(ethernetValueData_.maskAddress); //gateway ipAddressControl_gateway.IPAddress = System.Net.IPAddress.Parse(ethernetValueData_.gatewayAddress); //sntp ipAddressControl_sntpaddr.IPAddress = System.Net.IPAddress.Parse(ethernetValueData_.sntpServerIp); //1 dhcp 0固定 if (ethernetValueData_.ipMode == 1) { radioButton_dhcp.Checked = true; radioButton_fixed.Checked = false; } else { radioButton_dhcp.Checked = false; radioButton_fixed.Checked = true; } if (ethernetValueData_.checkSNTP == 0) { checkBox_SNTP.Checked = false; } else { checkBox_SNTP.Checked = true; } textBox_eth.Text = etherName; } catch (Exception e) { MessageBox.Show(string.Format("{1}模块{0}", e.Message, etherName)); } initDone = true; }
public LocalPLC24P(SplitContainer splitContainer, UserControlBase userBase , DataManageBase dataManage) { try { //控制器类型 this.Tag = 0; InitializeComponent(); split = splitContainer; userBase_ = userBase; UserControl1 us1 = (UserControl1)userBase.parent_; myDelegate = new DoSomethingEventHandler(us1.DoSomething); di = new UserControlDI(us1); dout = new UserControlDO(/*null, */ us1); hi = new UserControlHighIn(us1); hout = new UserControlHighOutput(us1); // Create the ToolTip and associate with the Form container. ToolTip toolTip1 = new ToolTip(); // Set up the delays for the ToolTip. toolTip1.AutoPopDelay = 5000; toolTip1.InitialDelay = 500; toolTip1.ReshowDelay = 200; // Force the ToolTip text to be displayed whether or not the form is active. toolTip1.ShowAlways = true; //pictureBox2.Parent = pictureBox1; //pictureBox3.Parent = pictureBox1; pictest1.Parent = pictureBox1; toolTip1.SetToolTip(pictest1, "DO"); pictest2.Parent = pictureBox1; toolTip1.SetToolTip(pictest2, "DI"); Serial_Line_1.Parent = pictureBox1; Serial_Line_1.Tag = "COM1"; // Set up the ToolTip text for the Button and Checkbox. toolTip1.SetToolTip(this.Serial_Line_1, Serial_Line_1.Tag.ToString()); Ethernet_1.Parent = pictureBox1; Ethernet_1.Tag = "NET1"; toolTip1.SetToolTip(Ethernet_1, Ethernet_1.Tag.ToString()); Serial_Line_2.Parent = pictureBox1; Serial_Line_2.Tag = "COM2"; toolTip1.SetToolTip(this.Serial_Line_2, Serial_Line_2.Tag.ToString()); //key value //com1 comobject 从配置文件读 picArray.Add("COM1", Serial_Line_1); picArray.Add("COM2", Serial_Line_2); picArray.Add("NET1", Ethernet_1); picArray.Add("DO", pictest1); picArray.Add("DI", pictest2); if (!dataManage.newControlerFlag) { refreshData(); } else { initDIDO(); } } catch { } }