1349 lines
		
	
	
		
			57 KiB
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			1349 lines
		
	
	
		
			57 KiB
		
	
	
	
		
			C#
		
	
| using System;
 | |
| using System.Linq;
 | |
| using System.Collections.Generic;
 | |
| using System.ComponentModel;
 | |
| using System.Drawing;
 | |
| using System.Data;
 | |
| using System.Text;
 | |
| using System.Windows.Forms;
 | |
| 
 | |
| using INT_LKD.Forms;
 | |
| using INT_LKD.DialogForms;
 | |
| using INT_LKD.DataStore;
 | |
| using SmartX;
 | |
| 
 | |
| namespace INT_LKD.Controls
 | |
| {
 | |
|     public partial class ControlMenuSystemEthernet : UserControl
 | |
|     {
 | |
|         #region Field
 | |
|         private FormMenu m_ParentForm;
 | |
|         private bool IsServerON;
 | |
|         string[] HexArray;
 | |
| 
 | |
|         private delegate void ConnetedIPStatusCallback(string value);
 | |
|         #endregion
 | |
| 
 | |
|         #region Constructor
 | |
|         public ControlMenuSystemEthernet(FormMenu parent)
 | |
|         {
 | |
|             InitializeComponent();
 | |
| 
 | |
|             this.ParentForm = parent;
 | |
| 
 | |
|             this.Initialize();
 | |
|             this.DefaultSetting();
 | |
|             this.InitializeDesign();
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region Property
 | |
|         public FormMenu ParentForm
 | |
|         {
 | |
|             get { return this.m_ParentForm; }
 | |
|             private set { this.m_ParentForm = value; }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region Method
 | |
|         private void Initialize()
 | |
|         {
 | |
|         }
 | |
|         public void InitializeDesign()
 | |
|         {
 | |
|             switch (this.ParentForm.ParentForm.SystemConfig.LANGUAGE)
 | |
|             {
 | |
|                 case Define.E_LanguageID.Chinese:
 | |
|                     this.smartGroupBox1.Text = "系统设定 > 以太网";
 | |
| 
 | |
|                     this.groupBoxModeSettings.Text = "模式";
 | |
|                     this.groupBoxServer.Text = "Server";
 | |
|                     this.groupBoxClient.Text = "Client";
 | |
|                     this.groupBoxLocalSettings.Text = "本地设置";
 | |
|                     this.groupBoxModbusSetting.Text = "协议转换";
 | |
| 
 | |
|                     this.labelTitleOperationMode.Text = "运转模式";
 | |
|                     this.labelTitleCommMode.Text = "通信模式";
 | |
| 
 | |
|                     this.labelTitleServerStatus.Text = this.labelTitleClientStatus.Text = "地位";
 | |
|                     this.labelTitleServerConnectedIP.Text = "连接的IP";
 | |
|                     this.labelTitleServerLocalPort.Text = "端口";
 | |
| 
 | |
|                     this.labelTitleClientServerIP.Text = "Server IP";
 | |
|                     this.labelTitleClientServerPort.Text = "Server端口";
 | |
| 
 | |
|                     this.buttonTestSend.ButtonText = "测试发送";
 | |
|                     this.buttonSaveMode.ButtonText = this.buttonSaveServer.ButtonText
 | |
|                         = this.buttonSaveClient.ButtonText = this.buttonSaveLocal.ButtonText
 | |
|                         = this.buttonSaveModbus.ButtonText = "节省";
 | |
|                     this.buttonStartServer.ButtonText = this.buttonStartClient.ButtonText = "开启";
 | |
|                     this.buttonStopServer.ButtonText = this.buttonStopClient.ButtonText = "停止";
 | |
| 
 | |
|                     this.labelHelp.Text = "※ 设置完成后需要重启.";
 | |
|                     this.labelTitleIPConfiguration.Text = "IP 配置";
 | |
|                     this.labelTitleIPAddress.Text = "IP Address";
 | |
|                     this.labelTitleSubnetMask.Text = "Subnet mask";
 | |
|                     this.labelTitleGateway.Text = "GateWay";
 | |
|                     this.labelTitleMACAddress.Text = "MAC Address";
 | |
| 
 | |
|                     this.labelTitleRole.Text = "角色";
 | |
|                     this.labelTitleFunctions.Text = "功能";
 | |
|                     this.labelTitleStartAddress.Text = "起始地址";
 | |
|                     break;
 | |
|                 case Define.E_LanguageID.English:
 | |
|                     this.smartGroupBox1.Text = "System > Ethernet";
 | |
| 
 | |
|                     this.groupBoxModeSettings.Text = "Mode Settings";
 | |
|                     this.groupBoxServer.Text = "Server";
 | |
|                     this.groupBoxClient.Text = "Client";
 | |
|                     this.groupBoxLocalSettings.Text = "Local Settings";
 | |
|                     this.groupBoxModbusSetting.Text = "Modbus Settings";
 | |
| 
 | |
|                     this.labelTitleOperationMode.Text = "Operation Mode";
 | |
|                     this.labelTitleCommMode.Text = "Communication Mode";
 | |
| 
 | |
|                     this.labelTitleServerStatus.Text = this.labelTitleClientStatus.Text = "Status";
 | |
|                     this.labelTitleServerConnectedIP.Text = "Connected IP";
 | |
|                     this.labelTitleServerLocalPort.Text = "Local Port";
 | |
| 
 | |
|                     this.labelTitleClientServerIP.Text = "Server IP";
 | |
|                     this.labelTitleClientServerPort.Text = "Server Port";
 | |
| 
 | |
|                     this.buttonTestSend.ButtonText = "Test send";
 | |
|                     this.buttonSaveMode.ButtonText = this.buttonSaveServer.ButtonText
 | |
|                         = this.buttonSaveClient.ButtonText = this.buttonSaveLocal.ButtonText
 | |
|                         = this.buttonSaveModbus.ButtonText = "Save";
 | |
|                     this.buttonStartServer.ButtonText = this.buttonStartClient.ButtonText = "Start";
 | |
|                     this.buttonStopServer.ButtonText = this.buttonStopClient.ButtonText = "Stop";
 | |
| 
 | |
|                     this.labelHelp.Text = "※ After setup, reboot is required.";
 | |
|                     this.labelTitleIPConfiguration.Text = "IP Configuration";
 | |
|                     this.labelTitleIPAddress.Text = "IP Address";
 | |
|                     this.labelTitleSubnetMask.Text = "Subnet mask";
 | |
|                     this.labelTitleGateway.Text = "GateWay";
 | |
|                     this.labelTitleMACAddress.Text = "MAC Address";
 | |
| 
 | |
|                     this.labelTitleRole.Text = "Role";
 | |
|                     this.labelTitleFunctions.Text = "Function";
 | |
|                     this.labelTitleStartAddress.Text = "Start Address";
 | |
|                     break;
 | |
|                 case Define.E_LanguageID.Korean:
 | |
|                     this.groupBoxModeSettings.Text = "Mode Settings";
 | |
|                     this.groupBoxServer.Text = "Server";
 | |
|                     this.groupBoxClient.Text = "Client";
 | |
|                     this.groupBoxLocalSettings.Text = "Local Settings";
 | |
|                     this.groupBoxModbusSetting.Text = "Modbus Settings";
 | |
| 
 | |
|                     this.labelTitleOperationMode.Text = "동작모드";
 | |
|                     this.labelTitleCommMode.Text = "통신모드";
 | |
| 
 | |
|                     this.labelTitleServerStatus.Text = this.labelTitleClientStatus.Text = "Status";
 | |
|                     this.labelTitleServerConnectedIP.Text = "Connected IP";
 | |
|                     this.labelTitleServerLocalPort.Text = "Local Port";
 | |
| 
 | |
|                     this.labelTitleClientServerIP.Text = "Server IP";
 | |
|                     this.labelTitleClientServerPort.Text = "Server Port";
 | |
| 
 | |
|                     this.buttonTestSend.ButtonText = "Test send";
 | |
|                     this.buttonSaveMode.ButtonText = this.buttonSaveServer.ButtonText
 | |
|                         = this.buttonSaveClient.ButtonText = this.buttonSaveLocal.ButtonText
 | |
|                         = this.buttonSaveModbus.ButtonText = "Save";
 | |
|                     this.buttonStartServer.ButtonText = this.buttonStartClient.ButtonText = "Start";
 | |
|                     this.buttonStopServer.ButtonText = this.buttonStopClient.ButtonText = "Stop";
 | |
| 
 | |
|                     this.labelHelp.Text = "※ 설정 후, 재부팅 필수";
 | |
|                     this.labelTitleIPConfiguration.Text = "IP Configuration";
 | |
|                     this.labelTitleIPAddress.Text = "IP Address";
 | |
|                     this.labelTitleSubnetMask.Text = "Subnet mask";
 | |
|                     this.labelTitleGateway.Text = "GateWay";
 | |
|                     this.labelTitleMACAddress.Text = "MAC Address";
 | |
| 
 | |
|                     this.labelTitleRole.Text = "Role";
 | |
|                     this.labelTitleFunctions.Text = "Function";
 | |
|                     this.labelTitleStartAddress.Text = "Start Address";
 | |
|                     break;
 | |
|                 default:
 | |
|                     break;
 | |
|             }
 | |
|         }
 | |
|         private void DefaultSetting()
 | |
|         {
 | |
|             string[] sValue;
 | |
| 
 | |
|             this.IsServerON = false;
 | |
| 
 | |
|             this.comboBoxEthernetOpMode.Items.Clear();
 | |
|             this.comboBoxEthernetOpMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
 | |
|             this.comboBoxEthernetOpMode.Items.Add("None");
 | |
|             this.comboBoxEthernetOpMode.Items.Add("Server");
 | |
|             this.comboBoxEthernetOpMode.Items.Add("Client");
 | |
|             this.comboBoxEthernetOpMode.SelectedIndex = 0;
 | |
|             this.comboBoxEthernetOpMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
 | |
| 
 | |
|             this.comboBoxEthernetMode.Items.Clear();
 | |
|             this.comboBoxEthernetMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetMode_SelectedIndexChanged);
 | |
|             this.comboBoxEthernetMode.Items.Add("None");
 | |
|             this.comboBoxEthernetMode.Items.Add("Modbus");
 | |
|             this.comboBoxEthernetMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetMode_SelectedIndexChanged);
 | |
| 
 | |
|             if (this.ParentForm.ParentForm.SystemConfig.IsEthernetEnable == true)
 | |
|             {
 | |
|                 this.buttonStartServer.Enabled = true;
 | |
|                 this.buttonStopServer.Enabled = true;
 | |
|                 this.buttonStartClient.Enabled = true;
 | |
|                 this.buttonStopClient.Enabled = true;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 this.buttonStartServer.Enabled = false;
 | |
|                 this.buttonStopServer.Enabled = false;
 | |
|                 this.buttonStartClient.Enabled = false;
 | |
|                 this.buttonStopClient.Enabled = false;
 | |
|             }
 | |
| 
 | |
|             this.labelServerStatus.Text = "-";
 | |
|             this.labelClientStatus.Text = "-";
 | |
|             this.labelConnectedIP.Text = "-";
 | |
| 
 | |
|             // Host IP
 | |
|             sValue = this.ParentForm.ParentForm.SystemConfig.ETHERNET_SERVER_IP.Split('.');
 | |
|             this.labelHostIP1.Text = sValue[0];
 | |
|             this.labelHostIP2.Text = sValue[1];
 | |
|             this.labelHostIP3.Text = sValue[2];
 | |
|             this.labelHostIP4.Text = sValue[3];
 | |
| 
 | |
|             this.labelHostPort.Text = this.ParentForm.ParentForm.SystemConfig.ETHERNET_SERVER_PORT.ToString();
 | |
|             this.labelLocalPort.Text = this.ParentForm.ParentForm.SystemConfig.ETHERNET_LOCAL_PORT.ToString();
 | |
| 
 | |
|             this.buttonSaveServer.Visible = false;
 | |
|             this.buttonSaveClient.Visible = false;
 | |
|             this.buttonSaveMode.Visible = false;
 | |
|             this.buttonSaveLocal.Visible = false;
 | |
|             this.buttonSaveModbus.Visible = false;
 | |
|         }
 | |
| 
 | |
|         private string ReturnCommunicationModeName(int num)
 | |
|         {
 | |
|             #region 한국어
 | |
|             switch (num)
 | |
|             {
 | |
|                 case 0:
 | |
|                     return "None";
 | |
|                 case 1:
 | |
|                     return "Modbus";
 | |
|                 default:
 | |
|                     return "None";
 | |
|             }
 | |
|             #endregion
 | |
|         }
 | |
| 
 | |
|         public void DisplayLabelLocalPort(bool bValue)
 | |
|         {
 | |
|             if (bValue == false)
 | |
|             {
 | |
|                 this.labelLocalPort.Enabled = false;
 | |
|                 this.labelLocalPort.BackColor = Color.Silver;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 this.labelLocalPort.Enabled = true;
 | |
|                 this.labelLocalPort.BackColor = Color.White;
 | |
|             }
 | |
|         }
 | |
|         public void UpdateEthernetStatusDisplay(string value)
 | |
|         {
 | |
|             if (this.labelClientStatus.Text != value)
 | |
|                 this.labelClientStatus.Text = value;
 | |
|         }
 | |
| 
 | |
|         private void LocalIPEnable(bool enable)
 | |
|         {
 | |
|             Color tempColor;
 | |
| 
 | |
|             if (enable == true)
 | |
|                 tempColor = Color.Black;
 | |
|             else
 | |
|                 tempColor = Color.Gray;
 | |
| 
 | |
|             #region Color
 | |
|             this.labelLocalIP1.ForeColor = tempColor;
 | |
|             this.labelLocalIP2.ForeColor = tempColor;
 | |
|             this.labelLocalIP3.ForeColor = tempColor;
 | |
|             this.labelLocalIP4.ForeColor = tempColor;
 | |
| 
 | |
|             this.labelLocalSubnetMask1.ForeColor = tempColor;
 | |
|             this.labelLocalSubnetMask2.ForeColor = tempColor;
 | |
|             this.labelLocalSubnetMask3.ForeColor = tempColor;
 | |
|             this.labelLocalSubnetMask4.ForeColor = tempColor;
 | |
| 
 | |
|             this.labelLocalGateway1.ForeColor = tempColor;
 | |
|             this.labelLocalGateway2.ForeColor = tempColor;
 | |
|             this.labelLocalGateway3.ForeColor = tempColor;
 | |
|             this.labelLocalGateway4.ForeColor = tempColor;
 | |
|             #endregion
 | |
| 
 | |
|             #region Enable
 | |
|             this.labelLocalIP1.Enabled = enable;
 | |
|             this.labelLocalIP2.Enabled = enable;
 | |
|             this.labelLocalIP3.Enabled = enable;
 | |
|             this.labelLocalIP4.Enabled = enable;
 | |
| 
 | |
|             this.labelLocalSubnetMask1.Enabled = enable;
 | |
|             this.labelLocalSubnetMask2.Enabled = enable;
 | |
|             this.labelLocalSubnetMask3.Enabled = enable;
 | |
|             this.labelLocalSubnetMask4.Enabled = enable;
 | |
| 
 | |
|             this.labelLocalGateway1.Enabled = enable;
 | |
|             this.labelLocalGateway2.Enabled = enable;
 | |
|             this.labelLocalGateway3.Enabled = enable;
 | |
|             this.labelLocalGateway4.Enabled = enable;
 | |
|             #endregion
 | |
|         }
 | |
|         private void UpdateLocalIPAddressDisplay()
 | |
|         {
 | |
|             string[] sValue;
 | |
| 
 | |
|             // Local IP
 | |
|             sValue = this.ParentForm.ParentForm.smartConfigs.IPSettings.DeviceIP.Split('.');
 | |
|             if (sValue.Length == 4)
 | |
|             {
 | |
|                 this.labelLocalIP1.Text = sValue[0];
 | |
|                 this.labelLocalIP2.Text = sValue[1];
 | |
|                 this.labelLocalIP3.Text = sValue[2];
 | |
|                 this.labelLocalIP4.Text = sValue[3];
 | |
|             }
 | |
| 
 | |
|             // Local Subnet Mask
 | |
|             sValue = this.ParentForm.ParentForm.smartConfigs.IPSettings.SubNetMask.Split('.');
 | |
|             if (sValue.Length == 4)
 | |
|             {
 | |
|                 this.labelLocalSubnetMask1.Text = sValue[0];
 | |
|                 this.labelLocalSubnetMask2.Text = sValue[1];
 | |
|                 this.labelLocalSubnetMask3.Text = sValue[2];
 | |
|                 this.labelLocalSubnetMask4.Text = sValue[3];
 | |
|             }
 | |
| 
 | |
|             // Local GateWay
 | |
|             sValue = this.ParentForm.ParentForm.smartConfigs.IPSettings.GateWay.Split('.');
 | |
|             if (sValue.Length == 4)
 | |
|             {
 | |
|                 this.labelLocalGateway1.Text = sValue[0];
 | |
|                 this.labelLocalGateway2.Text = sValue[1];
 | |
|                 this.labelLocalGateway3.Text = sValue[2];
 | |
|                 this.labelLocalGateway4.Text = sValue[3];
 | |
|             }
 | |
|         }
 | |
|         private void UpdateLocalIPConfigurationDisplay()
 | |
|         {
 | |
|             // Local IP DHCP
 | |
|             if (this.ParentForm.ParentForm.smartConfigs.IPSettings.DHCPEnable == 1)
 | |
|             {
 | |
|                 this.radioButtonLocalIpDHCP.Checked = true;
 | |
|                 this.LocalIPEnable(false);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 this.radioButtonLocalIpStatic.Checked = true;
 | |
|                 this.LocalIPEnable(true);
 | |
|             }
 | |
|         }
 | |
|         private void UpdateMACAddressDisplay()
 | |
|         {
 | |
|             byte[] currentMAC = this.ParentForm.ParentForm.smartConfigs.IPSettings.GetMACAddress();
 | |
|             string hex = BitConverter.ToString(currentMAC);
 | |
|             this.HexArray = hex.Split('-');
 | |
| 
 | |
|             if (this.HexArray.Length >= 6)
 | |
|             {
 | |
|                 this.labelMACAddress1.Text = this.HexArray[0] + ":" + this.HexArray[1] + ":" + this.HexArray[2] + ":";
 | |
|                 this.labelMACAddress4.Text = this.HexArray[3];
 | |
|                 this.labelMACAddress5.Text = this.HexArray[4];
 | |
|                 this.labelMACAddress6.Text = this.HexArray[5];
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private void ConnectedIPStatusOut(string value)
 | |
|         {
 | |
|             this.labelConnectedIP.Text = value;
 | |
|         }
 | |
|         private void DelegateConnectedIPStatusOut(string value)
 | |
|         {
 | |
|             this.Invoke(new ConnetedIPStatusCallback(this.ConnectedIPStatusOut), value);
 | |
|         }
 | |
| 
 | |
|         private void ModbusSetting()
 | |
|         {
 | |
|             if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_COMM_MODE == 1)
 | |
|             {
 | |
|                 if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE == 1)
 | |
|                 {
 | |
|                     this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(true);
 | |
|                     this.groupBoxModbusSetting.Visible = true;
 | |
| 
 | |
|                     this.labelModbusRole.Text = "Slave";
 | |
|                     this.labelFunctions.Text = "04: Read input register";
 | |
| 
 | |
|                     this.labelTitleStartAddress.Visible = false;
 | |
|                     this.labelStartAddress.Visible = false;
 | |
|                 }
 | |
|                 else if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE == 2)
 | |
|                 {
 | |
|                     this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(true);
 | |
|                     this.groupBoxModbusSetting.Visible = true;
 | |
| 
 | |
|                     this.labelModbusRole.Text = "Master";
 | |
|                     this.labelFunctions.Text = "16: Write multiple register";
 | |
| 
 | |
|                     this.labelTitleStartAddress.Visible = true;
 | |
|                     this.labelStartAddress.Visible = true;
 | |
|                     this.labelStartAddress.Text = this.ParentForm.ParentForm.SystemConfig.MODBUS_TCP_START_ADDRESS.ToString();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(false);
 | |
|                     this.groupBoxModbusSetting.Visible = false;
 | |
|                 }
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(false);
 | |
|                 this.groupBoxModbusSetting.Visible = false;
 | |
|             }
 | |
| 
 | |
|             this.ParentForm.ParentForm.ChildFormMainDisplay.InitialEthernetIcon();
 | |
|         }
 | |
| 
 | |
|         public void DisplayRefresh()
 | |
|         {
 | |
|             this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplayMode = Define.E_DisplayModeStore.Ethernet;
 | |
|             this.ParentForm.ParentForm.SetDisplayMode(Define.E_EquipmentMode.Menu);
 | |
| 
 | |
|             this.comboBoxEthernetMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetMode_SelectedIndexChanged);
 | |
|             this.comboBoxEthernetOpMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
 | |
| 
 | |
|             this.comboBoxEthernetOpMode.SelectedIndex = this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE;
 | |
|             this.comboBoxEthernetMode.SelectedIndex = this.ParentForm.ParentForm.SystemConfig.ETHERNET_COMM_MODE;
 | |
| 
 | |
|             this.comboBoxEthernetMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetMode_SelectedIndexChanged);
 | |
|             this.comboBoxEthernetOpMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
 | |
| 
 | |
|             this.ModbusSetting();
 | |
| 
 | |
|             if (this.comboBoxEthernetOpMode.SelectedIndex == 1)
 | |
|             {
 | |
|                 this.buttonStartServer.Enabled = true;
 | |
|                 this.buttonStopServer.Enabled = true;
 | |
| 
 | |
|                 if (string.Compare(this.ParentForm.ParentForm.smartConfigs.IPSettings.DeviceIP, "0.0.0.0") == 0)
 | |
|                 {
 | |
|                     if (this.labelServerStatus.Text != ">Addr Err")
 | |
|                         this.labelServerStatus.Text = ">Addr Err";
 | |
| 
 | |
|                     this.timerServer.Enabled = false;
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.ParentForm.ParentForm.EthernetServerStart();
 | |
| 
 | |
|                     if (this.timerServer.Enabled != true)
 | |
|                         this.timerServer.Enabled = true;
 | |
|                 }
 | |
|             }
 | |
|             else if (this.comboBoxEthernetOpMode.SelectedIndex == 2)
 | |
|             {
 | |
|                 this.buttonStartClient.Enabled = true;
 | |
|                 this.buttonStopClient.Enabled = true;
 | |
| 
 | |
|                 this.ParentForm.ParentForm.EthernetClientConnect();
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 this.buttonStartServer.Enabled = false;
 | |
|                 this.buttonStopServer.Enabled = false;
 | |
|                 this.buttonStartClient.Enabled = false;
 | |
|                 this.buttonStopClient.Enabled = false;
 | |
| 
 | |
|                 this.labelServerStatus.Text = "-";
 | |
|                 this.labelClientStatus.Text = "-";
 | |
|                 this.labelConnectedIP.Text = "-";
 | |
|             }
 | |
|             this.labelLocalPort.Text = this.ParentForm.ParentForm.SystemConfig.ETHERNET_LOCAL_PORT.ToString();
 | |
| 
 | |
|             // Local IP DHCP
 | |
|             this.UpdateLocalIPConfigurationDisplay();
 | |
| 
 | |
|             // Local IP
 | |
|             this.UpdateLocalIPAddressDisplay();
 | |
| 
 | |
|             // MAC Address
 | |
|             this.UpdateMACAddressDisplay();
 | |
| 
 | |
|             this.buttonSaveMode.Visible = false;
 | |
| 
 | |
|             switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUser.Group)
 | |
|             {
 | |
|                 case Define.E_UserGroup.None:
 | |
|                     this.Enabled = false;
 | |
|                     break;
 | |
|                 case Define.E_UserGroup.Level1:
 | |
|                     this.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level1.IsMenuEthernet;
 | |
|                     break;
 | |
|                 case Define.E_UserGroup.Level2:
 | |
|                     this.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level2.IsMenuEthernet;
 | |
|                     break;
 | |
|                 case Define.E_UserGroup.Level3:
 | |
|                     this.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level3.IsMenuEthernet;
 | |
|                     break;
 | |
|                 case Define.E_UserGroup.Admin:
 | |
|                     this.Enabled = true;
 | |
|                     break;
 | |
|                 case Define.E_UserGroup.Developer:
 | |
|                     this.Enabled = true;
 | |
|                     break;
 | |
|                 case Define.E_UserGroup.NotLogin:
 | |
|                     this.Enabled = false;
 | |
|                     break;
 | |
|                 case Define.E_UserGroup.LogOut:
 | |
|                     this.Enabled = false;
 | |
|                     break;
 | |
|                 default:
 | |
|                     break;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region Event Handler
 | |
|         private void buttonSaveMode_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             int mode = 0;
 | |
|             string beforeLocalPort = "", afterLocalPort = "";
 | |
|             string beforeOpMode = "", afterOpMode = "";
 | |
|             string beforeComMode = "", afterComMode = "";
 | |
| 
 | |
|             beforeLocalPort = this.labelLocalPort.Text;
 | |
|             if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE == 1)
 | |
|                 beforeOpMode = "Server";
 | |
|             else if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE == 2)
 | |
|                 beforeOpMode = "Client";
 | |
|             else
 | |
|                 beforeOpMode = "None";
 | |
|             beforeComMode = this.ReturnCommunicationModeName(this.ParentForm.ParentForm.SystemConfig.ETHERNET_COMM_MODE);
 | |
| 
 | |
|             if (this.comboBoxEthernetOpMode.SelectedIndex == 1)
 | |
|             {
 | |
|                 this.ParentForm.ParentForm.SystemConfig.MODBUS_TCP_SELECTFUNCTION = (int)Define.E_ModbusFunction._04_ReadInputRegister;
 | |
|                 this.ParentForm.ParentForm.EthernetClientDisconnect();
 | |
|                 this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE = 1;
 | |
|                 afterOpMode = "Server";
 | |
| 
 | |
|                 this.buttonStartServer.Enabled = true;
 | |
|                 this.buttonStopServer.Enabled = true;
 | |
|                 this.buttonStartClient.Enabled = false;
 | |
|                 this.buttonStopClient.Enabled = false;
 | |
|             }
 | |
|             else if (this.comboBoxEthernetOpMode.SelectedIndex == 2)
 | |
|             {
 | |
|                 this.ParentForm.ParentForm.SystemConfig.MODBUS_TCP_SELECTFUNCTION = (int)Define.E_ModbusFunction._16_WriteMultipleRegister;
 | |
|                 this.labelServerStatus.Text = "-";
 | |
|                 this.timerServer.Enabled = false;
 | |
|                 this.ParentForm.ParentForm.EthernetServerStop();
 | |
|                 this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE = 2;
 | |
|                 this.ParentForm.ParentForm.EthernetClientDisconnect();
 | |
|                 afterOpMode = "Client";
 | |
| 
 | |
|                     this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(false);
 | |
| 
 | |
|                 this.labelConnectedIP.Text = "-";
 | |
| 
 | |
|                 this.buttonStartClient.Enabled = true;
 | |
|                 this.buttonStopClient.Enabled = true;
 | |
|                 this.buttonStartServer.Enabled = false;
 | |
|                 this.buttonStopServer.Enabled = false;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 this.timerServer.Enabled = false;
 | |
|                 this.ParentForm.ParentForm.EthernetServerStop();
 | |
|                 this.ParentForm.ParentForm.EthernetClientDisconnect();
 | |
|                 this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE = 0;
 | |
|                 afterOpMode = "None";
 | |
| 
 | |
|                     this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(false);
 | |
| 
 | |
|                 this.buttonStartServer.Enabled = false;
 | |
|                 this.buttonStopServer.Enabled = false;
 | |
|                 this.buttonStartClient.Enabled = false;
 | |
|                 this.buttonStopClient.Enabled = false;
 | |
| 
 | |
|                 this.labelServerStatus.Text = "-";
 | |
|                 this.labelClientStatus.Text = "-";
 | |
|                 this.labelConnectedIP.Text = "-";
 | |
|             }
 | |
| 
 | |
|             mode = this.comboBoxEthernetMode.SelectedIndex;
 | |
|             this.ParentForm.ParentForm.SystemConfig.ETHERNET_COMM_MODE = mode;
 | |
|             afterComMode = this.ReturnCommunicationModeName(mode);
 | |
| 
 | |
|             this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig);
 | |
|             this.ModbusSetting();
 | |
| 
 | |
|             this.buttonSaveMode.Visible = false;
 | |
| 
 | |
|             afterLocalPort = this.labelLocalPort.Text;
 | |
| 
 | |
|             if (beforeLocalPort != afterLocalPort)
 | |
|                 this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.TCPLocalPort, "", beforeLocalPort, afterLocalPort);
 | |
|             if (beforeOpMode != afterOpMode)
 | |
|                 this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.TCPOpMode, "", beforeOpMode, afterOpMode);
 | |
|             if (beforeComMode != afterComMode)
 | |
|                 this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.TCPComMode, "", beforeComMode, afterComMode);
 | |
|         }
 | |
|         private void buttonTestSend_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             int tempStringLength = 0;
 | |
|             string tempString = "";
 | |
|             string str = "";
 | |
| 
 | |
|             StringBuilder sb = new StringBuilder();
 | |
|             byte[] byteArray = new byte[12];
 | |
|             byte[] weightBytes = new byte[4];
 | |
|             byte[] bytes = new byte[100];
 | |
| 
 | |
|             if (this.comboBoxEthernetMode.SelectedIndex == 0)
 | |
|                 return;
 | |
| 
 | |
|             switch (this.comboBoxEthernetMode.SelectedIndex)
 | |
|             {
 | |
|                 case 1:
 | |
|                     #region Modbus TCP(16. Write Multiple Registers)
 | |
|                     if (this.ParentForm.ParentForm.SystemConfig.MODBUS_TCP_SELECTFUNCTION == (int)Define.E_ModbusFunction._16_WriteMultipleRegister)
 | |
|                     {
 | |
|                         byte[] sendData = this.ParentForm.ParentForm.Modbus.MakeTCPSendAllData(this.ParentForm.ParentForm.Transfer_1_Modbus_Write(), this.ParentForm.ParentForm.SystemConfig.MODBUS_TCP_START_ADDRESS);
 | |
| 
 | |
|                         this.ParentForm.ParentForm.EthernetWeightDataForModbus(sendData);
 | |
|                     }
 | |
|                     #endregion
 | |
|                     break;
 | |
|                 default:
 | |
|                     break;
 | |
|             }
 | |
| 
 | |
|             switch (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE)
 | |
|             {
 | |
|                 case 1:
 | |
| 
 | |
|                     if (this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList != null)
 | |
|                     {
 | |
|                         foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList)
 | |
|                         {
 | |
|                             if (sb.ToString() == "")
 | |
|                                 this.ParentForm.ParentForm.EthernetServerSendMessage(client, byteArray);
 | |
|                             else
 | |
|                                 this.ParentForm.ParentForm.EthernetServerSendMessage(client, sb.ToString());
 | |
|                         }
 | |
|                     }
 | |
|                     break;
 | |
|                 case 2:
 | |
|                     if (sb.ToString() == "")
 | |
|                         this.ParentForm.ParentForm.EthernetWeightData(byteArray);
 | |
|                     else
 | |
|                         this.ParentForm.ParentForm.EthernetWeightData(sb.ToString());
 | |
|                     break;
 | |
|                 default:
 | |
|                     break;
 | |
|             }
 | |
|         }
 | |
|         private void comboBoxEthernetMode_SelectedIndexChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             if (this.buttonSaveMode.Visible == false)
 | |
|                 this.buttonSaveMode.Visible = true;
 | |
|         }
 | |
|         private void comboBoxEthernetOpMode_SelectedIndexChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             if (this.buttonSaveMode.Visible == false)
 | |
|                 this.buttonSaveMode.Visible = true;
 | |
|         }
 | |
| 
 | |
|         // Server
 | |
|         private void labelLocalPort_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalPort.Text, 5, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 this.labelLocalPort.Text = myKeyPad.StringValue;
 | |
| 
 | |
|                 if (this.buttonSaveServer.Visible == false)
 | |
|                     this.buttonSaveServer.Visible = true;
 | |
|             }
 | |
|         }
 | |
|         private void buttonStartServer_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             this.buttonStartServer.Enabled = true;
 | |
|             this.buttonStopServer.Enabled = true;
 | |
| 
 | |
|             if (string.Compare(this.ParentForm.ParentForm.smartConfigs.IPSettings.DeviceIP, "0.0.0.0") == 0)
 | |
|             {
 | |
|                 if (this.labelServerStatus.Text != ">Addr Err")
 | |
|                     this.labelServerStatus.Text = ">Addr Err";
 | |
| 
 | |
|                 if (this.timerServer.Enabled != false)
 | |
|                     this.timerServer.Enabled = false;
 | |
| 
 | |
|                 this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(false);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 this.ParentForm.ParentForm.EthernetServerStart();
 | |
| 
 | |
|                 if (this.timerServer.Enabled != true)
 | |
|                     this.timerServer.Enabled = true;
 | |
| 
 | |
|                 this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(true);
 | |
|             }
 | |
| 
 | |
|             this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.TryEthernetStart, "Server");
 | |
|         }
 | |
|         private void buttonStopServer_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             this.timerServer.Enabled = false;
 | |
|             this.ParentForm.ParentForm.EthernetServerStop();
 | |
| 
 | |
|             if (this.labelServerStatus.Text != ">Stop")
 | |
|                 this.labelServerStatus.Text = ">Stop";
 | |
| 
 | |
|             this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(false);
 | |
|             this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.TryEthernetStop, "Server");
 | |
|         }
 | |
|         private void buttonSaveServer_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string before = "", after = "";
 | |
| 
 | |
|             before = this.ParentForm.ParentForm.SystemConfig.ETHERNET_LOCAL_PORT.ToString();
 | |
|             this.ParentForm.ParentForm.SystemConfig.ETHERNET_LOCAL_PORT = int.Parse(this.labelLocalPort.Text);
 | |
|             this.ParentForm.ParentForm.smartTCPMultiServer.Port = this.ParentForm.ParentForm.SystemConfig.ETHERNET_LOCAL_PORT;
 | |
|             after = this.labelLocalPort.Text;
 | |
| 
 | |
|             if (before != after)
 | |
|                 this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.TCPLocalPort, "", before, after);
 | |
| 
 | |
|             this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig);
 | |
| 
 | |
|             this.buttonSaveServer.Visible = false;
 | |
|         }
 | |
| 
 | |
|         // Client
 | |
|         private void buttonSaveClient_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string beforeServerIP = "", afterServerIP = "";
 | |
|             string beforeServerPort = "", afterServerPort = "";
 | |
| 
 | |
|             beforeServerIP = this.ParentForm.ParentForm.SystemConfig.ETHERNET_SERVER_IP;
 | |
|             beforeServerPort = this.ParentForm.ParentForm.SystemConfig.ETHERNET_SERVER_PORT.ToString();
 | |
|             try
 | |
|             {
 | |
|                 this.ParentForm.ParentForm.SystemConfig.ETHERNET_SERVER_PORT = int.Parse(this.labelHostPort.Text);
 | |
|                 afterServerPort = this.ParentForm.ParentForm.SystemConfig.ETHERNET_SERVER_PORT.ToString();
 | |
|             }
 | |
|             catch
 | |
|             {
 | |
|                 this.ParentForm.ParentForm.SystemConfig.ETHERNET_SERVER_PORT = 0;
 | |
|                 afterServerPort = "0";
 | |
|             }
 | |
| 
 | |
|             this.ParentForm.ParentForm.SystemConfig.ETHERNET_SERVER_IP = string.Format("{0}.{1}.{2}.{3}",
 | |
|                 this.labelHostIP1.Text, this.labelHostIP2.Text, this.labelHostIP3.Text, this.labelHostIP4.Text);
 | |
| 
 | |
|             afterServerIP = this.ParentForm.ParentForm.SystemConfig.ETHERNET_SERVER_IP;
 | |
| 
 | |
|             this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig);
 | |
|             this.ParentForm.ParentForm.EthernetClientDisconnect();
 | |
|             this.buttonSaveClient.Visible = false;
 | |
| 
 | |
|             if (beforeServerIP != afterServerIP)
 | |
|                 this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.TCPServerIPAddress, "", beforeServerIP, afterServerIP);
 | |
|             if (beforeServerPort != afterServerPort)
 | |
|                 this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.TCPServerPort, "", beforeServerPort, afterServerPort);
 | |
|         }
 | |
|         private void labelHostIP1_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelHostIP1.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelHostIP1.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveClient.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelHostIP2_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelHostIP2.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelHostIP2.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveClient.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelHostIP3_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelHostIP3.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelHostIP3.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveClient.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelHostIP4_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelHostIP4.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelHostIP4.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveClient.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelHostPort_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelHostPort.Text, 5, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 this.labelHostPort.Text = myKeyPad.StringValue;
 | |
|                 this.buttonSaveClient.Visible = true;
 | |
|             }
 | |
|         }
 | |
|         private void buttonStartClient_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             this.buttonStartClient.Enabled = true;
 | |
|             this.buttonStopClient.Enabled = true;
 | |
| 
 | |
|             this.ParentForm.ParentForm.EthernetClientConnect();
 | |
| 
 | |
|             this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.TryEthernetStart, "Client");
 | |
|         }
 | |
|         private void buttonStopClient_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             this.ParentForm.ParentForm.EthernetClientDisconnect();
 | |
|             this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.TryEthernetStop, "Client");
 | |
|         }
 | |
| 
 | |
|         // Local
 | |
|         private void labelLocalIP1_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalIP1.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelLocalIP1.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveLocal.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelLocalIP2_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalIP2.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelLocalIP2.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveLocal.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelLocalIP3_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalIP3.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelLocalIP3.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveLocal.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelLocalIP4_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalIP4.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelLocalIP4.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveLocal.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private void labelLocalSubnetMask1_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalSubnetMask1.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelLocalSubnetMask1.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveLocal.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelLocalSubnetMask2_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalSubnetMask2.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelLocalSubnetMask2.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveLocal.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelLocalSubnetMask3_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalSubnetMask3.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelLocalSubnetMask3.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveLocal.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelLocalSubnetMask4_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalSubnetMask4.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelLocalSubnetMask4.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveLocal.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private void labelLocalGateway1_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalGateway1.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelLocalGateway1.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveLocal.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelLocalGateway2_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalGateway2.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelLocalGateway2.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveLocal.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelLocalGateway3_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalGateway3.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelLocalGateway3.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveLocal.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void labelLocalGateway4_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string temp = "";
 | |
| 
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalGateway4.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.IntValue > 255)
 | |
|                 {
 | |
|                     temp = "0 ~ 255";
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE, temp);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelLocalGateway4.Text = myKeyPad.StringValue;
 | |
|                     this.buttonSaveLocal.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private void radioButtonLocalIpDHCP_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string before = "", after = "";
 | |
|             DialogFormYesNo myDlg;
 | |
| 
 | |
|             if (this.ParentForm.ParentForm.smartConfigs.IPSettings.DHCPEnable == 0)
 | |
|                 before = "Static";
 | |
|             else
 | |
|                 before = "DHCP";
 | |
| 
 | |
|             if (this.radioButtonLocalIpStatic.Checked == true)
 | |
|                 myDlg = new DialogFormYesNo(this.ParentForm.ParentForm.SystemConfig.LANGUAGE, 21); // 로컬IP주소 수동으로 설정하시겠습니까?
 | |
|             else
 | |
|                 myDlg = new DialogFormYesNo(this.ParentForm.ParentForm.SystemConfig.LANGUAGE, 22); // 로컬IP주소 자동으로 설정하시겠습니까?
 | |
| 
 | |
|             if (myDlg.ShowDialog() == DialogResult.Yes)
 | |
|             {
 | |
|                 if (this.radioButtonLocalIpDHCP.Checked == true)
 | |
|                 {
 | |
|                     this.ParentForm.ParentForm.smartConfigs.IPSettings.DHCPEnable = 1;
 | |
| 
 | |
|                     this.LocalIPEnable(false);
 | |
|                     this.UpdateLocalIPAddressDisplay();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.ParentForm.ParentForm.smartConfigs.IPSettings.DHCPEnable = 0;
 | |
| 
 | |
|                     this.LocalIPEnable(true);
 | |
| 
 | |
|                     try
 | |
|                     {
 | |
|                         this.UpdateLocalIPAddressDisplay();
 | |
|                     }
 | |
|                     catch
 | |
|                     {
 | |
|                         this.ParentForm.ParentForm.smartConfigs.IPSettings.DeviceIP = "192.168.3.10";
 | |
|                         this.ParentForm.ParentForm.smartConfigs.IPSettings.SubNetMask = "255.255.255.0";
 | |
|                         this.ParentForm.ParentForm.smartConfigs.IPSettings.GateWay = "192.168.3.1";
 | |
| 
 | |
|                         this.UpdateLocalIPAddressDisplay();
 | |
|                     }
 | |
|                 }
 | |
| 
 | |
|                 this.ParentForm.ParentForm.smartConfigs.IPSettings.Save();
 | |
|                 this.ParentForm.ParentForm.smartConfigs.IPSettings.SetApply();
 | |
| 
 | |
|                 if (this.ParentForm.ParentForm.smartConfigs.IPSettings.DHCPEnable == 0)
 | |
|                     after = "Static";
 | |
|                 else
 | |
|                     after = "DHCP";
 | |
| 
 | |
|                 this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.TCPLocalIPConfig, "", before, after);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 this.DisplayRefresh();
 | |
|             }
 | |
|         }
 | |
|         private void labelMACAddress_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             SmartX.SmartLabel label = sender as SmartX.SmartLabel;
 | |
| 
 | |
|             DialogFormHexKeyPad myKeyPad = new DialogFormHexKeyPad(label.Text, 2, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 label.Text = myKeyPad.StringValue;
 | |
|                 this.buttonSaveLocal.Visible = true;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private void buttonSaveLocal_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string beforeIP = "", afterIP = "";
 | |
|             string beforeSubnetMask = "", afterSubnetMask = "";
 | |
|             string beforeGateway = "", afterGateway = "";
 | |
| 
 | |
|             this.buttonSaveLocal.Visible = false;
 | |
| 
 | |
|             byte[] changeMAC = new byte[6];
 | |
| 
 | |
|             changeMAC[0] = Convert.ToByte(this.HexArray[0], 16);
 | |
|             changeMAC[1] = Convert.ToByte(this.HexArray[1], 16);
 | |
|             changeMAC[2] = Convert.ToByte(this.HexArray[2], 16);
 | |
|             changeMAC[3] = Convert.ToByte(this.labelMACAddress4.Text, 16);
 | |
|             changeMAC[4] = Convert.ToByte(this.labelMACAddress5.Text, 16);
 | |
|             changeMAC[5] = Convert.ToByte(this.labelMACAddress6.Text, 16);
 | |
| 
 | |
|             this.ParentForm.ParentForm.smartConfigs.IPSettings.SetMACAddress(changeMAC);
 | |
| 
 | |
|             beforeIP = this.ParentForm.ParentForm.smartConfigs.IPSettings.DeviceIP;
 | |
|             beforeSubnetMask = this.ParentForm.ParentForm.smartConfigs.IPSettings.SubNetMask;
 | |
|             beforeGateway = this.ParentForm.ParentForm.smartConfigs.IPSettings.GateWay;
 | |
| 
 | |
|             if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE == 1)
 | |
|                 this.ParentForm.ParentForm.EthernetServerStop();
 | |
|             else if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE == 2)
 | |
|                 this.ParentForm.ParentForm.EthernetClientDisconnect();
 | |
| 
 | |
|             this.ParentForm.ParentForm.smartConfigs.IPSettings.DeviceIP = string.Format("{0}.{1}.{2}.{3}",
 | |
|                 this.labelLocalIP1.Text, this.labelLocalIP2.Text, this.labelLocalIP3.Text, this.labelLocalIP4.Text);
 | |
|             this.ParentForm.ParentForm.smartConfigs.IPSettings.SubNetMask = string.Format("{0}.{1}.{2}.{3}",
 | |
|                 this.labelLocalSubnetMask1.Text, this.labelLocalSubnetMask2.Text, this.labelLocalSubnetMask3.Text, this.labelLocalSubnetMask4.Text);
 | |
|             this.ParentForm.ParentForm.smartConfigs.IPSettings.GateWay = string.Format("{0}.{1}.{2}.{3}",
 | |
|                 this.labelLocalGateway1.Text, this.labelLocalGateway2.Text, this.labelLocalGateway3.Text, this.labelLocalGateway4.Text);
 | |
| 
 | |
|             afterIP = this.ParentForm.ParentForm.smartConfigs.IPSettings.DeviceIP;
 | |
|             afterSubnetMask = this.ParentForm.ParentForm.smartConfigs.IPSettings.SubNetMask;
 | |
|             afterGateway = this.ParentForm.ParentForm.smartConfigs.IPSettings.GateWay;
 | |
| 
 | |
|             this.ParentForm.ParentForm.smartConfigs.IPSettings.Save();
 | |
|             this.ParentForm.ParentForm.smartConfigs.IPSettings.SetApply();
 | |
| 
 | |
|             if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE == 1)
 | |
|                 this.ParentForm.ParentForm.EthernetServerStart();
 | |
|             else if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE == 2)
 | |
|                 this.ParentForm.ParentForm.EthernetClientConnect();
 | |
| 
 | |
|             if (beforeIP != afterIP)
 | |
|                 this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.TCPLocalIPAddress, "", beforeIP, afterIP);
 | |
|             if (beforeSubnetMask != afterSubnetMask)
 | |
|                 this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.TCPLocalSubnetMask, "", beforeSubnetMask, afterSubnetMask);
 | |
|             if (beforeGateway != afterGateway)
 | |
|                 this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.TCPLocalGateway, "", beforeGateway, afterGateway);
 | |
|         }
 | |
| 
 | |
|         // Modbus Settings
 | |
|         private void labelStartAddress_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelStartAddress.Text, 5, 0, false, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
| 
 | |
|             if (myKeyPad.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 99999)
 | |
|                 {
 | |
|                     // 입력범위를 확인하세요
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.labelStartAddress.Text = myKeyPad.StringValue;
 | |
| 
 | |
|                     if (this.buttonSaveModbus.Visible == false)
 | |
|                         this.buttonSaveModbus.Visible = true;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void buttonSaveModbus_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string before = "", after = "";
 | |
| 
 | |
|             before = this.ParentForm.ParentForm.SystemConfig.MODBUS_TCP_START_ADDRESS.ToString();
 | |
|             this.ParentForm.ParentForm.SystemConfig.MODBUS_TCP_START_ADDRESS = int.Parse(this.labelStartAddress.Text);
 | |
|             after = this.labelStartAddress.Text;
 | |
| 
 | |
|             if (before != after)
 | |
|                 this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.Mod_StartAddr, "TCP", before, after);
 | |
| 
 | |
|             this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig);
 | |
| 
 | |
|             this.buttonSaveModbus.Visible = false;
 | |
|         }
 | |
| 
 | |
|         private void timerServer_Tick(object sender, EventArgs e)
 | |
|         {
 | |
|             if (this.ParentForm.ParentForm.smartTCPMultiServer.IsStart == true)
 | |
|             {
 | |
|                 if (this.labelServerStatus.Text != ">Start")
 | |
|                     this.labelServerStatus.Text = ">Start";
 | |
| 
 | |
|                 if (this.IsServerON == false)
 | |
|                 {
 | |
|                     this.IsServerON = true;
 | |
|                     this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.ServerON, "");
 | |
|                 }
 | |
| 
 | |
|                 this.labelConnectedIP.Text = "-";
 | |
|                 this.smartListBoxClientList.ClearAll();
 | |
|                 this.labelClientCount.Text = "-";
 | |
| 
 | |
|                 if (this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList != null)
 | |
|                 {
 | |
|                     int length = this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList.Length;
 | |
|                     for (int i = 0; i < length; i++)
 | |
|                     {
 | |
|                         this.smartListBoxClientList.AddItem(
 | |
|                             this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList[i].strID + ", " +
 | |
|                             this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList[i].strIPAddress);
 | |
|                     }
 | |
| 
 | |
|                     this.labelClientCount.Text = length.ToString();
 | |
|                     if (this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList == null)
 | |
|                         this.labelConnectedIP.Text = "-";
 | |
|                     else
 | |
|                         this.labelConnectedIP.Text = this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList[0].strIPAddress;
 | |
|                 }
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 if (this.labelServerStatus.Text != ">Stop")
 | |
|                     this.labelServerStatus.Text = ">Stop";
 | |
| 
 | |
|                 if (this.IsServerON == true)
 | |
|                 {
 | |
|                     this.IsServerON = false;
 | |
|                     this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.ServerOFF, "");
 | |
|                 }
 | |
| 
 | |
|                 this.smartListBoxClientList.ClearAll();
 | |
|                 this.labelClientCount.Text = "-";
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| }
 |