522 lines
26 KiB
C#
522 lines
26 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.ObjectModel;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
using ITC81DB_0H.Forms;
|
|
using ITC81DB_2H_ImageDll;
|
|
using SmartX;
|
|
using ITC81DB_2H.Datastore;
|
|
|
|
namespace ITC81DB_0H.Controls
|
|
{
|
|
public partial class ControlMainDisplayModbus : UserControl
|
|
{
|
|
#region Field
|
|
private FormMainDisplay m_ParentForm;
|
|
private UInt32 ReceiveCount;
|
|
private static int ModbusCount = 20;
|
|
|
|
private Collection<SmartLabel> CollectionOffset;
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public ControlMainDisplayModbus(FormMainDisplay parent)
|
|
{
|
|
InitializeComponent();
|
|
|
|
this.ParentForm = parent;
|
|
|
|
this.InitializeDesign();
|
|
this.DefaultSetting();
|
|
}
|
|
#endregion
|
|
|
|
#region Property
|
|
public FormMainDisplay ParentForm
|
|
{
|
|
get { return this.m_ParentForm; }
|
|
private set { this.m_ParentForm = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Method
|
|
public void InitializeDesign()
|
|
{
|
|
Class1 images = new Class1();
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.English)
|
|
{
|
|
#region 영문
|
|
this.labelTitlePort.Text = "Port";
|
|
this.labelTitleStartAddr.Text = "Start Addr";
|
|
this.labelTitleReceiveCount.Text = "Receive";
|
|
|
|
this.labelTitleOffset1.Text = this.labelTitleOffset2.Text = this.labelTitleOffset3.Text = "Offset";
|
|
this.labelTitleContents1.Text = this.labelTitleContents2.Text = this.labelTitleContents3.Text = "Contents";
|
|
this.labelTitleValue1.Text = this.labelTitleValue2.Text = this.labelTitleValue3.Text = "Value";
|
|
|
|
this.labelContents1.Text = "Update Flag";
|
|
this.labelContents2.Text = "Equip-ID";
|
|
this.labelContents3.Text = "Current No.";
|
|
this.labelContents4.Text = "Under Value";
|
|
this.labelContents5.Text = "Pass Value";
|
|
this.labelContents6.Text = "Over Value";
|
|
this.labelContents7.Text = "Tare Value";
|
|
this.labelContents8.Text = "Under Count";
|
|
this.labelContents9.Text = "Pass Count";
|
|
this.labelContents10.Text = "Over Count";
|
|
this.labelContents11.Text = "Faulty Count";
|
|
this.labelContents12.Text = "ExNG Count";
|
|
this.labelContents13.Text = "Total Count";
|
|
this.labelContents14.Text = "Grade";
|
|
this.labelContents15.Text = "Weight";
|
|
this.labelContents16.Text = "Operation";
|
|
this.labelContents17.Text = "Alarm";
|
|
this.labelContents18.Text = "Speed(ea/m)";
|
|
this.labelContents19.Text = "Metal Count";
|
|
this.labelContents20.Text = "Double Count";
|
|
|
|
this.labelHelp.Text = "※ Grade 0:Over, 1:Pass, 2:Under, 3:Metal, 4:Double, 5:ETC";
|
|
#endregion
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
|
|
{
|
|
#region 중문
|
|
this.labelTitlePort.Text = "Port";
|
|
this.labelTitleStartAddr.Text = "Start Addr";
|
|
this.labelTitleReceiveCount.Text = "Receive";
|
|
|
|
this.labelTitleOffset1.Text = this.labelTitleOffset2.Text = this.labelTitleOffset3.Text = "Offset";
|
|
this.labelTitleContents1.Text = this.labelTitleContents2.Text = this.labelTitleContents3.Text = "Contents";
|
|
this.labelTitleValue1.Text = this.labelTitleValue2.Text = this.labelTitleValue3.Text = "Value";
|
|
|
|
this.labelContents1.Text = "Update Flag";
|
|
this.labelContents2.Text = "Equip-ID";
|
|
this.labelContents3.Text = "Current No.";
|
|
this.labelContents4.Text = "Under Value";
|
|
this.labelContents5.Text = "Pass Value";
|
|
this.labelContents6.Text = "Over Value";
|
|
this.labelContents7.Text = "Tare Value";
|
|
this.labelContents8.Text = "Under Count";
|
|
this.labelContents9.Text = "Pass Count";
|
|
this.labelContents10.Text = "Over Count";
|
|
this.labelContents11.Text = "Faulty Count";
|
|
this.labelContents12.Text = "ExNG Count";
|
|
this.labelContents13.Text = "Total Count";
|
|
this.labelContents14.Text = "Grade";
|
|
this.labelContents15.Text = "Weight";
|
|
this.labelContents16.Text = "Operation";
|
|
this.labelContents17.Text = "Alarm";
|
|
this.labelContents18.Text = "Speed(ea/m)";
|
|
this.labelContents19.Text = "Metal Count";
|
|
this.labelContents20.Text = "Double Count";
|
|
|
|
this.labelHelp.Text = "※ Grade 0:Over, 1:Pass, 2:Under, 3:Metal, 4:Double, 5:ETC";
|
|
#endregion
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Czech)
|
|
{
|
|
#region 체코어
|
|
this.labelTitlePort.Text = "Port";
|
|
this.labelTitleStartAddr.Text = "Start Addr";
|
|
this.labelTitleReceiveCount.Text = "Receive";
|
|
|
|
this.labelTitleOffset1.Text = this.labelTitleOffset2.Text = this.labelTitleOffset3.Text = "Offset";
|
|
this.labelTitleContents1.Text = this.labelTitleContents2.Text = this.labelTitleContents3.Text = "Contents";
|
|
this.labelTitleValue1.Text = this.labelTitleValue2.Text = this.labelTitleValue3.Text = "Value";
|
|
|
|
this.labelContents1.Text = "Update Flag";
|
|
this.labelContents2.Text = "Equip-ID";
|
|
this.labelContents3.Text = "Current No.";
|
|
this.labelContents4.Text = "Under Value";
|
|
this.labelContents5.Text = "Pass Value";
|
|
this.labelContents6.Text = "Over Value";
|
|
this.labelContents7.Text = "Tare Value";
|
|
this.labelContents8.Text = "Under Count";
|
|
this.labelContents9.Text = "Pass Count";
|
|
this.labelContents10.Text = "Over Count";
|
|
this.labelContents11.Text = "Faulty Count";
|
|
this.labelContents12.Text = "ExNG Count";
|
|
this.labelContents13.Text = "Total Count";
|
|
this.labelContents14.Text = "Grade";
|
|
this.labelContents15.Text = "Weight";
|
|
this.labelContents16.Text = "Operation";
|
|
this.labelContents17.Text = "Alarm";
|
|
this.labelContents18.Text = "Speed(ea/m)";
|
|
this.labelContents19.Text = "Metal Count";
|
|
this.labelContents20.Text = "Double Count";
|
|
|
|
this.labelHelp.Text = "※ Grade 0:Over, 1:Pass, 2:Under, 3:Metal, 4:Double, 5:ETC";
|
|
#endregion
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Russian)
|
|
{
|
|
#region 러시아어
|
|
this.labelTitlePort.Text = "Port";
|
|
this.labelTitleStartAddr.Text = "Start Addr";
|
|
this.labelTitleReceiveCount.Text = "Receive";
|
|
|
|
this.labelTitleOffset1.Text = this.labelTitleOffset2.Text = this.labelTitleOffset3.Text = "Offset";
|
|
this.labelTitleContents1.Text = this.labelTitleContents2.Text = this.labelTitleContents3.Text = "Contents";
|
|
this.labelTitleValue1.Text = this.labelTitleValue2.Text = this.labelTitleValue3.Text = "Value";
|
|
|
|
this.labelContents1.Text = "Update Flag";
|
|
this.labelContents2.Text = "Equip-ID";
|
|
this.labelContents3.Text = "Current No.";
|
|
this.labelContents4.Text = "Under Value";
|
|
this.labelContents5.Text = "Pass Value";
|
|
this.labelContents6.Text = "Over Value";
|
|
this.labelContents7.Text = "Tare Value";
|
|
this.labelContents8.Text = "Under Count";
|
|
this.labelContents9.Text = "Pass Count";
|
|
this.labelContents10.Text = "Over Count";
|
|
this.labelContents11.Text = "Faulty Count";
|
|
this.labelContents12.Text = "ExNG Count";
|
|
this.labelContents13.Text = "Total Count";
|
|
this.labelContents14.Text = "Grade";
|
|
this.labelContents15.Text = "Weight";
|
|
this.labelContents16.Text = "Operation";
|
|
this.labelContents17.Text = "Alarm";
|
|
this.labelContents18.Text = "Speed(ea/m)";
|
|
this.labelContents19.Text = "Metal Count";
|
|
this.labelContents20.Text = "Double Count";
|
|
|
|
this.labelHelp.Text = "※ Grade 0:Over, 1:Pass, 2:Under, 3:Metal, 4:Double, 5:ETC";
|
|
#endregion
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German)
|
|
{
|
|
#region 독일어
|
|
this.labelTitlePort.Text = "Port";
|
|
this.labelTitleStartAddr.Text = "Start Addr";
|
|
this.labelTitleReceiveCount.Text = "Receive";
|
|
|
|
this.labelTitleOffset1.Text = this.labelTitleOffset2.Text = this.labelTitleOffset3.Text = "Offset";
|
|
this.labelTitleContents1.Text = this.labelTitleContents2.Text = this.labelTitleContents3.Text = "Contents";
|
|
this.labelTitleValue1.Text = this.labelTitleValue2.Text = this.labelTitleValue3.Text = "Value";
|
|
|
|
this.labelContents1.Text = "Update Flag";
|
|
this.labelContents2.Text = "Equip-ID";
|
|
this.labelContents3.Text = "Current No.";
|
|
this.labelContents4.Text = "Under Value";
|
|
this.labelContents5.Text = "Pass Value";
|
|
this.labelContents6.Text = "Over Value";
|
|
this.labelContents7.Text = "Tare Value";
|
|
this.labelContents8.Text = "Under Count";
|
|
this.labelContents9.Text = "Pass Count";
|
|
this.labelContents10.Text = "Over Count";
|
|
this.labelContents11.Text = "Faulty Count";
|
|
this.labelContents12.Text = "ExNG Count";
|
|
this.labelContents13.Text = "Total Count";
|
|
this.labelContents14.Text = "Grade";
|
|
this.labelContents15.Text = "Weight";
|
|
this.labelContents16.Text = "Operation";
|
|
this.labelContents17.Text = "Alarm";
|
|
this.labelContents18.Text = "Speed(ea/m)";
|
|
this.labelContents19.Text = "Metal Count";
|
|
this.labelContents20.Text = "Double Count";
|
|
|
|
this.labelHelp.Text = "※ Grade 0:Over, 1:Pass, 2:Under, 3:Metal, 4:Double, 5:ETC";
|
|
#endregion
|
|
}
|
|
else
|
|
{
|
|
#region 한글
|
|
this.labelTitlePort.Text = "Port";
|
|
this.labelTitleStartAddr.Text = "Start Addr";
|
|
this.labelTitleReceiveCount.Text = "Receive";
|
|
|
|
this.labelTitleOffset1.Text = this.labelTitleOffset2.Text = this.labelTitleOffset3.Text = "Offset";
|
|
this.labelTitleContents1.Text = this.labelTitleContents2.Text = this.labelTitleContents3.Text = "항목";
|
|
this.labelTitleValue1.Text = this.labelTitleValue2.Text = this.labelTitleValue3.Text = "Value";
|
|
|
|
this.labelContents1.Text = "갱신 Flag";
|
|
this.labelContents2.Text = "장비 ID";
|
|
this.labelContents3.Text = "현재 품번";
|
|
this.labelContents4.Text = "하한값";
|
|
this.labelContents5.Text = "기준값";
|
|
this.labelContents6.Text = "상한값";
|
|
this.labelContents7.Text = "용기값";
|
|
this.labelContents8.Text = "경량 개수";
|
|
this.labelContents9.Text = "정량 개수";
|
|
this.labelContents10.Text = "과량 개수";
|
|
this.labelContents11.Text = "불량 개수";
|
|
this.labelContents12.Text = "기타불량 개수";
|
|
this.labelContents13.Text = "총 개수";
|
|
this.labelContents14.Text = "판정등급";
|
|
this.labelContents15.Text = "현재 중량값";
|
|
this.labelContents16.Text = "운전 상태";
|
|
this.labelContents17.Text = "알람 상태";
|
|
this.labelContents18.Text = "속도(ea/m)";
|
|
this.labelContents19.Text = "금속검출 개수";
|
|
this.labelContents20.Text = "이중진입 개수";
|
|
|
|
this.labelHelp.Text = "※ 판정등급 0:과량, 1:정량, 2:경량, 3:금속검출, 4:이중진입, 5:기타";
|
|
#endregion
|
|
}
|
|
}
|
|
private void DefaultSetting()
|
|
{
|
|
this.CollectionOffset = new Collection<SmartLabel>();
|
|
this.CollectionOffset.Clear();
|
|
this.CollectionOffset.Add(this.labelOffset1);
|
|
this.CollectionOffset.Add(this.labelOffset2);
|
|
this.CollectionOffset.Add(this.labelOffset3);
|
|
this.CollectionOffset.Add(this.labelOffset4);
|
|
this.CollectionOffset.Add(this.labelOffset5);
|
|
this.CollectionOffset.Add(this.labelOffset6);
|
|
this.CollectionOffset.Add(this.labelOffset7);
|
|
this.CollectionOffset.Add(this.labelOffset8);
|
|
this.CollectionOffset.Add(this.labelOffset9);
|
|
this.CollectionOffset.Add(this.labelOffset10);
|
|
this.CollectionOffset.Add(this.labelOffset11);
|
|
this.CollectionOffset.Add(this.labelOffset12);
|
|
this.CollectionOffset.Add(this.labelOffset13);
|
|
this.CollectionOffset.Add(this.labelOffset14);
|
|
this.CollectionOffset.Add(this.labelOffset15);
|
|
this.CollectionOffset.Add(this.labelOffset16);
|
|
this.CollectionOffset.Add(this.labelOffset17);
|
|
this.CollectionOffset.Add(this.labelOffset18);
|
|
this.CollectionOffset.Add(this.labelOffset19);
|
|
this.CollectionOffset.Add(this.labelOffset20);
|
|
|
|
this.buttonBypassDirection.ButtonUp();
|
|
|
|
this.ReceiveCount = 0;
|
|
this.labelReceiveCount.Text = this.ReceiveCount.ToString();
|
|
|
|
this.labelUpdateFlag.Text = "";
|
|
this.labelEquipmentID.Text = "";
|
|
this.labelCurrentNo.Text = "";
|
|
|
|
this.labelUnder.Text = "";
|
|
this.labelPass.Text = "";
|
|
this.labelOver.Text = "";
|
|
this.labelTare.Text = "";
|
|
|
|
this.labelUnderCount.Text = "";
|
|
this.labelPassCount.Text = "";
|
|
this.labelOverCount.Text = "";
|
|
this.labelNGCount.Text = "";
|
|
this.labelExNGCount.Text = "";
|
|
this.labelTotalCount.Text = "";
|
|
|
|
this.labelGrade.Text = "";
|
|
this.labelWeight.Text = "";
|
|
this.labelOperationStatus.Text = "";
|
|
this.labelAlarmStatus.Text = "";
|
|
this.labelSpeed.Text = "";
|
|
this.labelMetal.Text = "";
|
|
this.labelDouble.Text = "";
|
|
}
|
|
|
|
public void UpdateEquipmentStatusDisplay(Define.E_EquipmentStatus status)
|
|
{
|
|
|
|
}
|
|
public void UpdateReceiveCount()
|
|
{
|
|
if (this.ReceiveCount > 999999999)
|
|
this.ReceiveCount = 0;
|
|
else
|
|
{
|
|
this.ReceiveCount++;
|
|
this.labelReceiveCount.Text = this.ReceiveCount.ToString();
|
|
}
|
|
}
|
|
public void UpdateData(_30000_ModbusData mData)
|
|
{
|
|
if (this.buttonBypassDirection.ButtonStatus == SmartX.SmartButton.BUTSTATUS.UP)
|
|
{
|
|
this.labelUpdateFlag.Text = mData.IsUpdate.ToString();
|
|
this.labelEquipmentID.Text = mData.EquipmentID.ToString();
|
|
this.labelCurrentNo.Text = mData.ProductNo.ToString();
|
|
|
|
if(mData.UnderValue.ToString().Contains('.') == false)
|
|
this.labelUnder.Text = Helper.StringToDecimalPlacesPlusZero(mData.UnderValue.ToString(), this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
|
|
else
|
|
this.labelUnder.Text = mData.UnderValue.ToString();
|
|
if (mData.PassValue.ToString().Contains('.') == false)
|
|
this.labelPass.Text = Helper.StringToDecimalPlacesPlusZero(mData.PassValue.ToString(), this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
|
|
else
|
|
this.labelPass.Text = mData.PassValue.ToString();
|
|
if (mData.OverValue.ToString().Contains('.') == false)
|
|
this.labelOver.Text = Helper.StringToDecimalPlacesPlusZero(mData.OverValue.ToString(), this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
|
|
else
|
|
this.labelOver.Text = mData.OverValue.ToString();
|
|
if (mData.TareValue.ToString().Contains('.') == false)
|
|
this.labelTare.Text = Helper.StringToDecimalPlacesPlusZero(mData.TareValue.ToString(), this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
|
|
else
|
|
this.labelTare.Text = mData.TareValue.ToString();
|
|
|
|
this.labelUnderCount.Text = mData.UnderCount.ToString();
|
|
this.labelPassCount.Text = mData.PassCount.ToString();
|
|
this.labelOverCount.Text = mData.OverCount.ToString();
|
|
this.labelNGCount.Text = mData.NGCount.ToString();
|
|
this.labelExNGCount.Text = mData.ExNGCount.ToString();
|
|
this.labelTotalCount.Text = mData.TotalCount.ToString();
|
|
|
|
this.labelGrade.Text = mData.Grade.ToString();
|
|
if (mData.Weight.ToString().Contains('.') == false)
|
|
this.labelWeight.Text = Helper.StringToDecimalPlacesPlusZero(mData.Weight.ToString(), this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
|
|
else
|
|
this.labelWeight.Text = mData.Weight.ToString();
|
|
this.labelOperationStatus.Text = mData.OperationStatus.ToString();
|
|
this.labelAlarmStatus.Text = mData.AlarmStatus.ToString();
|
|
this.labelSpeed.Text = mData.Speed.ToString();
|
|
this.labelMetal.Text = mData.MetalDetectionCount.ToString();
|
|
this.labelDouble.Text = mData.DoubleEntryCount.ToString();
|
|
}
|
|
else
|
|
{
|
|
this.labelUpdateFlag.Text = mData.HexStringIsUpdate;
|
|
this.labelEquipmentID.Text = mData.HexStringEquipmentID;
|
|
this.labelCurrentNo.Text = mData.HexStringProductNo;
|
|
|
|
this.labelUnder.Text = mData.HexStringUnderValue;
|
|
this.labelPass.Text = mData.HexStringPassValue;
|
|
this.labelOver.Text = mData.HexStringOverValue;
|
|
this.labelTare.Text = mData.HexStringTareValue;
|
|
|
|
this.labelUnderCount.Text = mData.HexStringUnderCount;
|
|
this.labelPassCount.Text = mData.HexStringPassCount;
|
|
this.labelOverCount.Text = mData.HexStringOverCount;
|
|
this.labelNGCount.Text = mData.HexStringNGCount;
|
|
this.labelExNGCount.Text = mData.HexStringExNGCount;
|
|
this.labelTotalCount.Text = mData.HexStringTotalCount;
|
|
|
|
this.labelGrade.Text = mData.HexStringGrade;
|
|
this.labelWeight.Text = mData.HexStringWeight;
|
|
this.labelOperationStatus.Text = mData.HexStringOperationStatus;
|
|
this.labelAlarmStatus.Text = mData.HexStringAlarmStatus;
|
|
this.labelSpeed.Text = mData.HexStringSpeed;
|
|
this.labelMetal.Text = mData.HexStringMetalDetectionCount;
|
|
this.labelDouble.Text = mData.HexStringDoubleEntryCount;
|
|
}
|
|
}
|
|
public void UpdateOffset(bool master, int startAddress)
|
|
{
|
|
if (master == true)
|
|
{
|
|
for (int i = 0; i < ModbusCount; i++)
|
|
{
|
|
this.CollectionOffset[i].Text = startAddress.ToString();
|
|
startAddress += 2;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
int address = 10;
|
|
for (int i = 0; i < ModbusCount; i++)
|
|
{
|
|
this.CollectionOffset[i].Text = "0x" + address.ToString("X4");
|
|
address += 2;
|
|
}
|
|
}
|
|
}
|
|
public void UpdateDisplay(string portName)
|
|
{
|
|
switch (portName)
|
|
{
|
|
case "COM1":
|
|
if (this.ParentForm.ParentForm.SystemConfig2.ModbusRTUSelectFunction == (int)Define.E_ModbusFunction._04_ReadInputRegister)
|
|
{
|
|
this.labelStartAddress.Text = "-";
|
|
this.UpdateOffset(false, this.ParentForm.ParentForm.SystemConfig2.ModbusRTUStartAddressCOM1);
|
|
}
|
|
else
|
|
{
|
|
this.labelStartAddress.Text = this.ParentForm.ParentForm.SystemConfig2.ModbusRTUStartAddressCOM1.ToString();
|
|
this.UpdateOffset(true, this.ParentForm.ParentForm.SystemConfig2.ModbusRTUStartAddressCOM1);
|
|
}
|
|
break;
|
|
case "COM3":
|
|
if (this.ParentForm.ParentForm.SystemConfig2.ModbusRTUSelectFunction == (int)Define.E_ModbusFunction._04_ReadInputRegister)
|
|
{
|
|
this.labelStartAddress.Text = "-";
|
|
this.UpdateOffset(false, this.ParentForm.ParentForm.SystemConfig2.ModbusRTUStartAddressCOM3);
|
|
}
|
|
else
|
|
{
|
|
this.labelStartAddress.Text = this.ParentForm.ParentForm.SystemConfig2.ModbusRTUStartAddressCOM3.ToString();
|
|
this.UpdateOffset(true, this.ParentForm.ParentForm.SystemConfig2.ModbusRTUStartAddressCOM3);
|
|
}
|
|
break;
|
|
case "COM4":
|
|
if (this.ParentForm.ParentForm.SystemConfig2.ModbusRTUSelectFunction == (int)Define.E_ModbusFunction._04_ReadInputRegister)
|
|
{
|
|
this.labelStartAddress.Text = "-";
|
|
this.UpdateOffset(false, this.ParentForm.ParentForm.SystemConfig2.ModbusRTUStartAddressCOM4);
|
|
}
|
|
else
|
|
{
|
|
this.labelStartAddress.Text = this.ParentForm.ParentForm.SystemConfig2.ModbusRTUStartAddressCOM4.ToString();
|
|
this.UpdateOffset(true, this.ParentForm.ParentForm.SystemConfig2.ModbusRTUStartAddressCOM4);
|
|
}
|
|
break;
|
|
case "TCP":
|
|
if (this.ParentForm.ParentForm.SystemConfig2.ModbusTCPSelectFunction == (int)Define.E_ModbusFunction._04_ReadInputRegister)
|
|
{
|
|
this.labelStartAddress.Text = "-";
|
|
this.UpdateOffset(false, this.ParentForm.ParentForm.SystemConfig2.ModbusTCPStartAddress);
|
|
}
|
|
else
|
|
{
|
|
this.labelStartAddress.Text = this.ParentForm.ParentForm.SystemConfig2.ModbusTCPStartAddress.ToString();
|
|
this.UpdateOffset(true, this.ParentForm.ParentForm.SystemConfig2.ModbusTCPStartAddress);
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void DisplayRefresh(SystemStatus status)
|
|
{
|
|
this.comboBoxPort.Items.Clear();
|
|
if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode == (int)Define.E_CommMode.f22_Modbus
|
|
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode == (int)Define.E_CommMode.f16_OPC)
|
|
this.comboBoxPort.Items.Add("COM1");
|
|
if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode == (int)Define.E_CommMode.f22_Modbus
|
|
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode == (int)Define.E_CommMode.f16_OPC)
|
|
this.comboBoxPort.Items.Add("COM3");
|
|
if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode == (int)Define.E_CommMode.f22_Modbus
|
|
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode == (int)Define.E_CommMode.f16_OPC)
|
|
this.comboBoxPort.Items.Add("COM4");
|
|
if (this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode == (int)Define.E_CommMode.f22_Modbus
|
|
|| this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode == (int)Define.E_CommMode.f16_OPC)
|
|
this.comboBoxPort.Items.Add("TCP");
|
|
this.comboBoxPort.SelectedIndex = 0;
|
|
|
|
this.UpdateDisplay(this.comboBoxPort.SelectedItem.ToString());
|
|
this.UpdateData(this.ParentForm.ParentForm.Current30000ModbusData);
|
|
}
|
|
#endregion
|
|
|
|
#region Event Handler
|
|
private void buttonBypassDirection_Click(object sender, EventArgs e)
|
|
{
|
|
// Automatic Logout Reset
|
|
if (this.ParentForm.ParentForm.SystemConfig3.IsPart11 == true)
|
|
this.ParentForm.Part11AutomaticLogoutReset();
|
|
|
|
this.UpdateData(this.ParentForm.ParentForm.Current30000ModbusData);
|
|
}
|
|
private void comboBoxPort_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// Automatic Logout Reset
|
|
if (this.ParentForm.ParentForm.SystemConfig3.IsPart11 == true)
|
|
this.ParentForm.Part11AutomaticLogoutReset();
|
|
|
|
this.UpdateDisplay(this.comboBoxPort.SelectedItem.ToString());
|
|
}
|
|
#endregion
|
|
}
|
|
}
|