using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using ITC81DB.Forms;
using ITC81DB_ImageDll;
using ITC81DB.DialogForms;
namespace ITC81DB.Controls
{
public partial class ControlCenterConfiSerial : UserControl
{
#region Field
private static int ModeSTD2 = 4;
private FormMenu m_ParentForm;
public ControlConfiSerialUserDefine ControlUserDefine;
public ControlConfiHitachi ControlHitachi;
public ControlConfiMarkoPrint ControlMarkoprint;
public ControlConfiSerialBarcode ControlBarcode;
public ControlConfiModbus ControlModbusRTU;
public ControlConfiMULTiJET ControlMultiJet;
#endregion
#region Constructor
public ControlCenterConfiSerial(FormMenu parent)
{
InitializeComponent();
this.ParentForm = parent;
this.InitializeDesign();
this.DefaultSetting();
}
#endregion
#region Property
public FormMenu 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 == DataStore.LanguageID.English)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundSerialSaparate));
this.buttonTransmitCondition.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engPassUp));
this.buttonTransmitCondition.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engEveryUp));
this.smartLabel2.Text = "- U : Under range, R : Reference, O : Over range";
this.smartLabel3.Text = "- G, Grd : Grade, W : Weight, CNT : Count, Chk : Checksum";
this.labelTitleTransmissionDelayTime.Text = "Transmission delay time(ms)";
this.labelTitleCommControlCharacter.Text = "Com- control character";
this.labelTitleCharacterToFill.Text = "Character to fill in the weight value blank";
this.labelTitleTransmitCondition.Text = "Transmission conditions";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundSerialSeparate));
this.buttonTransmitCondition.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engPassUp));
this.buttonTransmitCondition.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engEveryUp));
this.smartLabel2.Text = "- U : 低于, R : 通过, O : 超过";
this.smartLabel3.Text = "- G, Grd : 等级, W : 重量, CNT : 计数, Chk : 校验和";
this.labelTitleTransmissionDelayTime.Text = "传送延迟时间(ms)";
this.labelTitleCommControlCharacter.Text = "通信制御文字";
this.labelTitleCharacterToFill.Text = "重量值填空字符";
this.labelTitleTransmitCondition.Text = "传输条件";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusBackgroundSerialSaparate));
this.buttonTransmitCondition.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engPassUp));
this.buttonTransmitCondition.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engEveryUp));
this.smartLabel2.Text = "- U : Мало, R : Норма, O : Много";
this.smartLabel3.Text = "- G, Grd : Сортировка, W : Вес, CNT : Подсчет, Chk : Контрольная сумма";
this.labelTitleTransmissionDelayTime.Text = "Время задержки передачи(ms)";
this.labelTitleCommControlCharacter.Text = "Коммуникационный управляющий персонаж";
this.labelTitleCharacterToFill.Text = "Символ для заполнения поля значения веса";
this.labelTitleTransmitCondition.Text = "Условия передачи";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundSerialSaparate));
this.buttonTransmitCondition.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engPassUp));
this.buttonTransmitCondition.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engEveryUp));
this.smartLabel2.Text = "- U : Min., R : Bestehen, O : Max.";
this.smartLabel3.Text = "- G, Grd : Grad, W : Gewicht, CNT : Zahl, Chk : Prüfsumme";
this.labelTitleTransmissionDelayTime.Text = "Übertragungsverzögerungszeit(ms)";
this.labelTitleCommControlCharacter.Text = "Kommunikationssteuerungszeichen";
this.labelTitleCharacterToFill.Text = "Zeichen zum Ausfüllen des Leerzeichens für den Gewichtswert";
this.labelTitleTransmitCondition.Text = "Übertragungsbedingungen";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundSerialSaparate));
this.buttonTransmitCondition.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engPassUp));
this.buttonTransmitCondition.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engEveryUp));
this.smartLabel2.Text = "- U : Superior, R : Referencia, O : Inferior";
this.smartLabel3.Text = "- G, Grd : Calificación, W : Peso, CNT : Conteo, Chk : Suma de comprobación";
this.labelTitleTransmissionDelayTime.Text = "Tiempo de retardo de transmisión(ms)";
this.labelTitleCommControlCharacter.Text = "Carácter de control de comm";
this.labelTitleCharacterToFill.Text = "Carácter para llenar en blanco";
this.labelTitleTransmitCondition.Text = "Condiciones de transmisión";
}
else
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundSerialSeparate));
this.buttonTransmitCondition.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korPassUp));
this.buttonTransmitCondition.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korEveryUp));
this.smartLabel2.Text = "- U : Under range, R : Reference, O : Over range";
this.smartLabel3.Text = "- G, Grd : Grade, W : Weight, CNT : Count, Chk : Checksum";
this.labelTitleTransmissionDelayTime.Text = "전송 지연시간(ms)";
this.labelTitleCommControlCharacter.Text = "통신 제어 문자";
this.labelTitleCharacterToFill.Text = "중량값 빈 자리 채울 문자";
this.labelTitleTransmitCondition.Text = "전송 조건";
}
}
private void DefaultSetting()
{
this.ControlHitachi = new ControlConfiHitachi(this.ParentForm);
this.Controls.Add(this.ControlHitachi);
this.ControlHitachi.Location = new Point(0, 217);
this.ControlMarkoprint = new ControlConfiMarkoPrint(this.ParentForm);
this.Controls.Add(this.ControlMarkoprint);
this.ControlMarkoprint.Location = new Point(0, 217);
this.ControlUserDefine = new ControlConfiSerialUserDefine(this.ParentForm);
this.Controls.Add(this.ControlUserDefine);
this.ControlUserDefine.Location = new Point(0, 217);
this.ControlBarcode = new ControlConfiSerialBarcode(this.ParentForm);
this.Controls.Add(this.ControlBarcode);
this.ControlBarcode.Location = new Point(0, 217);
this.ControlModbusRTU = new ControlConfiModbus(this.ParentForm);
this.Controls.Add(this.ControlModbusRTU);
this.ControlModbusRTU.Location = new Point(0, 217);
this.ControlMultiJet = new ControlConfiMULTiJET(this.ParentForm);
this.Controls.Add(this.ControlMultiJet);
this.ControlMultiJet.Location = new Point(0, 217);
this.ControlVisible(false);
this.comboBoxSerialBaudRate.Items.Clear();
this.comboBoxSerialBaudRate.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.Items.Add(9600);
this.comboBoxSerialBaudRate.Items.Add(19200);
this.comboBoxSerialBaudRate.Items.Add(38400);
this.comboBoxSerialBaudRate.Items.Add(57600);
this.comboBoxSerialBaudRate.Items.Add(115200);
this.comboBoxSerialBaudRate.SelectedIndex = 0;
this.comboBoxSerialBaudRate.SelectedIndexChanged += new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxCommControlCharacter.Items.Clear();
this.comboBoxCommControlCharacter.SelectedIndexChanged -= new EventHandler(this.comboBoxCommControlCharacter_SelectedIndexChanged);
this.comboBoxCommControlCharacter.Items.Add("STX....ETX");
this.comboBoxCommControlCharacter.Items.Add(".....CR LF");
this.comboBoxCommControlCharacter.SelectedIndex = 0;
this.comboBoxCommControlCharacter.SelectedIndexChanged += new EventHandler(this.comboBoxCommControlCharacter_SelectedIndexChanged);
this.ChangeCommunicationMode();
this.labelFormat.Text = "";
}
public void ChangeCommunicationMode()
{
this.comboBoxSerialMode.Items.Clear();
this.comboBoxSerialMode.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialMode_SelectedIndexChanged);
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == true)
{
this.comboBoxSerialMode.Items.Add("None");
this.comboBoxSerialMode.Items.Add("STD1");
this.comboBoxSerialMode.Items.Add("Remote");
this.comboBoxSerialMode.Items.Add("Printer");
this.comboBoxSerialMode.Items.Add("imaje 9410 OPT1"); // 한맥
this.comboBoxSerialMode.Items.Add("imaje 9028 OPT1"); // 한맥
this.comboBoxSerialMode.Items.Add("OPT0"); // 대주
this.comboBoxSerialMode.Items.Add("imaje 9410 OPT2"); // 한맥
this.comboBoxSerialMode.Items.Add("imaje 9028 OPT2"); // 한맥
this.comboBoxSerialMode.Items.Add("Hitachi"); // 히타치
this.comboBoxSerialMode.Items.Add("MACSA Laser"); // MACSA
this.comboBoxSerialMode.Items.Add("Markoprint"); // Markoprint
this.comboBoxSerialMode.Items.Add("alphaJET"); // alphaJET
this.comboBoxSerialMode.Items.Add("Marking(VJ1510)"); // VJ1510
this.comboBoxSerialMode.Items.Add("OPT1"); // 금속검출기(액트라 - 안리쯔) 14
this.comboBoxSerialMode.Items.Add("OPT2"); // NOW1(Now PPI에 사용) 15
this.comboBoxSerialMode.Items.Add("OPC"); // 16
this.comboBoxSerialMode.Items.Add("OPT3"); // 셀로닉스 요청 17
this.comboBoxSerialMode.Items.Add("HP-200"); // HP-200 18
this.comboBoxSerialMode.Items.Add("Smart Jet"); // Smart Jet 19
this.comboBoxSerialMode.Items.Add("imaje 9410 OPT3"); // 한맥 20
this.comboBoxSerialMode.Items.Add("RFID Speedway R420"); // RFID 21
this.comboBoxSerialMode.Items.Add("Modbus RTU"); // 모드버스 RTU 22
this.comboBoxSerialMode.Items.Add("STD2"); // STD2 23
this.comboBoxSerialMode.Items.Add("MULTi-JET"); // MULTi-JET 24
this.comboBoxSerialMode.Items.Add("DJ(VIDEOJET)"); // DJ VIDEOJET 25
this.comboBoxSerialMode.Items.Add("LINX8830"); // LINX8830 잉크젯 프린터 26
this.comboBoxSerialMode.Items.Add("MYJET"); // MYJET 잉크젯 프린터 27
this.comboBoxSerialMode.Items.Add("OPT4"); // 바코드 값과 함께 전송(Tasco건) 28
//this.comboBoxSerialMode.Items.Add("Barcode");
//this.comboBoxSerialMode.Items.Add("User Define");
}
else
{
this.comboBoxSerialMode.Items.Add("None");
this.comboBoxSerialMode.Items.Add("STD1");
this.comboBoxSerialMode.Items.Add("Remote");
this.comboBoxSerialMode.Items.Add("Printer");
this.comboBoxSerialMode.Items.Add("STD2"); // STD2 23
}
this.comboBoxSerialMode.SelectedIndexChanged += new EventHandler(this.comboBoxSerialMode_SelectedIndexChanged);
}
private void UpdateLabelFormatDisplay()
{
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false)
{
switch (this.comboBoxSerialMode.SelectedIndex)
{
case 0: // None
this.labelFormat.Text = "";
break;
case 1: // STD1
this.labelFormat.Text = "STX[1],ID[5],No[4],U[6],P[6],O[6],Grd[1],Sign[1],Weight[6],ETX[1]";
break;
case 2: // Remote
this.labelFormat.Text = "STX[1],No[2],Grd[1],Weight[6],ETX[1]";
break;
case 3: // Printer
this.labelFormat.Text = "No[4],Grd[8],Weight[10],CNT[10]";
break;
case 4: // STD2
this.labelFormat.Text = "STX[1],ID[5],No[4],U[6],P[6],O[6],UC[7],PC[7],OC[7],ExC[7],TC[9],Grd[1],Sign[1],Weight[6],ETX[1]";
break;
default:
this.labelFormat.Text = "";
break;
}
}
else
{
switch (this.comboBoxSerialMode.SelectedIndex)
{
case 0: // None
this.labelFormat.Text = "";
break;
case 1: // STD1
this.labelFormat.Text = "STX[1],ID[5],No[4],U[6],P[6],O[6],Grd[1],Sign[1],Weight[6],ETX[1]";
break;
case 2: // Remote
this.labelFormat.Text = "STX[1],No[2],Grd[1],Weight[6],ETX[1]";
break;
case 3: // Printer
this.labelFormat.Text = "No[4],Grd[8],Weight[10],CNT[10]";
break;
case 4: // markem-imaje 9410 OPT1
this.labelFormat.Text = "0xE8,0x00,0x08,0x01,0x00,0x05,W[5],Chksum[1]";
break;
case 5: // markem-imaje 9028 OPT1
this.labelFormat.Text = "0x99,0x00,0x07,0x12,W[5],0x12,Chksum[1]";
break;
case 6: // 노바렉스 대주
this.labelFormat.Text = "0x1B,EW----;1.00I,0x0D,0x1B,P1-0-000000000;A9mm;,W[6],0x0D,0x1B,EX----;,0x0D,0x02,TZ1.00I;13,0x0D,0x03";
break;
case 7: // markem-imaje 9410 OPT2
this.labelFormat.Text = "0xE8,0x00,0x08,0x01,0x00,0x05,W[5],Chksum[1]";
break;
case 8: // markem-imaje 9028 OPT2
this.labelFormat.Text = "0x05/0x99,0x00,0x07,0x12,W[5],0x12,Chksum[1]";
break;
case 9: // Hitachi
this.labelFormat.Text = "STX[1],Length[1],Room Number[1],W[6],ETX[1]";
break;
case 10: // MACSA Laser
this.labelFormat.Text = "STX[1],0xFE,0x41,0x30,0x06,W[6],Chk[1],(Chk[1]&0xff)[1],ETX[1]";
break;
case 11: // Markoprint
this.labelFormat.Text = "STX[1],TZcosmax.;00I;13,0x0D,W[6],Unit[1],0x0D,ETX[1]";
break;
case 12: // alphaJET
this.labelFormat.Text = "label\\1234.txt,W[6],Unit[1],";
break;
case (int)DataStore.SerialMode.f13_Marking_VJ1510:
case (int)DataStore.SerialMode.f25_DJ_VIDEOJET:
this.labelFormat.Text = "STX[1],0x55,0x4B,0x0A,Weight[4](No Decimal point),ETX[1]";
break;
case 14: // OPT1
this.labelFormat.Text = "Start:STX[1],12,ETX[1], Stop:STX[1],13,ETX[1], Number change:STX[1],200,No[2],ETX[1]";
break;
case 16: // OPC
this.buttonTestSend.Enabled = false;
this.labelFormat.Text = "OPC : opc.tcp://192.168.4.10";
break;
case 17: // OPT3
this.labelFormat.Text = "STX[1],Date[9],Time[9],Count[9],grd[9],W[9],Lot[9],O[9],U[9],P[9],ETX[1]";
break;
case 18: // HP-200
this.labelFormat.Text = "Pass : 02 4a 30 2c W[6] 0d 04 / NG : 02 4a 30 2c 20 20 20 20 20 20 0d 04 -> Screen Update : 02 5a 04";
break;
case 19: // Smart Jet
this.labelFormat.Text = "STX[1], A01, WeightData[6], EOT[1]";
break;
case 20: // markem-imaje 9410 OPT3
this.labelFormat.Text = "0xE8,0x00,0x08,0x01,0x00,0x05,W[5],Chksum[1]";
break;
case (int)DataStore.SerialMode.f23_STD2: // STD2
this.labelFormat.Text = "STX[1],ID[5],No[4],U[6],P[6],O[6],UC[7],PC[7],OC[7],ExC[7],TC[9],Grd[1],Sign[1],Weight[6],ETX[1]";
break;
case (int)DataStore.SerialMode.f24_MULTi_JET: // Multi-jet
this.labelFormat.Text = "0x1B,0x02,Slave Address[1],0x1D,0x02,0x01,0x0A,Date[10],0x02,0x07,Weight[6],'g',0x1B,0x03,Chksum[1]";
break;
case (int)DataStore.SerialMode.f26_LINX8830: // LINX8830
this.labelFormat.Text = "0x1B,0x02,0x1D,0x06,0x00,Weight[6],0x1B,0x03";
break;
case (int)DataStore.SerialMode.f27_MYJET: // MYJET
this.labelFormat.Text = "0x1B,0x02,0x05,0x1D,0x01,0x01,0x06,Weight[6],0x1B,0x03,Checksum[1]";
break;
case (int)DataStore.SerialMode.f28_OPT4: // OPT4
this.labelFormat.Text = "0x02,Date[yyyy-MM-dd HH:mm:ss, 19];Grade[1];Weight[6];Data,0x03";
break;
default:
if (this.ParentForm.ParentForm.SystemConfig2.Barcode == 0)
{
this.buttonTestSend.Enabled = false;
this.labelFormat.Text = "Private use";
}
break;
}
}
}
private void ControlVisible(bool visible)
{
this.ControlUserDefine.Visible = visible;
this.ControlHitachi.Visible = visible;
this.ControlMarkoprint.Visible = visible;
this.ControlModbusRTU.Visible = visible;
this.ControlMultiJet.Visible = visible;
//this.ControlBarcode.Visible = visible;
}
private void ButtonAddOnDisplay()
{
this.ControlVisible(false);
this.DisplayBottomSettingMenu();
if (this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f9_Hitachi
|| this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f11_Markoprint
|| this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f16_OPC
|| this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f22_Modbus_RTU
|| this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f24_MULTi_JET)
this.buttonAddon.Visible = true;
else
this.buttonAddon.Visible = false;
}
private void UpdateSerialParameterDisplay(SystemConfigurationItem1 item, SystemConfigurationItem3 item3, SystemParameter1 parameter)
{
DataStore.MenuBottomConfiguration temp = this.ParentForm.CurrentConfigurationMenu();
this.comboBoxSerialBaudRate.Enabled = true;
this.comboBoxSerialMode.Enabled = true;
this.comboBoxSerialMode.Visible = true;
this.ControlBarcode.Visible = false;
this.labelTitleBarcode.Visible = false;
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
#region COM1 Load
this.labelTransmissionDelayTime.Text = item.TransmissionDelayTimeCOM1.ToString();
if (item3.IsCharToFillZeroCOM1 == true)
this.buttonCharacterToFill.ButtonDown();
else
this.buttonCharacterToFill.ButtonUp();
if (item3.IsTransmitWhenPassCOM1 == true)
this.buttonTransmitCondition.ButtonDown();
else
this.buttonTransmitCondition.ButtonUp();
// BaudRate
this.comboBoxSerialBaudRate.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.SelectedIndex = item.SerialCOM1BaudRate;
this.comboBoxSerialBaudRate.SelectedIndexChanged += new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
// Mode
this.comboBoxSerialMode.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialMode_SelectedIndexChanged);
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false)
{
if (item.SerialCOM1Mode == (int)DataStore.SerialMode.f23_STD2)
this.comboBoxSerialMode.SelectedIndex = ModeSTD2;
else if (item.SerialCOM1Mode > this.comboBoxSerialMode.Items.Count - 1)
this.comboBoxSerialMode.SelectedIndex = 0;
else
this.comboBoxSerialMode.SelectedIndex = item.SerialCOM1Mode;
this.SaveComboBox(this.comboBoxSerialBaudRate.SelectedIndex, this.comboBoxSerialMode.SelectedIndex);
}
else
this.comboBoxSerialMode.SelectedIndex = item.SerialCOM1Mode;
this.comboBoxSerialMode.SelectedIndexChanged += new EventHandler(this.comboBoxSerialMode_SelectedIndexChanged);
if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode == (int)DataStore.SerialMode.f16_OPC)
{
this.comboBoxSerialBaudRate.Enabled = false;
this.ControlModbusRTU.OPCSettings();
}
else if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode == (int)DataStore.SerialMode.f22_Modbus_RTU)
this.ControlModbusRTU.ModbusRTUDefaultSettings();
else
this.ControlModbusRTU.SerialDefaultSettings();
#endregion
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
#region COM3 Load
this.labelTransmissionDelayTime.Text = item.TransmissionDelayTimeCOM3.ToString();
if (item3.IsCharToFillZeroCOM3 == true)
this.buttonCharacterToFill.ButtonDown();
else
this.buttonCharacterToFill.ButtonUp();
if (item3.IsTransmitWhenPassCOM3 == true)
this.buttonTransmitCondition.ButtonDown();
else
this.buttonTransmitCondition.ButtonUp();
if (this.ParentForm.ParentForm.SystemConfig2.Barcode > 0)
{
this.comboBoxSerialBaudRate.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
switch (this.ParentForm.ParentForm.SystemConfig2.Barcode)
{
case 1:
this.comboBoxSerialBaudRate.SelectedIndex = item.SerialCOM3BaudRate;
break;
case 2:
// Baudrate : 115200 고정
this.comboBoxSerialBaudRate.SelectedIndex = item.SerialCOM3BaudRate;
this.ControlBarcode.Visible = true;
this.ControlBarcode.DisplayRefresh(this.ParentForm.CurrentConfigurationMenu());
this.ControlBarcode.BringToFront();
this.comboBoxSerialBaudRate.Enabled = false;
break;
case 3:
// Baudrate : 115200 고정
this.comboBoxSerialBaudRate.SelectedIndex = item.SerialCOM3BaudRate;
this.comboBoxSerialBaudRate.Enabled = false;
break;
default:
break;
}
this.comboBoxSerialBaudRate.SelectedIndexChanged += new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.labelTransmissionDelayTime.Text = "0";
/////////////////////
this.comboBoxSerialMode.Visible = false;
this.labelTitleBarcode.Visible = true;
}
else
{
// BaudRate
this.comboBoxSerialBaudRate.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.SelectedIndex = item.SerialCOM3BaudRate;
this.comboBoxSerialBaudRate.SelectedIndexChanged += new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
// Mode
this.comboBoxSerialMode.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialMode_SelectedIndexChanged);
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false)
{
if (item.SerialCOM3Mode == (int)DataStore.SerialMode.f23_STD2)
this.comboBoxSerialMode.SelectedIndex = ModeSTD2;
else if (item.SerialCOM3Mode > this.comboBoxSerialMode.Items.Count - 1)
this.comboBoxSerialMode.SelectedIndex = 0;
else
this.comboBoxSerialMode.SelectedIndex = item.SerialCOM3Mode;
this.SaveComboBox(this.comboBoxSerialBaudRate.SelectedIndex, this.comboBoxSerialMode.SelectedIndex);
}
else
this.comboBoxSerialMode.SelectedIndex = item.SerialCOM3Mode;
this.comboBoxSerialMode.SelectedIndexChanged += new EventHandler(this.comboBoxSerialMode_SelectedIndexChanged);
if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode == (int)DataStore.SerialMode.f16_OPC) // OPC
{
this.comboBoxSerialBaudRate.Enabled = false;
this.ControlModbusRTU.OPCSettings();
}
else if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode == (int)DataStore.SerialMode.f22_Modbus_RTU)
this.ControlModbusRTU.ModbusRTUDefaultSettings();
else
this.ControlModbusRTU.SerialDefaultSettings();
}
#endregion
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
#region COM4 Load
this.labelTransmissionDelayTime.Text = item.TransmissionDelayTimeCOM4.ToString();
if (item3.IsCharToFillZeroCOM4 == true)
this.buttonCharacterToFill.ButtonDown();
else
this.buttonCharacterToFill.ButtonUp();
if (item3.IsTransmitWhenPassCOM4 == true)
this.buttonTransmitCondition.ButtonDown();
else
this.buttonTransmitCondition.ButtonUp();
// BaudRate
this.comboBoxSerialBaudRate.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.SelectedIndex = item.SerialCOM4BaudRate;
this.comboBoxSerialBaudRate.SelectedIndexChanged += new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
// Mode
this.comboBoxSerialMode.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialMode_SelectedIndexChanged);
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false)
{
if (item.SerialCOM4Mode == (int)DataStore.SerialMode.f23_STD2)
this.comboBoxSerialMode.SelectedIndex = ModeSTD2;
else if (item.SerialCOM4Mode > this.comboBoxSerialMode.Items.Count - 1)
this.comboBoxSerialMode.SelectedIndex = 0;
else
this.comboBoxSerialMode.SelectedIndex = item.SerialCOM4Mode;
this.SaveComboBox(this.comboBoxSerialBaudRate.SelectedIndex, this.comboBoxSerialMode.SelectedIndex);
}
else
this.comboBoxSerialMode.SelectedIndex = item.SerialCOM4Mode;
this.comboBoxSerialMode.SelectedIndexChanged += new EventHandler(this.comboBoxSerialMode_SelectedIndexChanged);
if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode == (int)DataStore.SerialMode.f16_OPC) // OPC
{
this.comboBoxSerialBaudRate.Enabled = false;
this.ControlModbusRTU.OPCSettings();
}
else if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode == (int)DataStore.SerialMode.f22_Modbus_RTU)
this.ControlModbusRTU.ModbusRTUDefaultSettings();
else
this.ControlModbusRTU.SerialDefaultSettings();
#endregion
break;
default:
break;
}
if (this.comboBoxSerialMode.SelectedIndex != 0)
this.buttonTestSend.Enabled = true;
else
{
if (this.ParentForm.ParentForm.SystemConfig2.Barcode == 0)
this.buttonTestSend.Enabled = false;
else
this.buttonTestSend.Enabled = true;
}
this.DisplayReceive("");
this.ButtonAddOnDisplay();
this.UpdateLabelFormatDisplay();
}
private void SaveComboBox(int baudrate, int mode)
{
DataStore.MenuBottomConfiguration temp = this.ParentForm.CurrentConfigurationMenu();
this.ParentForm.ParentForm.ChangeSerialCOM3FrameBufferSize(1024);
this.ParentForm.ParentForm.ChangeSerialCOM3ReceiveDetect(SmartX.SmartSerialPort.RECEIVEDETECTTYPE.EVENT_QUEUE);
if (this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f16_OPC)
{
this.ControlModbusRTU.OPCSettings();
#region OPC
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
this.ParentForm.ParentForm.CloseSerialCOM1();
this.ParentForm.ParentForm.SystemConfig1.SerialCOM1BaudRate = 0;
this.comboBoxSerialBaudRate.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.SelectedIndex = 0;
this.comboBoxSerialBaudRate.SelectedIndexChanged += new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.Enabled = false;
this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode = (int)DataStore.SerialMode.f16_OPC;
this.ParentForm.ParentForm.OpenSerialCOM1();
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
this.ParentForm.ParentForm.CloseSerialCOM3();
this.ParentForm.ParentForm.SystemConfig1.SerialCOM3BaudRate = 0;
this.comboBoxSerialBaudRate.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.SelectedIndex = 0;
this.comboBoxSerialBaudRate.SelectedIndexChanged += new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.Enabled = false;
this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode = (int)DataStore.SerialMode.f16_OPC;
this.ParentForm.ParentForm.OpenSerialCOM3();
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
this.ParentForm.ParentForm.CloseSerialCOM4();
this.ParentForm.ParentForm.SystemConfig1.SerialCOM4BaudRate = 0;
this.comboBoxSerialBaudRate.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.SelectedIndex = 0;
this.comboBoxSerialBaudRate.SelectedIndexChanged += new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.Enabled = false;
this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode = (int)DataStore.SerialMode.f16_OPC;
this.ParentForm.ParentForm.OpenSerialCOM4();
break;
default:
break;
}
#endregion
}
else if (this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f21_Impinj_Speedway_R420)
{
#region RFID Speedway R420
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
this.ParentForm.ParentForm.CloseSerialCOM1();
this.comboBoxSerialBaudRate.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.SelectedIndex = 4;
this.comboBoxSerialBaudRate.SelectedIndexChanged += new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.ParentForm.ParentForm.SystemConfig1.SerialCOM1BaudRate = 4;
this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode = (int)DataStore.SerialMode.f21_Impinj_Speedway_R420;
this.ParentForm.ParentForm.ChangeSerialCOM1FrameSeparateType(DataStore.SeparateType.ETXONLY);
this.ParentForm.ParentForm.OpenSerialCOM1();
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
this.ParentForm.ParentForm.CloseSerialCOM3();
this.comboBoxSerialBaudRate.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.SelectedIndex = 4;
this.comboBoxSerialBaudRate.SelectedIndexChanged += new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.ParentForm.ParentForm.SystemConfig1.SerialCOM3BaudRate = 4;
this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode = (int)DataStore.SerialMode.f21_Impinj_Speedway_R420;
this.ParentForm.ParentForm.ChangeSerialCOM3FrameSeparateType(DataStore.SeparateType.ETXONLY);
this.ParentForm.ParentForm.OpenSerialCOM3();
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
this.ParentForm.ParentForm.CloseSerialCOM4();
this.comboBoxSerialBaudRate.SelectedIndexChanged -= new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.comboBoxSerialBaudRate.SelectedIndex = 4;
this.comboBoxSerialBaudRate.SelectedIndexChanged += new EventHandler(this.comboBoxSerialBaudRate_SelectedIndexChanged);
this.ParentForm.ParentForm.SystemConfig1.SerialCOM4BaudRate = 4;
this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode = (int)DataStore.SerialMode.f21_Impinj_Speedway_R420;
this.ParentForm.ParentForm.ChangeSerialCOM4FrameSeparateType(DataStore.SeparateType.ETXONLY);
this.ParentForm.ParentForm.OpenSerialCOM4();
break;
default:
break;
}
#endregion
}
else
{
this.ControlModbusRTU.SerialDefaultSettings();
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
this.ParentForm.ParentForm.CloseSerialCOM1();
this.ParentForm.ParentForm.SystemConfig1.SerialCOM1BaudRate = baudrate;
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false && mode == ModeSTD2)
this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode = (int)DataStore.SerialMode.f23_STD2;
else
this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode = mode;
// SmartJet, MULTi_JET 사용 시, 기본적으로 Pass 시에만 전송
if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode == (int)DataStore.SerialMode.f19_SmartJet
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode == (int)DataStore.SerialMode.f24_MULTi_JET)
{
this.buttonCharacterToFill.ButtonDown();
this.ParentForm.ParentForm.SystemConfig3.IsTransmitWhenPassCOM1 = true;
this.ParentForm.ParentForm.SaveSystemConfigurationFile3(this.ParentForm.ParentForm.SystemConfig3);
}
this.ParentForm.ParentForm.ChangeSerialCOM1FrameSeparateType(DataStore.SeparateType.NONEFRAME_READTIMEOUT);
this.ParentForm.ParentForm.OpenSerialCOM1();
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
this.ParentForm.ParentForm.CloseSerialCOM3();
this.ParentForm.ParentForm.SystemConfig1.SerialCOM3BaudRate = baudrate;
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false && mode == ModeSTD2)
this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode = (int)DataStore.SerialMode.f23_STD2;
else
this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode = mode;
// SmartJet, MULTi_JET 사용 시, 기본적으로 Pass 시에만 전송
if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode == (int)DataStore.SerialMode.f19_SmartJet
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode == (int)DataStore.SerialMode.f24_MULTi_JET)
{
this.buttonCharacterToFill.ButtonDown();
this.ParentForm.ParentForm.SystemConfig3.IsTransmitWhenPassCOM3 = true;
this.ParentForm.ParentForm.SaveSystemConfigurationFile3(this.ParentForm.ParentForm.SystemConfig3);
}
this.ParentForm.ParentForm.ChangeSerialCOM3FrameSeparateType(DataStore.SeparateType.NONEFRAME_READTIMEOUT);
this.ParentForm.ParentForm.OpenSerialCOM3();
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
this.ParentForm.ParentForm.CloseSerialCOM4();
this.ParentForm.ParentForm.SystemConfig1.SerialCOM4BaudRate = baudrate;
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false && mode == ModeSTD2)
this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode = (int)DataStore.SerialMode.f23_STD2;
else
this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode = mode;
// SmartJet, MULTi_JET 사용 시, 기본적으로 Pass 시에만 전송
if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode == (int)DataStore.SerialMode.f19_SmartJet
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode == (int)DataStore.SerialMode.f24_MULTi_JET)
{
this.buttonCharacterToFill.ButtonDown();
this.ParentForm.ParentForm.SystemConfig3.IsTransmitWhenPassCOM4 = true;
this.ParentForm.ParentForm.SaveSystemConfigurationFile3(this.ParentForm.ParentForm.SystemConfig3);
}
this.ParentForm.ParentForm.ChangeSerialCOM4FrameSeparateType(DataStore.SeparateType.NONEFRAME_READTIMEOUT);
this.ParentForm.ParentForm.OpenSerialCOM4();
break;
default:
break;
}
if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode == (int)DataStore.SerialMode.f22_Modbus_RTU
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode == (int)DataStore.SerialMode.f22_Modbus_RTU
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode == (int)DataStore.SerialMode.f22_Modbus_RTU
|| this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode == (int)DataStore.EthernetMode.f22_Modbus_TCP)
this.ParentForm.ParentForm.ChildFormMainDisplay.MainBottomModbusIconAdd(true);
else
this.ParentForm.ParentForm.ChildFormMainDisplay.MainBottomModbusIconAdd(false);
}
this.ParentForm.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.ParentForm.SystemConfig1);
}
public void DisplayRefresh(SystemStatus status)
{
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.ConfiSerial;
this.ParentForm.ParentForm.SetDisplayMode(DataStore.DisplayMode.Menu);
this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
this.buttonSave.Enabled = false;
this.UpdateSerialParameterDisplay(this.ParentForm.ParentForm.SystemConfig1, this.ParentForm.ParentForm.SystemConfig3, this.ParentForm.ParentForm.CurrentSystemParameter1);
}
public void DisplayReceive(string value)
{
this.labelReceive.Text = value;
}
private void DisplayBottomSettingMenu()
{
this.ControlVisible(false);
this.buttonTestSend.Enabled = true;
if (this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f9_Hitachi)
{
this.ControlHitachi.Visible = true;
this.ControlHitachi.BringToFront();
this.ControlHitachi.DisplayRefresh(this.ParentForm.CurrentConfigurationMenu());
}
else if (this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f11_Markoprint)
{
this.ControlMarkoprint.Visible = true;
this.ControlMarkoprint.BringToFront();
this.ControlMarkoprint.DisplayRefresh(this.ParentForm.CurrentConfigurationMenu());
}
else if (this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f22_Modbus_RTU
|| this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f16_OPC)
{
this.ControlModbusRTU.Visible = true;
this.ControlModbusRTU.BringToFront();
this.ControlModbusRTU.DisplayRefresh(this.ParentForm.CurrentConfigurationMenu());
}
else if (this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f24_MULTi_JET)
{
this.ControlMultiJet.Visible = true;
this.ControlMultiJet.BringToFront();
this.ControlMultiJet.DisplayRefresh(this.ParentForm.CurrentConfigurationMenu());
}
else
{
}
}
#endregion
#region Event Handler
private void buttonAddon_Click(object sender, EventArgs e)
{
if (this.ControlUserDefine.Visible == false && this.ControlHitachi.Visible == false && this.ControlMarkoprint.Visible == false
&& this.ControlBarcode.Visible == false && this.ControlModbusRTU.Visible == false && this.ControlMultiJet.Visible == false)
this.DisplayBottomSettingMenu();
else
{
this.ControlVisible(false);
}
}
private void buttonTestSend_Click(object sender, EventArgs e)
{
int tempStringLength = 0;
string tempString = "";
string str = "";
bool isTest = true;
bool isFillZero = false;
StringBuilder sb = new StringBuilder();
DataStore.MenuBottomConfiguration temp = this.ParentForm.CurrentConfigurationMenu();
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
isFillZero = this.ParentForm.ParentForm.SystemConfig3.IsCharToFillZeroCOM1;
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
isFillZero = this.ParentForm.ParentForm.SystemConfig3.IsCharToFillZeroCOM3;
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
isFillZero = this.ParentForm.ParentForm.SystemConfig3.IsCharToFillZeroCOM4;
break;
default:
break;
}
byte[] byteArray = new byte[12];
byte[] weightBytes = new byte[4];
byte[] bytes = new byte[100];
if (this.comboBoxSerialMode.SelectedIndex == 0)
return;
switch (this.comboBoxSerialMode.SelectedIndex)
{
case 1:
#region STD1
sb.Append((char)0x02);
sb.Append("IN001");
sb.Append("0001");
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("1000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("2000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("3000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append("P");
sb.Append(" ");
if (isFillZero == true)
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
else
sb.Append(this.ParentForm.ParentForm.PadLeft(6, Helper.StringToDecimalPlaces("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append((char)0x03);
#endregion
break;
case 2:
#region Remote
sb.Append((char)0x02);
sb.Append("01");
sb.Append("P");
if (isFillZero == true)
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
else
sb.Append(this.ParentForm.ParentForm.PadLeft(6, Helper.StringToDecimalPlaces("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append((char)0x03);
#endregion
break;
case 3:
#region Printer
sb.Append("0001");
sb.Append(" Pass");
sb.Append(this.ParentForm.ParentForm.PadLeft(9, Helper.DoubleToString
(this.ParentForm.ParentForm.CurrentWeightData.Weight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(" ");
sb.Append("1234567890");
#endregion
break;
case 4:
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false)
{
#region STD2
sb.Append((char)0x02);
sb.Append("IN001");
sb.Append("0001");
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("1000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("2000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("3000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(this.ParentForm.ParentForm.PadLeft(7, "11111"));
sb.Append(this.ParentForm.ParentForm.PadLeft(7, "22222"));
sb.Append(this.ParentForm.ParentForm.PadLeft(7, "33333"));
sb.Append(this.ParentForm.ParentForm.PadLeft(7, "11111"));
sb.Append(this.ParentForm.ParentForm.PadLeft(9, "77777"));
sb.Append("P");
sb.Append(" ");
if (isFillZero == true)
sb.Append(Helper.StringZeroFillDigits6(Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
else
sb.Append(this.ParentForm.ParentForm.PadLeft(6, Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append((char)0x03);
#endregion
}
else
{
#region imaje 9410 OPT1
byteArray = new byte[12];
weightBytes = new byte[5];
// 외부변수사용 : 0xE8
byteArray[0] = 0xE8;
// Length : 0x00, 0x08 고정값
byteArray[1] = 0x00;
byteArray[2] = 0x08;
byteArray[3] = 0x01; // 1번 외부변수 번호
byteArray[4] = 0x00;
byteArray[5] = 0x05; // 1번 외부변수 길이
tempString = string.Format("{0,5}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces));
weightBytes = new UTF8Encoding().GetBytes(tempString);
for (int i = 0; i < weightBytes.Length; i++)
{
byteArray[i + 6] = weightBytes[i];
}
byteArray[11] = 0x00;
byteArray[11] = Helper.ChecksumCalculator(byteArray);
#endregion
}
break;
case 5:
#region imaje 9028 OPT1
byteArray = new byte[11];
weightBytes = new byte[5];
// byteArray[0] ~ byteArray[3]은 고정
byteArray[0] = 0x99;
byteArray[1] = 0x00;
byteArray[2] = 0x07;
byteArray[3] = 0x12;
weightBytes = new UTF8Encoding().GetBytes(string.Format("{0,5}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
for (int i = 0; i < weightBytes.Length; i++)
{
byteArray[i + 4] = weightBytes[i];
}
byteArray[9] = 0x12;
byteArray[10] = 0x00;
byteArray[10] = Helper.ChecksumCalculator(byteArray);
#endregion
break;
case 6:
#region OPT3 - 노바렉스 대주
sb.Append((char)0x1B);
sb.Append("EW----;1.00I");
sb.Append((char)0x0D);
sb.Append((char)0x1B);
sb.Append("P1-0-000000000;A9mm;");
sb.Append(string.Format("{0,6}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append((char)0x0D);
sb.Append((char)0x1B);
sb.Append("EX----;");
sb.Append((char)0x0D);
sb.Append((char)0x02);
sb.Append("TZ1.00I;13");
sb.Append((char)0x0D);
sb.Append((char)0x03);
#endregion
break;
case 7:
#region imaje 9410 OPT2
byteArray = new byte[12];
weightBytes = new byte[5];
// 외부변수사용 : 0xE8
byteArray[0] = 0xE8;
// Length : 0x00, 0x08 고정값
byteArray[1] = 0x00;
byteArray[2] = 0x08;
byteArray[3] = 0x01; // 1번 외부변수 번호
byteArray[4] = 0x00;
byteArray[5] = 0x05; // 1번 외부변수 길이
if (this.ParentForm.ParentForm.CurrentWeightData.JudgmentStatus == DataStore.JudgmentStatus.Pass)
{
tempString = string.Format("{0,5}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces));
weightBytes = new UTF8Encoding().GetBytes(tempString);
for (int i = 0; i < weightBytes.Length; i++)
{
byteArray[i + 6] = weightBytes[i];
}
}
else
{
for (int i = 0; i < 5; i++)
{
byteArray[i + 6] = 0x20;
}
}
byteArray[11] = 0x00;
byteArray[11] = Helper.ChecksumCalculator(byteArray);
#endregion
break;
case 8:
#region imaje 9028 OPT2
byteArray = new byte[11];
weightBytes = new byte[5];
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
this.ParentForm.ParentForm.TransferSerialCOM1(this.ParentForm.ParentForm.SendChar(DataStore.CharValue.ENQ));
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
this.ParentForm.ParentForm.TransferSerialCOM3(this.ParentForm.ParentForm.SendChar(DataStore.CharValue.ENQ));
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
this.ParentForm.ParentForm.TransferSerialCOM4(this.ParentForm.ParentForm.SendChar(DataStore.CharValue.ENQ));
break;
default:
break;
}
Thread.Sleep(30);
// 중량발송 : 0x99
byteArray[0] = 0x99;
// Length : 0x00, 0x02 고정값
byteArray[1] = 0x00;
byteArray[2] = 0x07;
byteArray[3] = 0x12;
if (this.ParentForm.ParentForm.CurrentWeightData.JudgmentStatus == DataStore.JudgmentStatus.Pass)
{
tempString = string.Format("{0,5}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces));
weightBytes = new UTF8Encoding().GetBytes(tempString);
for (int i = 0; i < weightBytes.Length; i++)
{
byteArray[i + 4] = weightBytes[i];
}
}
else
{
for (int i = 0; i < 5; i++)
{
byteArray[i + 4] = 0x20;
}
}
byteArray[9] = 0x12;
byteArray[10] = 0x00;
byteArray[10] = Helper.ChecksumCalculator(byteArray);
#endregion
break;
case 9:
#region Hitachi
sb.Append((char)0x02);
sb.Append((char)0x10);
sb.Append((char)0x31);
sb.Append(string.Format("{0,6}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append((char)0x03);
#endregion
break;
case 10:
#region MACSA Laser
byteArray = new byte[14];
bytes = new byte[6];
byte sum = 0x00;
byteArray[0] = 0x02;
byteArray[1] = 0xFE;
byteArray[2] = 0x41;
byteArray[3] = 0x30;
byteArray[4] = 0x06;
bytes = new UTF8Encoding().GetBytes(string.Format("{0,6}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
for (int i = 0; i < bytes.Length; i++)
{
byteArray[i + 5] = bytes[i];
}
byteArray[11] = byteArray[12] = byteArray[13] = 0x00;
byteArray[11] = Helper.ChecksumCalculator(byteArray);
byteArray[12] = (byte)(byteArray[11] & 0x00ff);
byteArray[13] = 0x03;
#endregion
break;
case 11:
#region Markoprint
byteArray = new byte[50];
bytes = new byte[30];
weightBytes = new byte[30];
string strCosmax = "TZcosmax.00I;13";
string strCosmax2 = "TZcosmax2.00I;13";
string strDate = string.Format("{0:yyyy.MM.dd}", DateTime.Now);
string str2 = "";
byteArray[0] = 0x02; //
bytes = new UTF8Encoding().GetBytes(strCosmax);
for (int i = 0; i < bytes.Length; i++)
{
byteArray[i + 1] = bytes[i];
}
byteArray[strCosmax.Length + 1] = 0x0D;
weightBytes = new UTF8Encoding().GetBytes(string.Format("{0,6}{1}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces), this.ParentForm.ParentForm.SystemConfig1.Unit));
for (int i = 0; i < weightBytes.Length; i++)
{
byteArray[i + strCosmax.Length + 2] = weightBytes[i];
}
byteArray[strCosmax.Length + weightBytes.Length + 2] = 0x0D;
byteArray[strCosmax.Length + weightBytes.Length + 3] = 0x03;
#endregion
break;
case 12:
#region alphaJET
byteArray = new byte[150];
bytes = new byte[100];
weightBytes = new byte[20];
int length = 0;
string fileName = "label\\1234.txt";
bytes = new UTF8Encoding().GetBytes("" + fileName + "" + @"");
for (int i = 0; i < bytes.Length; i++)
{
byteArray[i] = bytes[i];
}
length = bytes.Length;
///////////////////////////////////////////
weightBytes = new UTF8Encoding().GetBytes(string.Format("{0,6}{1}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces), this.ParentForm.ParentForm.SystemConfig1.Unit));
for (int i = 0; i < weightBytes.Length; i++)
{
byteArray[i + length] = weightBytes[i];
}
length = length + weightBytes.Length;
////////////////////////////////////////////
bytes = new UTF8Encoding().GetBytes("");
for (int i = 0; i < bytes.Length; i++)
{
byteArray[i + length] = bytes[i];
}
length = length + bytes.Length;
bytes = new UTF8Encoding().GetBytes("");
for (int i = 0; i < bytes.Length; i++)
{
byteArray[i + length] = bytes[i];
}
#endregion
break;
case (int)DataStore.SerialMode.f13_Marking_VJ1510:
case (int)DataStore.SerialMode.f25_DJ_VIDEOJET:
#region Marking(VJ1510)
byteArray = new byte[9];
sb.Append((char)0x02);
sb.Append((char)0x55); // U(고정)
sb.Append((char)0x4B); // K(고정)
sb.Append((char)0x0A); // LF(고정)
sb.Append("1234");
sb.Append((char)0x03);
#endregion
break;
case 14:
#region OPT1
sb.Append((char)0x02);
sb.Append("20001");
sb.Append((char)0x03);
#endregion
break;
case 17:
#region OPT3
string tempValue = "";
DateTime dt = DateTime.Now;
sb.Append((char)0x02);
sb.Append(string.Format(" {0:yyyyMMdd}", dt));
sb.Append(string.Format(" {0:HH:mm:ss}", dt));
sb.Append(" 12345");
sb.Append(" P");
sb.Append(string.Format("{0,9}", 123.4));
if (this.ParentForm.ParentForm.CurrentProductItem.LotNo.Length > 9)
sb.Append(this.ParentForm.ParentForm.CurrentProductItem.LotNo.Substring(0, 9));
else
sb.Append(this.ParentForm.ParentForm.CurrentProductItem.LotNo.PadLeft(9, ' '));
sb.Append((Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem.OverRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)).PadLeft(9));
sb.Append((Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem.UnderRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)).PadLeft(9));
sb.Append((Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem.PassRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)).PadLeft(9));
sb.Append((char)0x03);
#endregion
break;
case 18:
#region HP-200
sb.Append((char)0x02);
sb.Append((char)0x4a);
sb.Append((char)0x30);
sb.Append((char)0x2c);
sb.Append(" 123.4");
sb.Append((char)0x0d);
sb.Append((char)0x04);
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
this.ParentForm.ParentForm.TransferSerialCOM1(sb.ToString());
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
this.ParentForm.ParentForm.TransferSerialCOM3(sb.ToString());
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
this.ParentForm.ParentForm.TransferSerialCOM4(sb.ToString());
break;
default:
break;
}
sb = new StringBuilder();
sb.Append((char)0x02);
sb.Append((char)0x5a);
sb.Append((char)0x04);
#endregion
break;
case 19:
#region Smart Jet
sb.Append((char)0x02);
sb.Append("A01");
sb.Append(" 12.34");
sb.Append((char)0x04);
#endregion
break;
case 20:
#region imaje 9410 OPT3
byteArray = new byte[12];
weightBytes = new byte[5];
// 외부변수사용 : 0xE8
byteArray[0] = 0xE8;
// Length : 0x00, 0x08 고정값
byteArray[1] = 0x00;
byteArray[2] = 0x08;
byteArray[3] = 0x01; // 1번 외부변수 번호
byteArray[4] = 0x00;
byteArray[5] = 0x05; // 1번 외부변수 길이
weightBytes = new UTF8Encoding().GetBytes(" 123");
for (int i = 0; i < weightBytes.Length; i++)
{
byteArray[i + 6] = weightBytes[i];
}
byteArray[11] = 0x00;
byteArray[11] = Helper.ChecksumCalculator(byteArray);
#endregion
break;
case (int)DataStore.SerialMode.f23_STD2:
#region STD2
sb.Append((char)0x02);
sb.Append("IN001");
sb.Append("0001");
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("1000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("2000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("3000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(string.Format("{0:0000000}", 11111));
sb.Append(string.Format("{0:0000000}", 22222));
sb.Append(string.Format("{0:0000000}", 33333));
sb.Append(string.Format("{0:0000000}", 11111));
sb.Append(string.Format("{0:000000000}", 77777));
sb.Append("P");
sb.Append(" ");
if (isFillZero == true)
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
else
sb.Append(this.ParentForm.ParentForm.PadLeft(6, Helper.StringToDecimalPlaces("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append((char)0x03);
#endregion
break;
case (int)DataStore.SerialMode.f24_MULTi_JET:
#region MULTi_JET
byte slaveAddress = 1;
byteArray = new byte[29];
bytes = new byte[7];
byte[] date = new UTF8Encoding().GetBytes(string.Format("{0:yyyy.MM.dd}", DateTime.Now));
byteArray[0] = 0x1B;
byteArray[1] = 0x02;
if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode == (int)DataStore.SerialMode.f24_MULTi_JET)
slaveAddress = Convert.ToByte(this.ParentForm.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM1);
else if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode == (int)DataStore.SerialMode.f24_MULTi_JET)
slaveAddress = Convert.ToByte(this.ParentForm.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM3);
else if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode == (int)DataStore.SerialMode.f24_MULTi_JET)
slaveAddress = Convert.ToByte(this.ParentForm.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM4);
byteArray[2] = slaveAddress;
byteArray[3] = 0x1D; // 고정값, 원격 필드 데이터 다운로드(1D)
byteArray[4] = 0x02; // 데이터 개수
byteArray[5] = 0x01; // 필드ID(마킹기 화면에서 설정 가능)
byteArray[6] = 0x0A; // 현재 필드ID 자리수
for (int i = 0; i < date.Length; i++)
byteArray[7 + i] = date[i];
byteArray[17] = 0x02; // 필드ID(마킹기 화면에서 설정 가능)
byteArray[18] = 0x07; // 현재 필드ID 자리수
tempString = "123.4g ";
for (int i = 0; i < tempString.Length; i++)
{
bytes[i] = Convert.ToByte(tempString[i]);
byteArray[19 + i] = bytes[i];
}
byteArray[26] = 0x1B;
byteArray[27] = 0x03;
byteArray[28] = this.ParentForm.ParentForm.Checksumcalculator1digit(byteArray);
#endregion
break;
case (int)DataStore.SerialMode.f26_LINX8830:
#region LINX8830
byteArray = new byte[13];
bytes = new byte[6];
// 0~4 고정값
byteArray[0] = 0x1b;
byteArray[1] = 0x02;
byteArray[2] = 0x1D;
byteArray[3] = 0x06;
byteArray[4] = 0x00;
if (isFillZero == true)
bytes = new UTF8Encoding().GetBytes(Helper.StringZeroFillDigits6(Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
else
bytes = new UTF8Encoding().GetBytes(this.ParentForm.ParentForm.PadLeft(6, Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
for (int i = 0; i < bytes.Length; i++)
{
byteArray[i + 5] = bytes[i];
}
// 11~12 고정값
byteArray[11] = 0x1b;
byteArray[12] = 0x03;
#endregion
break;
case (int)DataStore.SerialMode.f27_MYJET:
#region MYJET
byteArray = new byte[16];
bytes = new byte[6];
// 0~6 고정값
byteArray[0] = 0x1b;
byteArray[1] = 0x02;
byteArray[2] = 0x05;
byteArray[3] = 0x1D;
byteArray[4] = 0x01;
byteArray[5] = 0x01;
byteArray[6] = 0x06;
if (isFillZero == true)
bytes = new UTF8Encoding().GetBytes(Helper.StringZeroFillDigits6(Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
else
bytes = new UTF8Encoding().GetBytes(this.ParentForm.ParentForm.PadLeft(6, Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
for (int i = 0; i < bytes.Length; i++)
{
byteArray[i + 7] = bytes[i];
}
// 13~14 고정값
byteArray[13] = 0x1b;
byteArray[14] = 0x03;
byteArray[15] = 0x00;
byteArray[15] = this.ParentForm.ParentForm.Checksumcalculator1digit(byteArray);
#endregion
break;
case (int)DataStore.SerialMode.f28_OPT4:
#region OPT4
sb.Append((char)0x02);
sb.Append(string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
sb.Append(";");
sb.Append("P");
sb.Append(";");
sb.Append(Helper.StringZeroFillDigits6(Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(";");
if (this.ParentForm.ParentForm.SystemConfig2.Barcode != 0)
sb.Append(this.ParentForm.ParentForm.CurrentBarcode.BarcodePeek());
else
sb.Append("88881000200030");
sb.Append((char)0x03);
#endregion
break;
default:
isTest = false;
break;
}
#region 사용안함
//else if (this.comboBoxSerialMode.SelectedIndex == 4) // Barcode
//{
// return;
//}
//else if (this.comboBoxSerialMode.SelectedIndex == 5) // User Define
//{
// switch (temp)
// {
// case DataStore.MenuBottomConfiguration.SerialCOM1:
// sb.Append(this.ControlUserDefine.ConvertProtocol((int)DataStore.SerialNumber.SerialCOM1));
// break;
// case DataStore.MenuBottomConfiguration.SerialCOM3:
// sb.Append(this.ControlUserDefine.ConvertProtocol((int)DataStore.SerialNumber.SerialCOM3));
// break;
// case DataStore.MenuBottomConfiguration.SerialCOM4:
// sb.Append(this.ControlUserDefine.ConvertProtocol((int)DataStore.SerialNumber.SerialCOM4));
// break;
// default:
// break;
// }
//}
#endregion
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
if (isTest == true && this.ParentForm.ParentForm.CheckOpenCOM1() == true)
{
if (sb.ToString() == "")
this.ParentForm.ParentForm.TransferDirectSerialCOM1(byteArray);
else
this.ParentForm.ParentForm.TransferDirectSerialCOM1(sb.ToString());
}
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
if (isTest == true && this.ParentForm.ParentForm.CheckOpenCOM3() == true)
{
if (sb.ToString() == "")
this.ParentForm.ParentForm.TransferDirectSerialCOM3(byteArray);
else
this.ParentForm.ParentForm.TransferDirectSerialCOM3(sb.ToString());
}
if (this.ParentForm.ParentForm.SystemConfig2.Barcode > 0)
{
sb.Append("Connected");
this.ParentForm.ParentForm.TransferDirectSerialCOM3(sb.ToString());
}
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
if (isTest == true && this.ParentForm.ParentForm.CheckOpenCOM4() == true)
{
if (sb.ToString() == "")
this.ParentForm.ParentForm.TransferDirectSerialCOM4(byteArray);
else
this.ParentForm.ParentForm.TransferDirectSerialCOM4(sb.ToString());
}
break;
default:
break;
}
}
private void buttonSave_Click(object sender, EventArgs e)
{
if (this.comboBoxSerialMode.SelectedIndex != 0)
this.buttonTestSend.Enabled = true;
else
{
if (this.ParentForm.ParentForm.SystemConfig2.Barcode == 0)
this.buttonTestSend.Enabled = false;
else
this.buttonTestSend.Enabled = true;
}
this.SaveComboBox(this.comboBoxSerialBaudRate.SelectedIndex, this.comboBoxSerialMode.SelectedIndex);
this.ButtonAddOnDisplay();
this.buttonSave.Enabled = false;
}
private void comboBoxSerialBaudRate_SelectedIndexChanged(object sender, EventArgs e)
{
this.buttonSave.Enabled = true;
}
private void comboBoxSerialMode_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.comboBoxSerialMode.SelectedIndex == (int)DataStore.SerialMode.f16_OPC) // OPC
this.comboBoxSerialBaudRate.Enabled = false;
else
this.comboBoxSerialBaudRate.Enabled = true;
this.buttonSave.Enabled = true;
this.UpdateLabelFormatDisplay();
}
private void labelTransmissionDelayTime_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelTransmissionDelayTime.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.labelTransmissionDelayTime.Text = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(this.labelTransmissionDelayTime.Text);
DataStore.MenuBottomConfiguration temp = this.ParentForm.CurrentConfigurationMenu();
if (temp == DataStore.MenuBottomConfiguration.SerialCOM1)
this.ParentForm.ParentForm.SystemConfig1.TransmissionDelayTimeCOM1 = myKeyPad.IntValue;
else if (temp == DataStore.MenuBottomConfiguration.SerialCOM3)
this.ParentForm.ParentForm.SystemConfig1.TransmissionDelayTimeCOM3 = myKeyPad.IntValue;
else if (temp == DataStore.MenuBottomConfiguration.SerialCOM4)
this.ParentForm.ParentForm.SystemConfig1.TransmissionDelayTimeCOM4 = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.ParentForm.SystemConfig1);
}
}
}
private void buttonCharacterToFill_Click(object sender, EventArgs e)
{
DataStore.MenuBottomConfiguration temp = this.ParentForm.CurrentConfigurationMenu();
if (this.buttonCharacterToFill.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
{
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
this.ParentForm.ParentForm.SystemConfig3.IsCharToFillZeroCOM1 = true;
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
this.ParentForm.ParentForm.SystemConfig3.IsCharToFillZeroCOM3 = true;
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
this.ParentForm.ParentForm.SystemConfig3.IsCharToFillZeroCOM4 = true;
break;
default:
break;
}
}
else
{
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
this.ParentForm.ParentForm.SystemConfig3.IsCharToFillZeroCOM1 = false;
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
this.ParentForm.ParentForm.SystemConfig3.IsCharToFillZeroCOM3 = false;
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
this.ParentForm.ParentForm.SystemConfig3.IsCharToFillZeroCOM4 = false;
break;
default:
break;
}
}
this.ParentForm.ParentForm.SaveSystemConfigurationFile3(this.ParentForm.ParentForm.SystemConfig3);
}
private void buttonTransmitCondition_Click(object sender, EventArgs e)
{
DataStore.MenuBottomConfiguration temp = this.ParentForm.CurrentConfigurationMenu();
if (this.buttonTransmitCondition.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
{
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
this.ParentForm.ParentForm.SystemConfig3.IsTransmitWhenPassCOM1 = true;
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
this.ParentForm.ParentForm.SystemConfig3.IsTransmitWhenPassCOM3 = true;
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
this.ParentForm.ParentForm.SystemConfig3.IsTransmitWhenPassCOM4 = true;
break;
default:
break;
}
}
else
{
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
this.ParentForm.ParentForm.SystemConfig3.IsTransmitWhenPassCOM1 = false;
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
this.ParentForm.ParentForm.SystemConfig3.IsTransmitWhenPassCOM3 = false;
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
this.ParentForm.ParentForm.SystemConfig3.IsTransmitWhenPassCOM4 = false;
break;
default:
break;
}
}
this.ParentForm.ParentForm.SaveSystemConfigurationFile3(this.ParentForm.ParentForm.SystemConfig3);
}
private void comboBoxCommControlCharacter_SelectedIndexChanged(object sender, EventArgs e)
{
this.ParentForm.ParentForm.SystemConfig2.CommunicationControlCharacter = this.comboBoxCommControlCharacter.SelectedIndex;
this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
}
#endregion
}
}