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 System.Drawing.Imaging;

using ITC81DB_2H.DialogForms;
using ITC81DB_2H.Forms;
using ITC81DB_2H.Datastore;

namespace ITC81DB_2H
{
    public partial class ControlCenterInforSystem3 : UserControl
    {
        #region Field
        private FormMenu m_ParentForm;
        #endregion

        #region Constructor
        public ControlCenterInforSystem3(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()
        {
            if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Korean)
            {
                this.groupBoxEquipment.Text = "기능설정";
                this.groupBoxSerial.Text = "시리얼통신";
                this.groupBoxEthernet.Text = "이더넷통신";

                this.labelTitleEquipmentID.Text = "장비 ID";
                this.labelTitleBuzzerOn.Text = "부저 ON";
                this.labelTitleChattering.Text = "채터링";
                this.labelTitleRelay.Text = "릴레이동작";
                this.labelTitleLanguage.Text = "언어설정";
                this.labelTitleExtension.Text = "확장자";
                this.labelTitleFormat.Text = "포맷";
                this.labelTitleLogin.Text = "로그인";

                this.labelTitleModeSerial.Text = "모드";

                this.labelTitleOperatingMode.Text = "동작모드";
                this.labelTitleCommunicationMode.Text = "통신모드";
            }
            else
            {
                this.groupBoxEquipment.Text = "Equipment";
                this.groupBoxSerial.Text = "Serial";
                this.groupBoxEthernet.Text = "Ethernet";

                this.labelTitleEquipmentID.Text = "Equip ID";
                this.labelTitleBuzzerOn.Text = "Buzz ON";
                this.labelTitleChattering.Text = "Chattering";
                this.labelTitleRelay.Text = "Relay";
                this.labelTitleLanguage.Text = "Language";
                this.labelTitleExtension.Text = "Extension";
                this.labelTitleFormat.Text = "Format";
                this.labelTitleLogin.Text = "Login";

                this.labelTitleModeSerial.Text = "Mode";

                this.labelTitleOperatingMode.Text = "Op-Mode";
                this.labelTitleCommunicationMode.Text = "Com-Mode";
            }
        }
        private void DefaultSetting()
        {
            this.DisplayGroupBox();
        }

        public string ReturnBaudrateName(int num)
        {
            switch (num)
            {
                case 0:
                    return "9600";
                case 1:
                    return "19200";
                case 2:
                    return "38400";
                case 3:
                    return "57600";
                case 4:
                    return "115200";
                default:
                    return "9600";
            }
        }
        public string ReturnCommunicationModeName(int num)
        {
            if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == true)
            {
                if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German)
                {
                    #region German
                    switch (num)
                    {
                        case 0:
                            return "Keiner";
                        case 1:
                            return "STD1";
                        case 2:
                            return "Fernzugriff";
                        case 3:
                            return "Drucker";
                        case 4:
                            return "imaje9410-1";
                        case 5:
                            return "imaje9028-1";
                        case 6:
                            return "OPT0";
                        case 7:
                            return "imaje9410-2";
                        case 8:
                            return "imaje9028-2";
                        case 9:
                            return "Hitachi";
                        case 10:
                            return "MACSA";
                        case 11:
                            return "Markoprint";
                        case 12:
                            return "alphaJET";
                        case 13:
                            return "VJ1510";
                        case 14:
                            return "OPT1";
                        case 15:
                            return "OPT2";
                        case 16:
                            return "OPC";
                        case 17:
                            return "OPT3";
                        case 18:
                            return "HP-200";
                        case 19:
                            return "Smart Jet";
                        case 20:
                            return "imaje 9410 OPT3";
                        case 22:
                            return "Modbus";
                        case 23:
                            return "STD2";
                        default:
                            return "Keiner";
                    }
                    #endregion
                }
                else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
                {
                    switch (num)
                    {                      
                        default:
                            return "";
                    }
                }
                else
                {
                    #region else
                    switch (num)
                    {
                        case 0:
                            return "None";
                        case 1:
                            return "STD1";
                        case 2:
                            return "Remote";
                        case 3:
                            return "Printer";
                        case 4:
                            return "imaje9410-1";
                        case 5:
                            return "imaje9028-1";
                        case 6:
                            return "OPT0";
                        case 7:
                            return "imaje9410-2";
                        case 8:
                            return "imaje9028-2";
                        case 9:
                            return "Hitachi";
                        case 10:
                            return "MACSA";
                        case 11:
                            return "Markoprint";
                        case 12:
                            return "alphaJET";
                        case 13:
                            return "VJ1510";
                        case 14:
                            return "OPT1";
                        case 15:
                            return "OPT2";
                        case 16:
                            return "OPC";
                        case 17:
                            return "OPT3";
                        case 18:
                            return "HP-200";
                        case 19:
                            return "Smart Jet";
                        case 20:
                            return "imaje 9410 OPT3";
                        case 22:
                            return "Modbus";
                        case 23:
                            return "STD2";
                        default:
                            return "None";
                    } 
                    #endregion
                }
            }
            else
            {
                if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German)
                {
                    #region German
                    switch (num)
                    {
                        case 0:
                            return "Keiner";
                        case 1:
                            return "STD1";
                        case 2:
                            return "Fernzugriff";
                        case 3:
                            return "Drucker";
                        case 4:
                            return "STD2";
                        default:
                            return "Keiner";
                    }
                    #endregion
                }
                else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
                {
                    switch (num)
                    {
                        default:
                            return "Keiner";
                    }
                }
                else
                {
                    #region else
                    switch (num)
                    {
                        case 0:
                            return "None";
                        case 1:
                            return "STD1";
                        case 2:
                            return "Remote";
                        case 3:
                            return "Printer";
                        case 4:
                            return "STD2";
                        default:
                            return "None";
                    }
                    #endregion
                }
            }

        }
        private string ReturnBoolValue(bool bValue)
        {
            if (bValue == true)
                return "ON";
            else
                return "OFF";
        }
        public string ReturnExternalOutput(int mode)
        {
            string temp = "None";

            switch (mode)
            {
                case (int)Define.E_ExternalInputMode.IN0_None:
                    temp = "None";
                    break;
                case (int)Define.E_ExternalInputMode.IN1_Metal:
                    temp = "Metal";
                    break;
                case (int)Define.E_ExternalInputMode.IN2_START:
                    temp = "START";
                    break;
                case (int)Define.E_ExternalInputMode.IN3_STOP:
                    temp = "STOP";
                    break;
                case (int)Define.E_ExternalInputMode.IN4_DischargeSorterA:
                    temp = "DischargeA";
                    break;
                case (int)Define.E_ExternalInputMode.IN5_Air:
                    temp = "Air";
                    break;
                case (int)Define.E_ExternalInputMode.IN6_Door:
                    temp = "Door";
                    break;
                case (int)Define.E_ExternalInputMode.IN7_Stopper:
                    temp = "Stopper";
                    break;
                case (int)Define.E_ExternalInputMode.IN8_Windproof:
                    temp = "Windproof";
                    break;
                case (int)Define.E_ExternalInputMode.IN9_ExternalOperation:
                    temp = "Ex-Operation";
                    break;
                case (int)Define.E_ExternalInputMode.IN10_DispensorEntry1:
                    temp = "Dispensor1";
                    break;
                case (int)Define.E_ExternalInputMode.IN11_DispensorEntry2:
                    temp = "Dispensor2";
                    break;
                case (int)Define.E_ExternalInputMode.IN12_StackUp:
                    temp = "StackUp";
                    break;
                case (int)Define.E_ExternalInputMode.IN13_ExNG1:
                    temp = "ExNG1";
                    break;
                case (int)Define.E_ExternalInputMode.IN14_ExNG2:
                    temp = "ExNG2";
                    break;
                case (int)Define.E_ExternalInputMode.IN15_ExInputCheck:
                    temp = "Ex-Input";
                    break;
                case (int)Define.E_ExternalInputMode.IN16_DischargeSorterB:
                    temp = "DischargeB";
                    break;
                default:
                    temp = "None";
                    break;
            }

            return temp;
        }
        public string ReturnExternalInput(int mode)
        {
            string temp = "None";

            switch (mode)
            {
                case (int)Define.E_ExternalInputMode.IN0_None:
                    temp = "None";
                    break;
                case (int)Define.E_ExternalInputMode.IN1_Metal:
                    temp = "Metal";
                    break;
                case (int)Define.E_ExternalInputMode.IN2_START:
                    temp = "START";
                    break;
                case (int)Define.E_ExternalInputMode.IN3_STOP:
                    temp = "STOP";
                    break;
                case (int)Define.E_ExternalInputMode.IN4_DischargeSorterA:
                    temp = "DischargeA";
                    break;
                case (int)Define.E_ExternalInputMode.IN5_Air:
                    temp = "Air";
                    break;
                case (int)Define.E_ExternalInputMode.IN6_Door:
                    temp = "Door";
                    break;
                case (int)Define.E_ExternalInputMode.IN7_Stopper:
                    temp = "Stopper";
                    break;
                case (int)Define.E_ExternalInputMode.IN8_Windproof:
                    temp = "Windproof";
                    break;
                case (int)Define.E_ExternalInputMode.IN9_ExternalOperation:
                    temp = "Ex-Operation";
                    break;
                case (int)Define.E_ExternalInputMode.IN10_DispensorEntry1:
                    temp = "Dispensor1";
                    break;
                case (int)Define.E_ExternalInputMode.IN11_DispensorEntry2:
                    temp = "Dispensor2";
                    break;
                case (int)Define.E_ExternalInputMode.IN12_StackUp:
                    temp = "StackUp";
                    break;
                case (int)Define.E_ExternalInputMode.IN13_ExNG1:
                    temp = "ExNG1";
                    break;
                case (int)Define.E_ExternalInputMode.IN14_ExNG2:
                    temp = "ExNG2";
                    break;
                case (int)Define.E_ExternalInputMode.IN15_ExInputCheck:
                    temp = "Ex-Input";
                    break;
                case (int)Define.E_ExternalInputMode.IN16_DischargeSorterB:
                    temp = "DischargeB";
                    break;
                default:
                    temp = "None";
                    break;
            }

            return temp;
        }
        private void InitialLabel()
        {
            #region Initial Label
            this.labelBuzzerOn.Text = "-";
            this.labelChattering.Text = "-";
            this.labelRelay.Text = "-";

            this.labelEquipmentID.Text = "-";
            this.labelLanguage.Text = "-";
            this.labelExtension.Text = "-";
            this.labelFormat.Text = "-";
            this.labelLogin.Text = "-";

            this.labelCOM1Baudrate.Text = "-";
            this.labelCOM1Mode.Text = "-";
            this.labelCOM3Baudrate.Text = "-";
            this.labelCOM3Mode.Text = "-";
            this.labelCOM4Baudrate.Text = "-";
            this.labelCOM4Mode.Text = "-";
            this.labelOperatingMode.Text = "-";
            this.labelCommunicationMode.Text = "-";
            this.labelIPConfiguration.Text = "-";
            this.labelIPAddress.Text = "-";
            this.labelSubnetMask.Text = "-";
            this.labelGateWay.Text = "-";
            this.labelServerPort.Text = "-";
            this.labelClientServerIP.Text = "-";
            this.labelClientServerPort.Text = "-"; 
            #endregion

            #region ForeColor
            this.labelBuzzerOn.ForeColor = Color.White;
            this.labelChattering.ForeColor = Color.White;
            this.labelRelay.ForeColor = Color.White;
 
            this.labelEquipmentID.ForeColor = Color.White;
            this.labelLanguage.ForeColor = Color.White;
            this.labelExtension.ForeColor = Color.White;
            this.labelFormat.ForeColor = Color.White;
            this.labelLogin.ForeColor = Color.White;

            this.labelCOM1Baudrate.ForeColor = Color.White;
            this.labelCOM1Mode.ForeColor = Color.White;
            this.labelCOM3Baudrate.ForeColor = Color.White;
            this.labelCOM3Mode.ForeColor = Color.White;
            this.labelCOM4Baudrate.ForeColor = Color.White;
            this.labelCOM4Mode.ForeColor = Color.White;
            this.labelOperatingMode.ForeColor = Color.White;
            this.labelCommunicationMode.ForeColor = Color.White;
            this.labelIPConfiguration.ForeColor = Color.White;
            this.labelIPAddress.ForeColor = Color.White;
            this.labelSubnetMask.ForeColor = Color.White;
            this.labelGateWay.ForeColor = Color.White;
            this.labelServerPort.ForeColor = Color.White;
            this.labelClientServerIP.ForeColor = Color.White;
            this.labelClientServerPort.ForeColor = Color.White;
            #endregion
        }
        private void CheckCompareBoardLCD9520Value(SystemInformation3 item)
        {
            if (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.BuzzerOnTime) != int.Parse(item.BuzzerONTime))
                this.labelBuzzerOn.ForeColor = Color.Red;
            if (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.Chattering) != int.Parse(item.Chattering))
                this.labelChattering.ForeColor = Color.Red;
            if (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.RelayOnTime) != int.Parse(item.Relay))
                this.labelRelay.ForeColor = Color.Red;

            if (this.ParentForm.ParentForm.SystemConfig2.BLDCTotalMotorNum >= 1)
            {
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[0]._6704_MotorSpeed.ToString() != item.BLDCMotorSpeed1)
                    this.labelSpeed1.ForeColor = Color.Red;
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[0]._6705_PoleNum.ToString() != item.BLDCMotorPole1)
                    this.labelPoleCount1.ForeColor = Color.Red;
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[0]._6706_AttenuatorRatio.ToString() != item.BLDCMotorReductionRatio1)
                    this.labelReductionRatio1.ForeColor = Color.Red;
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[0]._6764_OperDirection.ToString() != item.BLDCMotorDirection1)
                    this.labelMotorDirection1.ForeColor = Color.Red;
            }

            if (this.ParentForm.ParentForm.SystemConfig2.BLDCTotalMotorNum >= 2)
            {
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[1]._6704_MotorSpeed.ToString() != item.BLDCMotorSpeed2)
                    this.labelSpeed2.ForeColor = Color.Red;
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[1]._6705_PoleNum.ToString() != item.BLDCMotorPole2)
                    this.labelPoleCount2.ForeColor = Color.Red;
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[1]._6706_AttenuatorRatio.ToString() != item.BLDCMotorReductionRatio2)
                    this.labelReductionRatio2.ForeColor = Color.Red;
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[1]._6764_OperDirection.ToString() != item.BLDCMotorDirection2)
                    this.labelMotorDirection2.ForeColor = Color.Red;
            }

            if (this.ParentForm.ParentForm.SystemConfig2.BLDCTotalMotorNum >= 3)
            {
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[2]._6704_MotorSpeed.ToString() != item.BLDCMotorSpeed3)
                    this.labelSpeed3.ForeColor = Color.Red;
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[2]._6705_PoleNum.ToString() != item.BLDCMotorPole3)
                    this.labelPoleCount3.ForeColor = Color.Red;
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[2]._6706_AttenuatorRatio.ToString() != item.BLDCMotorReductionRatio3)
                    this.labelReductionRatio3.ForeColor = Color.Red;
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[2]._6764_OperDirection.ToString() != item.BLDCMotorDirection3)
                    this.labelMotorDirection3.ForeColor = Color.Red;
            }

            if (this.ParentForm.ParentForm.SystemConfig2.BLDCTotalMotorNum >= 4)
            {
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[3]._6704_MotorSpeed.ToString() != item.BLDCMotorSpeed4)
                    this.labelSpeed4.ForeColor = Color.Red;
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[3]._6705_PoleNum.ToString() != item.BLDCMotorPole4)
                    this.labelPoleCount4.ForeColor = Color.Red;
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[3]._6706_AttenuatorRatio.ToString() != item.BLDCMotorReductionRatio4)
                    this.labelReductionRatio4.ForeColor = Color.Red;
                if (this.ParentForm.ParentForm.CollectionBLDCParameter[3]._6764_OperDirection.ToString() != item.BLDCMotorDirection4)
                    this.labelMotorDirection4.ForeColor = Color.Red;
            }
        }

        public void DisplayGroupBox()
        {
            if (this.ParentForm.ParentForm.SystemConfig1.IsBLDCON == true)
                this.groupBoxBLDCMotor.Visible = true;
            else
                this.groupBoxBLDCMotor.Visible = false;
        }
        public void UpdateParameter9520Display(SystemInformation3 item, SystemConfigurationItem1 system1, SystemConfigurationItem2 system2)
        {

            #region Equipment setting
            this.labelEquipmentID.Text = system1.EquipmentID.ToString();
            this.labelBuzzerOn.Text = Helper.RemoveZeroNumberString(item.BuzzerONTime);
            this.labelChattering.Text = Helper.RemoveZeroNumberString(item.Chattering);
            this.labelRelay.Text = Helper.RemoveZeroNumberString(item.Relay);
            this.labelLanguage.Text = system1.Language.ToString();
            this.labelLogin.Text = this.ReturnBoolValue(system1.IsLogin);
            this.labelExtension.Text = system2.FileNameExtension.ToString();
            this.labelFormat.Text = system1.DatabackupFormat.ToString();
            this.labelStatFormat.Text = system1.StatisticsPrintFormat.ToString();
            this.labelBLDCUsing.Text = this.ReturnBoolValue(system1.IsBLDCON);
            this.labelBLDCMotorCount.Text = system2.BLDCTotalMotorNum.ToString();
            #endregion

            #region BLDC

            this.labelSpeed1.Text = item.BLDCMotorSpeed1;
            this.labelPoleCount1.Text = item.BLDCMotorPole1;
            this.labelReductionRatio1.Text = item.BLDCMotorReductionRatio1;
            this.labelMotorDirection1.Text = item.BLDCMotorDirection1;
            this.labelSpeed2.Text = item.BLDCMotorSpeed2;
            this.labelPoleCount2.Text = item.BLDCMotorPole2;
            this.labelReductionRatio2.Text = item.BLDCMotorReductionRatio2;
            this.labelMotorDirection2.Text = item.BLDCMotorDirection2;
            this.labelSpeed3.Text = item.BLDCMotorSpeed3;
            this.labelPoleCount3.Text = item.BLDCMotorPole3;
            this.labelReductionRatio3.Text = item.BLDCMotorReductionRatio3;
            this.labelMotorDirection3.Text = item.BLDCMotorDirection3;
            this.labelSpeed4.Text = item.BLDCMotorSpeed4;
            this.labelPoleCount4.Text = item.BLDCMotorPole4;
            this.labelReductionRatio4.Text = item.BLDCMotorReductionRatio4;
            this.labelMotorDirection4.Text = item.BLDCMotorDirection4;
            #endregion

            #region Ethernet
            if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 1)
                this.labelOperatingMode.Text = "Server";
            else if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2)
                this.labelOperatingMode.Text = "Client";
            else
                this.labelOperatingMode.Text = "None";
            this.labelCommunicationMode.Text = this.ReturnCommunicationModeName(this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode);
            if (this.ParentForm.ParentForm.smartConfigs.IPSettings.DHCPEnable == 0)
                this.labelIPConfiguration.Text = "Static";
            else
                this.labelIPConfiguration.Text = "DHCP";
            this.labelIPAddress.Text = this.ParentForm.ParentForm.smartConfigs.IPSettings.DeviceIP;
            this.labelSubnetMask.Text = this.ParentForm.ParentForm.smartConfigs.IPSettings.SubNetMask;
            this.labelGateWay.Text = this.ParentForm.ParentForm.smartConfigs.IPSettings.GateWay;
            this.labelServerPort.Text = this.ParentForm.ParentForm.SystemConfig2.EthernetLocalPort.ToString();
            this.labelClientServerIP.Text = this.ParentForm.ParentForm.SystemConfig2.EthernetAddress;
            this.labelClientServerPort.Text = this.ParentForm.ParentForm.SystemConfig2.EthernetPort.ToString();
            #endregion

            this.CheckCompareBoardLCD9520Value(item);
        }

        public void DisplayRefresh(SystemStatus status)
        {
            this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = Define.E_DisplayStore.InforSystem3;
            this.ParentForm.ParentForm.SetDisplayMode(Define.E_DisplayMode.Menu);

            this.InitialLabel();
        }
        #endregion

        #region Event Handler
        private void buttonPrevious_Click(object sender, EventArgs e)
        {
            this.ParentForm.CenterInforSystem2.DisplayRefresh(this.ParentForm.ParentForm.CurrentSystemStatus);
            this.ParentForm.CenterInforSystem2.BringToFront();
        }

        private void buttonCapture_Click(object sender, EventArgs e)
        {
            string filePath = "";
            Bitmap bitMap = new Bitmap(800, 480);

            bitMap = IntechGraphics.CopyFromScreen();
            filePath = string.Format("{0}{1}_SystemInfo2.jpg",
                this.ParentForm.ParentForm.PathDataBackupFolder, this.ParentForm.ParentForm.SystemConfig1.SerialNumber);
            bitMap.Save(filePath, ImageFormat.Jpeg);
        }

        private void buttonLoad_Click(object sender, EventArgs e)
        {
            this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.SystemInformationRead3, "");

            #region Equipment setting
            this.labelEquipmentID.Text = this.ParentForm.ParentForm.SystemConfig1.EquipmentID.ToString();
            this.labelLanguage.Text = this.ParentForm.ParentForm.SystemConfig1.Language.ToString();
            if(this.ParentForm.ParentForm.SystemConfig2.FileNameExtension == 1)
                this.labelExtension.Text = "TXT";
            else
                this.labelExtension.Text = "CSV";
            if (this.ParentForm.ParentForm.SystemConfig1.DatabackupFormat == 1)
                this.labelFormat.Text = "OPT1"; // 종근당 리젝데이터 있는 포맷
            else
                this.labelFormat.Text = "STD1";
            if (this.ParentForm.ParentForm.SystemConfig1.IsLogin == true)
                this.labelLogin.Text = "ON";
            else
                this.labelLogin.Text = "OFF";
            #endregion

            #region Serial
            this.labelCOM1Baudrate.Text = this.ReturnBaudrateName(this.ParentForm.ParentForm.SystemConfig1.SerialCOM1BaudRate);
            this.labelCOM1Mode.Text = this.ReturnCommunicationModeName(this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode);
            this.labelCOM3Baudrate.Text = this.ReturnBaudrateName(this.ParentForm.ParentForm.SystemConfig1.SerialCOM3BaudRate);
            this.labelCOM3Mode.Text = this.ReturnCommunicationModeName(this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode);
            this.labelCOM4Baudrate.Text = this.ReturnBaudrateName(this.ParentForm.ParentForm.SystemConfig1.SerialCOM4BaudRate);
            this.labelCOM4Mode.Text = this.ReturnCommunicationModeName(this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode);
            #endregion

            #region Ethernet
            if(this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 1)
                this.labelOperatingMode.Text = "Server";
            else if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2)
                this.labelOperatingMode.Text = "Client";
            else
                this.labelOperatingMode.Text = "None";
            this.labelCommunicationMode.Text = this.ReturnCommunicationModeName(this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode);
            if (this.ParentForm.ParentForm.smartConfigs.IPSettings.DHCPEnable == 0)
                this.labelIPConfiguration.Text = "Static";
            else
                this.labelIPConfiguration.Text = "DHCP";
            this.labelIPAddress.Text = this.ParentForm.ParentForm.smartConfigs.IPSettings.DeviceIP;
            this.labelSubnetMask.Text = this.ParentForm.ParentForm.smartConfigs.IPSettings.SubNetMask;
            this.labelGateWay.Text = this.ParentForm.ParentForm.smartConfigs.IPSettings.GateWay;
            this.labelServerPort.Text = this.ParentForm.ParentForm.SystemConfig2.EthernetLocalPort.ToString();
            this.labelClientServerIP.Text = this.ParentForm.ParentForm.SystemConfig2.EthernetAddress;
            this.labelClientServerPort.Text = this.ParentForm.ParentForm.SystemConfig2.EthernetPort.ToString();
            #endregion
        }
        #endregion
    }
}
