private void OnGetData(string rawData)//Feedback Http request { var Obj01 = AdvantechHttpWebUtility.ParserJsonToObj <AllLogMsgData>(rawData); UpdateDevUIStatus(Obj01); // ExeRes.Res = ExeCaseRes.Pass; Print(ExeRes); this.InvokeWaitStep(); }
private void OnGetData(string rawData)//Feedback Http request { switch (servAct) { case ServiceAction.GetNetConfig: var Obj01 = AdvantechHttpWebUtility.ParserJsonToObj <SysData>(rawData); UpdateDevUIStatus(Obj01); // ExeRes.Res = ExeCaseRes.Pass; Print(ExeRes); this.InvokeWaitStep(); break; } }
private void OnGetData(string rawData)//Feedback Http request { switch (servAct) { case ServiceAction.GetNetConfig: var Obj01 = AdvantechHttpWebUtility.ParserJsonToObj <SysCoilData>(rawData); UpdateDevCoilStatus(Obj01); // ExeRes.Res = ExeCaseRes.Pass; Print(ExeRes); this.InvokeWaitStep(); break; case ServiceAction.PatchSysInfo: break; case ServiceAction.GetNetConfig_ag: var Obj03 = AdvantechHttpWebUtility.ParserJsonToObj <SysCoilData>(rawData); UpdateDevCoilStatus(Obj03); // ExeRes.Res = ExeCaseRes.Pass; Print(ExeRes); this.InvokeWaitStep(); break; // case ServiceAction.GetNetConfigforReg: var Obj04 = AdvantechHttpWebUtility.ParserJsonToObj <SysRegData>(rawData); UpdateDevRegStatus(Obj04); // ExeRes.Res = ExeCaseRes.Pass; Print(ExeRes); this.InvokeWaitStep(); break; case ServiceAction.PatchSysInfoforReg: break; case ServiceAction.GetNetConfig_ag_forReg: var Obj05 = AdvantechHttpWebUtility.ParserJsonToObj <SysRegData>(rawData); UpdateDevRegStatus(Obj05); // ExeRes.Res = ExeCaseRes.Pass; Print(ExeRes); this.InvokeWaitStep(); break; } }
private void OnGetData(string rawData)//Feedback Http request { switch (servAct) { case ServiceAction.GetNetConfig: if (GetRTUConfg) { var Obj02 = AdvantechHttpWebUtility.ParserJsonToObj <SysDataRTU>(rawData); UpdateDevUIStatusRTU(Obj02); } else { var Obj01 = AdvantechHttpWebUtility.ParserJsonToObj <SysData>(rawData); UpdateDevUIStatus(Obj01); } // ExeRes.Res = ExeCaseRes.Pass; Print(ExeRes); this.InvokeWaitStep(); break; case ServiceAction.PatchSysInfo: break; case ServiceAction.GetNetConfig_ag: if (GetRTUConfg) { var Obj04 = AdvantechHttpWebUtility.ParserJsonToObj <SysDataRTU>(rawData); UpdateDevUIStatusRTU(Obj04); } else { var Obj03 = AdvantechHttpWebUtility.ParserJsonToObj <SysData>(rawData); UpdateDevUIStatus(Obj03); } // ExeRes.Res = ExeCaseRes.Pass; Print(ExeRes); this.InvokeWaitStep(); break; } }
private void OnGetData(string rawData)//Feedback Http request { if (!Device.ConnFlg) { servAct = ServiceAction.Connection; //Priority High } switch (servAct) { case ServiceAction.Connection: var Obj01 = AdvantechHttpWebUtility.ParserJsonToObj <GetDeviceData>(rawData); UpdateDevUIStatus(Obj01); // ExeRes.Res = ExeCaseRes.Pass; Print(ExeRes); this.InvokeWaitStep(); break; case ServiceAction.GetSysInfo: var Obj02 = AdvantechHttpWebUtility.ParserJsonToObj <SysData>(rawData); UpdateSysInfoStatus(Obj02); // ExeRes.Res = ExeCaseRes.Pass; Print(ExeRes); this.InvokeWaitStep(); break; case ServiceAction.PatchSysInfo: break; case ServiceAction.GetSysInfo_ag: var Obj03 = AdvantechHttpWebUtility.ParserJsonToObj <SysData>(rawData); UpdateSysInfoStatus(Obj03); // ExeRes.Res = ExeCaseRes.Pass; Print(ExeRes); this.InvokeWaitStep(); break; } }
private void Form1_Load(object sender, EventArgs e) { //Get IO value m_HttpRequest = new AdvantechHttpWebUtility(); m_HttpRequest.ResquestOccurredError += this.OnGetHttpRequestError; m_HttpRequest.ResquestResponded += this.OnGetData; // Device = new DeviceModel()//20150626 建立一個DeviceModel給所有Service { IPAddress = textBox1.Text, Account = "root", Password = "******", Port = 80, SlotNum = 0, ModbusAddr = 1, ModbusTimeOut = 3000, }; // dataGridView1.ColumnHeadersVisible = true; DataGridViewTextBoxColumn newCol = new DataGridViewTextBoxColumn(); // add a column to the grid newCol.HeaderText = "Time"; newCol.Name = "clmTs"; newCol.Visible = true; newCol.Width = 50; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Method"; newCol.Name = "clmStp"; newCol.Visible = true; newCol.Width = 50; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Instruction"; newCol.Name = "clmIns"; newCol.Visible = true; newCol.Width = 100; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Description"; newCol.Name = "clmDes"; newCol.Visible = true; newCol.Width = 100; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Result"; newCol.Name = "clmRes"; newCol.Visible = true; newCol.Width = 80; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Error"; newCol.Name = "clmErr"; newCol.Visible = true; newCol.Width = 100; dataGridView1.Columns.Add(newCol); for (int i = 0; i < dataGridView1.Columns.Count - 1; i++) { dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } dataGridView1.Rows.Clear(); try { m_DataGridViewCtrlAddDataRow = new DataGridViewCtrlAddDataRow(DataGridViewCtrlAddNewRow); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } dataHld = new DataHandleService(); textBox1.Text = dataHld.GetPara(Application.StartupPath); //debug //GetNetConfigRequest(); }
private void Form1_Load(object sender, EventArgs e) { //Get IO value m_HttpRequest = new AdvantechHttpWebUtility(); m_HttpRequest.ResquestOccurredError += this.OnGetHttpRequestError; m_HttpRequest.ResquestResponded += this.OnGetData; // Device = new DeviceModel()//20150626 建立一個DeviceModel給所有Service { IPAddress = textBox1.Text, Account = "root", Password = "******", Port = 80, SlotNum = 0, ModbusAddr = 1, ModbusTimeOut = 3000, }; // dataGridView1.ColumnHeadersVisible = true; DataGridViewTextBoxColumn newCol = new DataGridViewTextBoxColumn(); // add a column to the grid newCol.HeaderText = "Time"; newCol.Name = "clmTs"; newCol.Visible = true; newCol.Width = 50; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Method"; newCol.Name = "clmStp"; newCol.Visible = true; newCol.Width = 50; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Instruction"; newCol.Name = "clmIns"; newCol.Visible = true; newCol.Width = 100; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Description"; newCol.Name = "clmDes"; newCol.Visible = true; newCol.Width = 100; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Result"; newCol.Name = "clmRes"; newCol.Visible = true; newCol.Width = 80; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Error"; newCol.Name = "clmErr"; newCol.Visible = true; newCol.Width = 100; dataGridView1.Columns.Add(newCol); for (int i = 0; i < dataGridView1.Columns.Count - 1; i++) { dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } dataGridView1.Rows.Clear(); try { m_DataGridViewCtrlAddDataRow = new DataGridViewCtrlAddDataRow(DataGridViewCtrlAddNewRow); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } dataHld = new DataHandleService(); textBox1.Text = dataHld.GetPara(Application.StartupPath); // // 取得本機名稱 string strHostName = Dns.GetHostName(); // 取得本機的IpHostEntry類別實體,MSDN建議新的用法 IPHostEntry iphostentry = Dns.GetHostEntry(strHostName); // 取得所有 IP 位址 System.Collections.ArrayList ipList = new System.Collections.ArrayList(); foreach (IPAddress ipaddress in iphostentry.AddressList) { // 只取得IP V4的Address if (ipaddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { ipList.Add(ipaddress.ToString()); //Console.WriteLine("Local IP: " + ipaddress.ToString()); } } //input //foreach (var item in ipList) //{ // ChangeDataArry[indx] = new SysChgData() { En = 1, Adr = (string)item }; // indx++; //} //for (int i = indx; i < 8; i++) //{ // ChangeDataArry[i] = new SysChgData() { En = 1, Adr = "192.168.1." + (i + 1).ToString() }; //} IpTable.Initialize(); foreach (var item in ipList) { IpTable[indx] = (string)item; indx++; } for (int i = indx; i < 8; i++) { IpTable[i] = "192.168.1." + (i + 1).ToString(); } }
private void Form1_Load(object sender, EventArgs e) { //Get IO value m_HttpRequest = new AdvantechHttpWebUtility(); m_HttpRequest.ResquestOccurredError += this.OnGetHttpRequestError; m_HttpRequest.ResquestResponded += this.OnGetData; // dataGridView1.ColumnHeadersVisible = true; DataGridViewTextBoxColumn newCol = new DataGridViewTextBoxColumn(); // add a column to the grid newCol.HeaderText = "Time"; newCol.Name = "clmTs"; newCol.Visible = true; newCol.Width = 50; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Method"; newCol.Name = "clmStp"; newCol.Visible = true; newCol.Width = 50; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Instruction"; newCol.Name = "clmIns"; newCol.Visible = true; newCol.Width = 100; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Description"; newCol.Name = "clmDes"; newCol.Visible = true; newCol.Width = 100; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Result"; newCol.Name = "clmRes"; newCol.Visible = true; newCol.Width = 80; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Error"; newCol.Name = "clmErr"; newCol.Visible = true; newCol.Width = 100; dataGridView1.Columns.Add(newCol); for (int i = 0; i < dataGridView1.Columns.Count - 1; i++) { dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } dataGridView1.Rows.Clear(); try { m_DataGridViewCtrlAddDataRow = new DataGridViewCtrlAddDataRow(DataGridViewCtrlAddNewRow); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } dataHld = new DataHandleService(); textBox1.Text = dataHld.GetPara(Application.StartupPath); //debug //button1.Text = HttpReq_Connet() ? "Connected" : "Disconnected"; }