private void State() { try { for (int i = 0; i < btnArray.Length; i++) { if (Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_EM_B, btnArray[i].StateAddress) == 1) { btnArray[i].BackColor = Color.GreenYellow; } else { btnArray[i].BackColor = Color.FromArgb(212, 208, 200); } } for (int i = 0; i < lblArray.Length; i++) { lblArray[i].Text = DoubleConvert.Dint_to_Real((uint)Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_EM, lblArray[i].StateAddress) , (uint)Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_EM, lblArray[i].Address)).ToString("0.00"); Thread.Sleep(10); } } catch (Exception ex) { LogHelper.WriteLog(ex); //MessageBox.Show(ex.ToString()); } }
private void InfoDisplay() { for (int i = 0; i < lblArray.Length; i++) { lblArray[i].Text = DoubleConvert.Dint_to_Real((uint)Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_EM, lblArray[i].StateAddress) , (uint)Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_EM, lblArray[i].Address)).ToString("0.00"); Thread.Sleep(10); } }
/// <summary> /// 界面显示 /// </summary> private void Display() { try { for (int i = 0; i < lblArray.Length; i++) { lblArray[i].Text = DoubleConvert.Dint_to_Real((uint)Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_EM, lblArray[i].StateAddress) , (uint)Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_EM, lblArray[i].Address)).ToString("0.00"); Thread.Sleep(10); } for (int i = 0; i < btnArray.Length; i++) { if ((Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_RLY_B, btnArray[i].StateAddress) == 1)) { if (btnArray[i].StateAddress == "162112") { if (Global.workState) { btnArray[i].BackColor = Color.Green; } else { btnArray[i].BackColor = Color.Red; } } else { btnArray[i].BackColor = Color.Green; } } else { btnArray[i].BackColor = Color.Red; } } } catch (Exception ex) { LogHelper.WriteLog(ex); for (int i = 0; i < lblArray.Length; i++) { lblArray[i].Text = "erro"; } } }
private void State() { try { for (int i = 0; i < lblArray.Length; i++) { lblArray[i].Text = DoubleConvert.Dint_to_Real((uint)Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_EM, lblArray[i].StateAddress) , (uint)Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_EM, lblArray[i].Address)).ToString("0.00"); } for (int i = 0; i < btnArray.Length; i++) { if (Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_EM_B, btnArray[i].StateAddress) == 1) { btnArray[i].BackColor = Color.GreenYellow; } else { btnArray[i].BackColor = Color.FromArgb(212, 208, 200); } } switch (Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_DM, LblTestPhase.Address)) { case 1: LblTestPhase.Text = "A相"; break; case 2: LblTestPhase.Text = "B相"; break; case 3: LblTestPhase.Text = "C相"; break; default: break; } } catch (Exception ex) { LogHelper.WriteLog(ex); } }
/// <summary> /// 界面显示 /// </summary> private void Display() { try { for (int i = 0; i < lblArray.Length; i++) { lblArray[i].Text = DoubleConvert.Dint_to_Real((uint)Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_EM, lblArray[i].StateAddress) , (uint)Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_EM, lblArray[i].Address)).ToString("0.00"); } for (int i = 0; i < btnArray.Length; i++) { if ((Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_RLY_B, btnArray[i].StateAddress) == 1)) { if (btnArray[i].StateAddress == "142112") { if (Global.workState) { btnArray[i].BackColor = Color.Green; } else { btnArray[i].BackColor = Color.Red; } } else { btnArray[i].BackColor = Color.Green; } } else { btnArray[i].BackColor = Color.Red; } } switch (Global.kv.ReadMemory(DATABUILDERAXLibLB.DBPlcDevice.DKV7K_DM, LblTestPhase.Address)) { case 1: LblTestPhase.Text = "A相"; break; case 2: LblTestPhase.Text = "B相"; break; case 3: LblTestPhase.Text = "C相"; break; default: break; } } catch (Exception ex) { LogHelper.WriteLog(ex); for (int i = 0; i < lblArray.Length; i++) { lblArray[i].Text = "erro"; } } }