using System;
using System.Linq;
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 SmartX;

using ITC81DB_0H.Forms;
using ITC81DB_0H.DialogForms;
using ITC81DB_0H_ImageDll;
using System.Threading;

namespace ITC81DB_0H.Controls
{
    public partial class ControlCenterEquipFunctionSetting : UserControl
    {
        #region Field
        private FormMenu m_ParentForm;
        #endregion

        #region Constructor
        public ControlCenterEquipFunctionSetting(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();

            this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);

            this.comboBoxPIN6.Font = this.comboBoxPIN5.Font = new Font("새굴림", 14, FontStyle.Bold);
            this.comboBoxPIN4.Font = this.comboBoxPIN3.Font = this.comboBoxPIN2.Font = new Font("새굴림", 14, FontStyle.Bold);

            if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English)
            {
                #region English
                this.labelTitleBuzzerONTime.Font = new Font("새굴림", 11, FontStyle.Bold);
                this.labelTitleBuzzerONTime.Text = "Buzzer ON time";
                this.labelTitleRelayRunTime.Font = new Font("새굴림", 11, FontStyle.Bold);
                this.labelTitleRelayRunTime.Text = "Relay Run time";
                this.labelTitleChattering.Font = new Font("새굴림", 11, FontStyle.Bold);
                this.labelTitleChattering.Text = "Chattering";
                this.labelTitleLanguage.Text = "Language";
                this.labelTitleEquipmentID.Text = "Equipment ID";
                this.labelTitleLogin.Text = "Login";
                this.labelExternalInputMessage1.Text = "Emergency Stop/Discharge/Air/Door";
                this.labelExternalInputMessage2.Text = "/Stack up";
                this.labelTitleExternalInputBuzzer.Text = "Buzzer";
                this.labelTitleExternalInputLamp.Text = "Lamp";

                this.comboBoxPIN6.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN6_SelectedIndexChanged);
                this.comboBoxPIN6.Items.Clear();
                this.comboBoxPIN6.Items.Add("None");
                this.comboBoxPIN6.Items.Add("External Operating");
                this.comboBoxPIN6.Items.Add("Air Check");
                this.comboBoxPIN6.Items.Add("Door Check");
                this.comboBoxPIN6.Items.Add("Discharge Check");
                this.comboBoxPIN6.SelectedIndexChanged += new EventHandler(this.comboBoxPIN6_SelectedIndexChanged);

                this.comboBoxPIN5.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN5_SelectedIndexChanged);
                this.comboBoxPIN5.Items.Clear();
                this.comboBoxPIN5.Items.Add("None");
                this.comboBoxPIN5.Items.Add("External Operating");
                this.comboBoxPIN5.Items.Add("Air Check");
                this.comboBoxPIN5.Items.Add("Door Check");
                this.comboBoxPIN5.Items.Add("Discharge Check");
                this.comboBoxPIN5.SelectedIndexChanged += new EventHandler(this.comboBoxPIN5_SelectedIndexChanged);

                this.comboBoxPIN4.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN4_SelectedIndexChanged);
                this.comboBoxPIN4.Items.Clear();
                this.comboBoxPIN4.Items.Add("None");
                this.comboBoxPIN4.Items.Add("START");
                this.comboBoxPIN4.Items.Add("External Operating");
                this.comboBoxPIN4.Items.Add("Air Check");
                this.comboBoxPIN4.Items.Add("Door Check");
                this.comboBoxPIN4.Items.Add("Discharge Check");
                this.comboBoxPIN4.SelectedIndexChanged += new EventHandler(this.comboBoxPIN4_SelectedIndexChanged);

                this.comboBoxPIN3.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN3_SelectedIndexChanged);
                this.comboBoxPIN3.Items.Clear();
                this.comboBoxPIN3.Items.Add("None");
                this.comboBoxPIN3.Items.Add("STOP");
                this.comboBoxPIN3.Items.Add("External Operating");
                this.comboBoxPIN3.Items.Add("Air Check");
                this.comboBoxPIN3.Items.Add("Door Check");
                this.comboBoxPIN3.Items.Add("Discharge Check");
                this.comboBoxPIN3.SelectedIndexChanged += new EventHandler(this.comboBoxPIN3_SelectedIndexChanged);

                this.comboBoxPIN2.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN2_SelectedIndexChanged);
                this.comboBoxPIN2.Items.Clear();
                this.comboBoxPIN2.Items.Add("None");
                this.comboBoxPIN2.Items.Add("NG");
                this.comboBoxPIN2.Items.Add("External Operating");
                this.comboBoxPIN2.Items.Add("Air Check");
                this.comboBoxPIN2.Items.Add("Door Check");
                this.comboBoxPIN2.Items.Add("Discharge Check");
                this.comboBoxPIN2.SelectedIndexChanged += new EventHandler(this.comboBoxPIN2_SelectedIndexChanged);

                this.buttonLogin.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engON));
                this.buttonLogin.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engOFF));
                this.buttonExternalInputBuzzer.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engON));
                this.buttonExternalInputBuzzer.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engOFF));
                this.buttonExternalInputLamp.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engON));
                this.buttonExternalInputLamp.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engOFF));
                #endregion
            }
            else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
            {
                #region Chinese
                this.labelTitleBuzzerONTime.Font = new Font("새굴림", 11, FontStyle.Bold);
                this.labelTitleBuzzerONTime.Text = "蜂鸣器开启时间";
                this.labelTitleRelayRunTime.Font = new Font("새굴림", 11, FontStyle.Bold);
                this.labelTitleRelayRunTime.Text = "继电器接通时间";
                this.labelTitleChattering.Font = new Font("새굴림", 11, FontStyle.Bold);
                this.labelTitleChattering.Text = "颤振";
                this.labelTitleLanguage.Text = "语言";
                this.labelTitleEquipmentID.Text = "设备编号";
                this.labelTitleLogin.Text = "登錄";
                this.labelExternalInputMessage1.Text = "排出确认, 气压确认, 门已打开,";
                this.labelExternalInputMessage2.Text = "积压确认, 紧急停止";
                this.labelTitleExternalInputBuzzer.Text = "蜂鸣器";
                this.labelTitleExternalInputLamp.Text = "灯";

                this.comboBoxPIN6.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN6_SelectedIndexChanged);
                this.comboBoxPIN6.Items.Clear();
                this.comboBoxPIN6.Items.Add("不使用");
                this.comboBoxPIN6.Items.Add("外部运转");
                this.comboBoxPIN6.Items.Add("气压确认");
                this.comboBoxPIN6.Items.Add("门已打开");
                this.comboBoxPIN6.Items.Add("排出确认");
                this.comboBoxPIN6.SelectedIndexChanged += new EventHandler(this.comboBoxPIN6_SelectedIndexChanged);

                this.comboBoxPIN5.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN5_SelectedIndexChanged);
                this.comboBoxPIN5.Items.Clear();
                this.comboBoxPIN5.Items.Add("不使用");
                this.comboBoxPIN5.Items.Add("外部运转");
                this.comboBoxPIN5.Items.Add("气压确认");
                this.comboBoxPIN5.Items.Add("门已打开");
                this.comboBoxPIN5.Items.Add("排出确认");
                this.comboBoxPIN5.SelectedIndexChanged += new EventHandler(this.comboBoxPIN5_SelectedIndexChanged);

                this.comboBoxPIN4.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN4_SelectedIndexChanged);
                this.comboBoxPIN4.Items.Clear();
                this.comboBoxPIN4.Items.Add("不使用");
                this.comboBoxPIN4.Items.Add("开启");
                this.comboBoxPIN4.Items.Add("外部运转");
                this.comboBoxPIN4.Items.Add("气压确认");
                this.comboBoxPIN4.Items.Add("门已打开");
                this.comboBoxPIN4.Items.Add("排出确认");
                this.comboBoxPIN4.SelectedIndexChanged += new EventHandler(this.comboBoxPIN4_SelectedIndexChanged);

                this.comboBoxPIN3.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN3_SelectedIndexChanged);
                this.comboBoxPIN3.Items.Clear();
                this.comboBoxPIN3.Items.Add("不使用");
                this.comboBoxPIN3.Items.Add("停止");
                this.comboBoxPIN3.Items.Add("外部运转");
                this.comboBoxPIN3.Items.Add("气压确认");
                this.comboBoxPIN3.Items.Add("门已打开");
                this.comboBoxPIN3.Items.Add("排出确认");
                this.comboBoxPIN3.SelectedIndexChanged += new EventHandler(this.comboBoxPIN3_SelectedIndexChanged);

                this.comboBoxPIN2.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN2_SelectedIndexChanged);
                this.comboBoxPIN2.Items.Clear();
                this.comboBoxPIN2.Items.Add("不使用");
                this.comboBoxPIN2.Items.Add("NG");
                this.comboBoxPIN2.Items.Add("外部运转");
                this.comboBoxPIN2.Items.Add("气压确认");
                this.comboBoxPIN2.Items.Add("门已打开");
                this.comboBoxPIN2.Items.Add("排出确认");
                this.comboBoxPIN2.SelectedIndexChanged += new EventHandler(this.comboBoxPIN2_SelectedIndexChanged);

                this.buttonLogin.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnON));
                this.buttonLogin.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnOFF));
                this.buttonExternalInputBuzzer.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnON));
                this.buttonExternalInputBuzzer.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnOFF));
                this.buttonExternalInputLamp.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnON));
                this.buttonExternalInputLamp.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnOFF));
                #endregion
            }
            else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
            {
            }
            else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
            {
                this.comboBoxPIN6.Font = this.comboBoxPIN5.Font = new Font("새굴림", 12, FontStyle.Bold);
                this.comboBoxPIN4.Font = this.comboBoxPIN3.Font = this.comboBoxPIN2.Font = new Font("새굴림", 12, FontStyle.Bold);

                #region Russian
                this.labelTitleBuzzerONTime.Font = new Font("새굴림", 8, FontStyle.Bold);
                this.labelTitleBuzzerONTime.Text = "Длительность звуковога сигнала";
                this.labelTitleRelayRunTime.Font = new Font("새굴림", 10, FontStyle.Bold);
                this.labelTitleRelayRunTime.Text = "Длительность включения реле ";
                this.labelTitleChattering.Font = new Font("새굴림", 11, FontStyle.Bold);
                this.labelTitleChattering.Text = "Стабилизация веса";
                this.labelTitleLanguage.Text = "Язык";
                this.labelTitleEquipmentID.Text = "ID оборудования";
                this.labelTitleLogin.Text = "Логин";
                this.labelExternalInputMessage1.Text = "Аврийная остановка/закрытия дверцы";
                this.labelExternalInputMessage2.Text = "разрядки/давления/очередности";
                this.labelTitleExternalInputBuzzer.Text = "Сигнал";
                this.labelTitleExternalInputLamp.Text = "лампа";

                this.comboBoxPIN6.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN6_SelectedIndexChanged);
                this.comboBoxPIN6.Items.Clear();
                this.comboBoxPIN6.Items.Add("Нет");
                this.comboBoxPIN6.Items.Add("Внешнее управление");
                this.comboBoxPIN6.Items.Add("Проверка давления");
                this.comboBoxPIN6.Items.Add("Проверка закрытия дверцы");
                this.comboBoxPIN6.Items.Add("Проверка разрядки");
                this.comboBoxPIN6.SelectedIndexChanged += new EventHandler(this.comboBoxPIN6_SelectedIndexChanged);

                this.comboBoxPIN5.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN5_SelectedIndexChanged);
                this.comboBoxPIN5.Items.Clear();
                this.comboBoxPIN5.Items.Add("Нет");
                this.comboBoxPIN5.Items.Add("Внешнее управление");
                this.comboBoxPIN5.Items.Add("Проверка давления");
                this.comboBoxPIN5.Items.Add("Проверка закрытия дверцы");
                this.comboBoxPIN5.Items.Add("Проверка разрядки");
                this.comboBoxPIN5.SelectedIndexChanged += new EventHandler(this.comboBoxPIN5_SelectedIndexChanged);

                this.comboBoxPIN4.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN4_SelectedIndexChanged);
                this.comboBoxPIN4.Items.Clear();
                this.comboBoxPIN4.Items.Add("Нет");
                this.comboBoxPIN4.Items.Add("Старт");
                this.comboBoxPIN4.Items.Add("Внешнее управление");
                this.comboBoxPIN4.Items.Add("Проверка давления");
                this.comboBoxPIN4.Items.Add("Проверка закрытия дверцы");
                this.comboBoxPIN4.Items.Add("Проверка разрядки");
                this.comboBoxPIN4.SelectedIndexChanged += new EventHandler(this.comboBoxPIN4_SelectedIndexChanged);

                this.comboBoxPIN3.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN3_SelectedIndexChanged);
                this.comboBoxPIN3.Items.Clear();
                this.comboBoxPIN3.Items.Add("Нет");
                this.comboBoxPIN3.Items.Add("Стоп");
                this.comboBoxPIN3.Items.Add("Внешнее управление");
                this.comboBoxPIN3.Items.Add("Проверка давления");
                this.comboBoxPIN3.Items.Add("Проверка закрытия дверцы");
                this.comboBoxPIN3.Items.Add("Проверка разрядки");
                this.comboBoxPIN3.SelectedIndexChanged += new EventHandler(this.comboBoxPIN3_SelectedIndexChanged);

                this.comboBoxPIN2.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN2_SelectedIndexChanged);
                this.comboBoxPIN2.Items.Clear();
                this.comboBoxPIN2.Items.Add("Нет");
                this.comboBoxPIN2.Items.Add("Другие неисправности");
                this.comboBoxPIN2.Items.Add("Внешнее управление");
                this.comboBoxPIN2.Items.Add("Проверка давления");
                this.comboBoxPIN2.Items.Add("Проверка закрытия дверцы");
                this.comboBoxPIN2.Items.Add("Проверка разрядки");
                this.comboBoxPIN2.SelectedIndexChanged += new EventHandler(this.comboBoxPIN2_SelectedIndexChanged);
                           
                this.buttonLogin.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusON));
                this.buttonLogin.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusOFF));
                this.buttonExternalInputBuzzer.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusON));
                this.buttonExternalInputBuzzer.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusOFF));
                this.buttonExternalInputLamp.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusON));
                this.buttonExternalInputLamp.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusOFF));
                #endregion
            }
            else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
            {
                #region German
                this.labelTitleBuzzerONTime.Font = new Font("새굴림", 11, FontStyle.Bold);
                this.labelTitleBuzzerONTime.Text = "Summer-Einschaltzeit";
                this.labelTitleRelayRunTime.Font = new Font("새굴림", 11, FontStyle.Bold);
                this.labelTitleRelayRunTime.Text = "Relais-Einschaltzeit";
                this.labelTitleChattering.Font = new Font("새굴림", 10, FontStyle.Bold);
                this.labelTitleChattering.Text = "Beruhigung des Dehnungsmessers";
                this.labelTitleLanguage.Text = "Sprache";
                this.labelTitleEquipmentID.Text = "ID-Vorrichtung";
                this.labelTitleLogin.Text = "Einloggen";
                this.labelExternalInputMessage1.Text = "Not-Halt/Entladung/Luft/Tür Prüfen";
                this.labelExternalInputMessage2.Text = "/Stapeln Sie Prüfen";
                this.labelTitleExternalInputBuzzer.Text = "Summer";
                this.labelTitleExternalInputLamp.Text = "Ampel";

                this.comboBoxPIN6.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN6_SelectedIndexChanged);
                this.comboBoxPIN6.Items.Clear();
                this.comboBoxPIN6.Items.Add("Keiner");
                this.comboBoxPIN6.Items.Add("Externer Betrieb");
                this.comboBoxPIN6.Items.Add("Luft Prüfen");
                this.comboBoxPIN6.Items.Add("Tür Prüfen");
                this.comboBoxPIN6.Items.Add("Entladung Prüfen");
                this.comboBoxPIN6.SelectedIndexChanged += new EventHandler(this.comboBoxPIN6_SelectedIndexChanged);

                this.comboBoxPIN5.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN5_SelectedIndexChanged);
                this.comboBoxPIN5.Items.Clear();
                this.comboBoxPIN5.Items.Add("Keiner");
                this.comboBoxPIN5.Items.Add("Externer Betrieb");
                this.comboBoxPIN5.Items.Add("Luft Prüfen");
                this.comboBoxPIN5.Items.Add("Tür Prüfen");
                this.comboBoxPIN5.Items.Add("Entladung Prüfen");
                this.comboBoxPIN5.SelectedIndexChanged += new EventHandler(this.comboBoxPIN5_SelectedIndexChanged);

                this.comboBoxPIN4.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN4_SelectedIndexChanged);
                this.comboBoxPIN4.Items.Clear();
                this.comboBoxPIN4.Items.Add("Keiner");
                this.comboBoxPIN4.Items.Add("START");
                this.comboBoxPIN4.Items.Add("Externer Betrieb");
                this.comboBoxPIN4.Items.Add("Luft Prüfen");
                this.comboBoxPIN4.Items.Add("Tür Prüfen");
                this.comboBoxPIN4.Items.Add("Entladung Prüfen");
                this.comboBoxPIN4.SelectedIndexChanged += new EventHandler(this.comboBoxPIN4_SelectedIndexChanged);

                this.comboBoxPIN3.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN3_SelectedIndexChanged);
                this.comboBoxPIN3.Items.Clear();
                this.comboBoxPIN3.Items.Add("Keiner");
                this.comboBoxPIN3.Items.Add("STOPP");
                this.comboBoxPIN3.Items.Add("Externer Betrieb");
                this.comboBoxPIN3.Items.Add("Luft Prüfen");
                this.comboBoxPIN3.Items.Add("Tür Prüfen");
                this.comboBoxPIN3.Items.Add("Entladung Prüfen");
                this.comboBoxPIN3.SelectedIndexChanged += new EventHandler(this.comboBoxPIN3_SelectedIndexChanged);

                this.comboBoxPIN2.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN2_SelectedIndexChanged);
                this.comboBoxPIN2.Items.Clear();
                this.comboBoxPIN2.Items.Add("Keiner");
                this.comboBoxPIN2.Items.Add("NG");
                this.comboBoxPIN2.Items.Add("Externer Betrieb");
                this.comboBoxPIN2.Items.Add("Luft Prüfen");
                this.comboBoxPIN2.Items.Add("Tür Prüfen");
                this.comboBoxPIN2.Items.Add("Entladung Prüfen");
                this.comboBoxPIN2.SelectedIndexChanged += new EventHandler(this.comboBoxPIN2_SelectedIndexChanged);

                this.buttonLogin.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerON));
                this.buttonLogin.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerOFF));
                this.buttonExternalInputBuzzer.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerON));
                this.buttonExternalInputBuzzer.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerOFF));
                this.buttonExternalInputLamp.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerON));
                this.buttonExternalInputLamp.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerOFF));
                #endregion
            }
            else
            {
                #region Korean
                this.labelTitleBuzzerONTime.Font = new Font("새굴림", 11, FontStyle.Bold);
                this.labelTitleBuzzerONTime.Text = "부저 ON 시간";
                this.labelTitleRelayRunTime.Font = new Font("새굴림", 11, FontStyle.Bold);
                this.labelTitleRelayRunTime.Text = "릴레이 동작 시간";
                this.labelTitleChattering.Font = new Font("새굴림", 11, FontStyle.Bold);
                this.labelTitleChattering.Text = "채터링감지";
                this.labelTitleLanguage.Text = "언어설정";
                this.labelTitleEquipmentID.Text = "장비 ID";
                this.labelTitleLogin.Text = "로그인";
                this.labelExternalInputMessage1.Text = "배출, 공압, 문열림, 비상정지, 적체";
                this.labelExternalInputMessage2.Text = "";
                this.labelTitleExternalInputBuzzer.Text = "부저";
                this.labelTitleExternalInputLamp.Text = "램프";

                this.comboBoxPIN6.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN6_SelectedIndexChanged);
                this.comboBoxPIN6.Items.Clear();
                this.comboBoxPIN6.Items.Add("사용안함");
                this.comboBoxPIN6.Items.Add("외부운전");
                this.comboBoxPIN6.Items.Add("공압확인");
                this.comboBoxPIN6.Items.Add("문열림감지");
                this.comboBoxPIN6.Items.Add("배출확인");
                this.comboBoxPIN6.SelectedIndexChanged += new EventHandler(this.comboBoxPIN6_SelectedIndexChanged);

                this.comboBoxPIN5.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN5_SelectedIndexChanged);
                this.comboBoxPIN5.Items.Clear();
                this.comboBoxPIN5.Items.Add("사용안함");
                this.comboBoxPIN5.Items.Add("외부운전");
                this.comboBoxPIN5.Items.Add("공압확인");
                this.comboBoxPIN5.Items.Add("문열림감지");
                this.comboBoxPIN5.Items.Add("배출확인");
                this.comboBoxPIN5.SelectedIndexChanged += new EventHandler(this.comboBoxPIN5_SelectedIndexChanged);

                this.comboBoxPIN4.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN4_SelectedIndexChanged);
                this.comboBoxPIN4.Items.Clear();
                this.comboBoxPIN4.Items.Add("사용안함");
                this.comboBoxPIN4.Items.Add("START");
                this.comboBoxPIN4.Items.Add("외부운전");
                this.comboBoxPIN4.Items.Add("공압확인");
                this.comboBoxPIN4.Items.Add("문열림감지");
                this.comboBoxPIN4.Items.Add("배출확인");
                this.comboBoxPIN4.SelectedIndexChanged += new EventHandler(this.comboBoxPIN4_SelectedIndexChanged);

                this.comboBoxPIN3.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN3_SelectedIndexChanged);
                this.comboBoxPIN3.Items.Clear();
                this.comboBoxPIN3.Items.Add("사용안함");
                this.comboBoxPIN3.Items.Add("STOP");
                this.comboBoxPIN3.Items.Add("외부운전");
                this.comboBoxPIN3.Items.Add("공압확인");
                this.comboBoxPIN3.Items.Add("문열림감지");
                this.comboBoxPIN3.Items.Add("배출확인");
                this.comboBoxPIN3.SelectedIndexChanged += new EventHandler(this.comboBoxPIN3_SelectedIndexChanged);

                this.comboBoxPIN2.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN2_SelectedIndexChanged);
                this.comboBoxPIN2.Items.Clear();
                this.comboBoxPIN2.Items.Add("사용안함");
                this.comboBoxPIN2.Items.Add("NG");
                this.comboBoxPIN2.Items.Add("외부운전");
                this.comboBoxPIN2.Items.Add("공압확인");
                this.comboBoxPIN2.Items.Add("문열림감지");
                this.comboBoxPIN2.Items.Add("배출확인");
                this.comboBoxPIN2.SelectedIndexChanged += new EventHandler(this.comboBoxPIN2_SelectedIndexChanged);

                this.buttonLogin.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engON));
                this.buttonLogin.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engOFF));
                this.buttonExternalInputBuzzer.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engON));
                this.buttonExternalInputBuzzer.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engOFF));
                this.buttonExternalInputLamp.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engON));
                this.buttonExternalInputLamp.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engOFF));
                #endregion
            }
        }
        private void DefaultSetting()
        {
            this.comboBoxLanguage.SelectedIndexChanged -= new EventHandler(this.comboBoxLanguage_SelectedIndexChanged);
            this.comboBoxLanguage.Items.Clear();
            this.comboBoxLanguage.Items.Add("한국어");
            this.comboBoxLanguage.Items.Add("English");
            this.comboBoxLanguage.Items.Add("Deutsch");
            this.comboBoxLanguage.Items.Add("中文");
            this.comboBoxLanguage.Items.Add("русский");
            this.comboBoxLanguage.SelectedIndexChanged += new EventHandler(this.comboBoxLanguage_SelectedIndexChanged);
        }

        public void DisplayHiddenMenu(bool bValue)
        {
            this.buttonCapture.Visible = bValue;
        }
        private void UpdateParameterDisplay(SystemConfigurationItem1 item, SystemConfigurationItem2 item2, SystemParameter1 parameter)
        {
            string value = "";
            int index = 0;

            // Equipment ID
            value = item.EquipmentID.ToString();
            if (this.labelEquipmentID.Text != value)
                this.labelEquipmentID.Text = value;

            // 언어
            index = (int)item.Language;
            if (this.comboBoxLanguage.SelectedIndex != index)
            {
                this.comboBoxLanguage.SelectedIndexChanged -= new EventHandler(this.comboBoxLanguage_SelectedIndexChanged);
                this.comboBoxLanguage.SelectedIndex = index;
                this.comboBoxLanguage.SelectedIndexChanged += new EventHandler(this.comboBoxLanguage_SelectedIndexChanged);
            }

            // 로그인
            if (item.IsLogin == false)
                this.buttonLogin.ButtonUp();
            else
                this.buttonLogin.ButtonDown();

            // 부저ON시간
            value = parameter.BuzzerOnTime.Trim();
            if (this.labelBuzzerOnTime.Text != value)
                this.labelBuzzerOnTime.Text = value;

            // 릴레이동작시간
            value = parameter.RelayOnTime.Trim();
            if (this.labelRelayOnTime.Text != value)
                this.labelRelayOnTime.Text = value;

            // 채터링감지
            value = parameter.Chattering.Trim();
            if (this.labelChattering.Text != value)
                this.labelChattering.Text = value;
            
            // 입력포트
            index = parameter.PI6;
            if (this.comboBoxPIN6.SelectedIndex != index)
            {
                this.comboBoxPIN6.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN6_SelectedIndexChanged);
                this.comboBoxPIN6.SelectedIndex = index;
                this.comboBoxPIN6.SelectedIndexChanged += new EventHandler(this.comboBoxPIN6_SelectedIndexChanged);
            }
            index = parameter.PI5;
            if (this.comboBoxPIN5.SelectedIndex != index)
            {
                this.comboBoxPIN5.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN5_SelectedIndexChanged);
                this.comboBoxPIN5.SelectedIndex = index;
                this.comboBoxPIN5.SelectedIndexChanged += new EventHandler(this.comboBoxPIN5_SelectedIndexChanged);
            }
            index = parameter.PI4;
            if (this.comboBoxPIN4.SelectedIndex != index)
            {
                this.comboBoxPIN4.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN4_SelectedIndexChanged);
                this.comboBoxPIN4.SelectedIndex = index;
                this.comboBoxPIN4.SelectedIndexChanged += new EventHandler(this.comboBoxPIN4_SelectedIndexChanged);
            }
            index = parameter.PI3;
            if (this.comboBoxPIN3.SelectedIndex != index)
            {
                this.comboBoxPIN3.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN3_SelectedIndexChanged);
                this.comboBoxPIN3.SelectedIndex = index;
                this.comboBoxPIN3.SelectedIndexChanged += new EventHandler(this.comboBoxPIN3_SelectedIndexChanged);
            }
            index = parameter.PI2;
            if (this.comboBoxPIN2.SelectedIndex != index)
            {
                this.comboBoxPIN2.SelectedIndexChanged -= new EventHandler(this.comboBoxPIN2_SelectedIndexChanged);
                this.comboBoxPIN2.SelectedIndex = index;
                this.comboBoxPIN2.SelectedIndexChanged += new EventHandler(this.comboBoxPIN2_SelectedIndexChanged);
            }

            // 외부 입력 시 부저/램프
            if (item.IsExternalInputBuzzer == false)
                this.buttonExternalInputBuzzer.ButtonUp();
            else
                this.buttonExternalInputBuzzer.ButtonDown();

            if (item.IsExternalInputLamp == false)
                this.buttonExternalInputLamp.ButtonUp();
            else
                this.buttonExternalInputLamp.ButtonDown();
        }
        private void UpdateUserPasswordDisplay(UserPasswordType user)
        {
            if (this.labelUser1Password.Text != user.Level1Password)
                this.labelUser1Password.Text = user.Level1Password;

            if (this.labelUser2Password.Text != user.Level2Password)
                this.labelUser2Password.Text = user.Level2Password;

            if (this.labelUser3Password.Text != user.Level3Password)
                this.labelUser3Password.Text = user.Level3Password;
        }

        private void UpdateDisplayUser(UserItem user)
        {
            if (user.Group == DataStore.UserGroup.Level4Developer && this.ParentForm.ParentForm.SystemConfig1.IsLogin == true)
                this.DisplayHiddenMenu(true);
            else
                this.DisplayHiddenMenu(false);
        }

        public void DisplayRefresh(SystemStatus status)
        {
            this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.EquipFuctionSetting;
            this.ParentForm.ParentForm.SetDisplayMode(DataStore.DisplayMode.Menu);
            this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);

            this.UpdateUserPasswordDisplay(this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType);
            this.UpdateParameterDisplay(this.ParentForm.ParentForm.SystemConfig1, this.ParentForm.ParentForm.SystemConfig2, 
                this.ParentForm.ParentForm.CurrentSystemParameter1);
            this.UpdateDisplayUser(status.CurrentUser);
        }
        #endregion

        #region Event Handler
        private void labelEquipmentID_Click(object sender, EventArgs e)
        {
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelEquipmentID.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 9999)
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.labelEquipmentID.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.SystemConfig1.EquipmentID = myKeyPad.IntValue;
                    this.ParentForm.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.ParentForm.SystemConfig1);
                }
            }
        }
        private void labelBuzzerOnTime_Click(object sender, EventArgs e)
        {
            string value = "";
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelBuzzerOnTime.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.labelBuzzerOnTime.Text = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(this.labelBuzzerOnTime.Text);
                    this.ParentForm.ParentForm.CurrentSystemParameter1.BuzzerOnTime = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.SaveSystemParameter1File(this.ParentForm.ParentForm.CurrentSystemParameter1);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.BuzzerOnTime, value);
                }
            }
        }
        private void labelRelayOnTime_Click(object sender, EventArgs e)
        {
            string value = "";
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelRelayOnTime.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.labelRelayOnTime.Text = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(this.labelRelayOnTime.Text);
                    this.ParentForm.ParentForm.CurrentSystemParameter1.RelayOnTime = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.SaveSystemParameter1File(this.ParentForm.ParentForm.CurrentSystemParameter1);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.RelayRunTime, value);
                }
            }
        }
        private void labelChattering_Click(object sender, EventArgs e)
        {
            string value = "";
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelChattering.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 500)
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.labelChattering.Text = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(this.labelChattering.Text);
                    this.ParentForm.ParentForm.CurrentSystemParameter1.Chattering = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.SaveSystemParameter1File(this.ParentForm.ParentForm.CurrentSystemParameter1);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.Chattering, value);
                }
            }
        }
        private void comboBoxLanguage_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.comboBoxLanguage.SelectedIndex == 0)
                this.ParentForm.ParentForm.SystemConfig1.Language = DataStore.LanguageID.Korean;
            else if (this.comboBoxLanguage.SelectedIndex == 1)
                this.ParentForm.ParentForm.SystemConfig1.Language = DataStore.LanguageID.English;
            else if (this.comboBoxLanguage.SelectedIndex == 2)
                this.ParentForm.ParentForm.SystemConfig1.Language = DataStore.LanguageID.German;
            else if (this.comboBoxLanguage.SelectedIndex == 3)
                this.ParentForm.ParentForm.SystemConfig1.Language = DataStore.LanguageID.Chinese;
            else if (this.comboBoxLanguage.SelectedIndex == 4)
                this.ParentForm.ParentForm.SystemConfig1.Language = DataStore.LanguageID.Russian;
            else
                this.ParentForm.ParentForm.SystemConfig1.Language = DataStore.LanguageID.Korean;

            this.ParentForm.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.ParentForm.SystemConfig1);

            // 각 화면 언어 적용
            SmartSplash splash = new SmartSplash();
            splash.CenterPosition = true;
            splash.AnimationInterval = 200;
            splash.LoadingImagePathname = "SmartLoading4";
            splash.Start();

            this.ParentForm.ParentForm.ChildFormMainDisplay.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.InitializeDesign();
            Thread.Sleep(50);

            this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayMenu.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayStart.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayStartGraph.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayStartList.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayStopDataStatistics.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayWeightBigScreen.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayWeightSmall.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayFeedback.InitializeDesign();
            Thread.Sleep(50);

            this.ParentForm.ParentForm.ChildFormMenu.CenterBasicDataBackup.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterBasicDataStatistics.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterBasicHelp.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterBasicProduct.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterBasicProduct.ControlRandomMode.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterBasicTime.InitializeDesign();
            Thread.Sleep(50);

            this.ParentForm.ParentForm.ChildFormMenu.CenterConfiCountingOutput.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterConfiEthernet.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterConfiHelp.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterConfiOption.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterConfiOptionBoard.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterConfiSerial.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterConfiEthernet.ControlEthernetLocalIP.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterConfiSerial.ControlBarcode.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterConfiSerial.ControlHitachi.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterConfiSerial.ControlMarkoprint.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterConfiSerial.ControlUserDefine.InitializeDesign();
            Thread.Sleep(50);

            this.ParentForm.ParentForm.ChildFormMenu.CenterEquipFunctionSetting.InitializeDesign();
            this.UpdateParameterDisplay(this.ParentForm.ParentForm.SystemConfig1, this.ParentForm.ParentForm.SystemConfig2, 
                this.ParentForm.ParentForm.CurrentSystemParameter1);
            this.ParentForm.ParentForm.ChildFormMenu.CenterEquipHelp.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterEquipInitialize.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterEquipTest.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterEquipUpdate.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterEquipUser.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterEquipEngineer.InitializeDesign();
            Thread.Sleep(50);

            this.ParentForm.ParentForm.ChildFormMenu.CenterInforAS.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterInforHelp.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem2.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.InitializeDesign();
            Thread.Sleep(50);

            this.ParentForm.ParentForm.ChildFormMenu.CenterSystemCalibration.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterSystemExternalOutput.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterSystemHelp.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterSystemIOTest.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterSystemJudgmentManual.InitializeDesign();
            this.ParentForm.ParentForm.ChildFormMenu.CenterSystemSorterSetting.InitializeDesign();
            Thread.Sleep(50);

            this.ParentForm.ParentForm.ChildFormMenu.CenterInforAS.DefaultSetting();

            splash.Finish();
        }
        
        private void comboBoxPIN6_SelectedIndexChanged(object sender, EventArgs e)
        {
            string value = "";

            if (this.comboBoxPIN6.SelectedIndex == 1)
            {
                value = Helper.StringZeroFillDigits4("1");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI6 = 1;
            }
            else
            {
                value = Helper.StringZeroFillDigits4("0");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI6 = 0;
            }

            this.ParentForm.ParentForm.SaveSystemParameter1File(this.ParentForm.ParentForm.CurrentSystemParameter1);
            this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.PI6, value);
        }
        private void comboBoxPIN5_SelectedIndexChanged(object sender, EventArgs e)
        {
            string value = "";

            if (this.comboBoxPIN5.SelectedIndex == 1)
            {
                value = Helper.StringZeroFillDigits4("1");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI5 = 1;
            }
            else if (this.comboBoxPIN5.SelectedIndex == 2)
            {
                value = Helper.StringZeroFillDigits4("2");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI5 = 2;
            }
            else if (this.comboBoxPIN5.SelectedIndex == 3)
            {
                value = Helper.StringZeroFillDigits4("3");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI5 = 3;
            }
            else
            {
                value = Helper.StringZeroFillDigits4("0");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI5 = 0;
            }

            this.ParentForm.ParentForm.SaveSystemParameter1File(this.ParentForm.ParentForm.CurrentSystemParameter1);
            this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.PI5, value);
        }
        private void comboBoxPIN4_SelectedIndexChanged(object sender, EventArgs e)
        {
            string value = "";

            if (this.comboBoxPIN4.SelectedIndex == 1)
            {
                value = Helper.StringZeroFillDigits4("1");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI4 = 1;
            }
            else if (this.comboBoxPIN4.SelectedIndex == 2)
            {
                value = Helper.StringZeroFillDigits4("2");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI4 = 2;
            }
            else
            {
                value = Helper.StringZeroFillDigits4("0");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI4 = 0;
            }

            this.ParentForm.ParentForm.SaveSystemParameter1File(this.ParentForm.ParentForm.CurrentSystemParameter1);
            this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.PI4, value);
        }
        private void comboBoxPIN3_SelectedIndexChanged(object sender, EventArgs e)
        {
            string value = "";

            if (this.comboBoxPIN3.SelectedIndex == 1)
            {
                value = Helper.StringZeroFillDigits4("1");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI3 = 1;
            }
            else
            {
                value = Helper.StringZeroFillDigits4("0");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI3 = 0;
            }

            this.ParentForm.ParentForm.SaveSystemParameter1File(this.ParentForm.ParentForm.CurrentSystemParameter1);
            this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.PI3, value);
        }
        private void comboBoxPIN2_SelectedIndexChanged(object sender, EventArgs e)
        {
            string value = "";

            if (this.comboBoxPIN2.SelectedIndex == 1)
            {
                value = Helper.StringZeroFillDigits4("1");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI2 = 1;
            }
            else if (this.comboBoxPIN2.SelectedIndex == 2)
            {
                value = Helper.StringZeroFillDigits4("2");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI2 = 2;
            }
            else
            {
                value = Helper.StringZeroFillDigits4("0");
                this.ParentForm.ParentForm.CurrentSystemParameter1.PI2 = 0;
            }

            this.ParentForm.ParentForm.SaveSystemParameter1File(this.ParentForm.ParentForm.CurrentSystemParameter1);
            this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.PI2, value);
        }

        private void buttonLogin_Click(object sender, EventArgs e)
        {
            DialogFormYesNo myDlg;

            if (this.buttonLogin.ButtonStatus == SmartX.SmartButton.BUTSTATUS.UP)
                myDlg = new DialogFormYesNo(this.ParentForm.ParentForm.SystemConfig1.Language, 16);
            else
                myDlg = new DialogFormYesNo(this.ParentForm.ParentForm.SystemConfig1.Language, 15);

            if (myDlg.ShowDialog() == DialogResult.Yes)
            {
                if (this.buttonLogin.ButtonStatus == SmartX.SmartButton.BUTSTATUS.UP)
                    this.ParentForm.ParentForm.SystemConfig1.IsLogin = false;
                else
                    this.ParentForm.ParentForm.SystemConfig1.IsLogin = true;

                this.ParentForm.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.ParentForm.SystemConfig1);

                DialogFormMessage msg = new DialogFormMessage(18, this.ParentForm.ParentForm.SystemConfig1.Language);
                msg.ShowDialog();
            }
            else
            {
                if (this.ParentForm.ParentForm.SystemConfig1.IsLogin == false)
                    this.buttonLogin.ButtonUp();
                else
                    this.buttonLogin.ButtonDown();
            }
        }
        private void buttonExternalInputBuzzer_Click(object sender, EventArgs e)
        {
            if (this.buttonExternalInputBuzzer.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                this.ParentForm.ParentForm.SystemConfig1.IsExternalInputBuzzer = true;
            else
                this.ParentForm.ParentForm.SystemConfig1.IsExternalInputBuzzer = false;

            this.ParentForm.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.ParentForm.SystemConfig1);
        }
        private void buttonExternalInputLamp_Click(object sender, EventArgs e)
        {
            if (this.buttonExternalInputLamp.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                this.ParentForm.ParentForm.SystemConfig1.IsExternalInputLamp = true;
            else
                this.ParentForm.ParentForm.SystemConfig1.IsExternalInputLamp = false;

            this.ParentForm.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.ParentForm.SystemConfig1);
        }

        private void labelUser1Password_Click(object sender, EventArgs e)
        {
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelUser1Password.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.StringValue.Length != 4)
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.labelUser1Password.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType.Level1Password = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.SaveUserGroupPasswordFile(this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType);
                }
            }
        }
        private void labelUser2Password_Click(object sender, EventArgs e)
        {
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelUser2Password.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.StringValue.Length != 4)
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.labelUser2Password.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType.Level2Password = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.SaveUserGroupPasswordFile(this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType);
                }
            }
        }
        private void labelUser3Password_Click(object sender, EventArgs e)
        {
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelUser3Password.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.StringValue.Length != 4)
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.labelUser3Password.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType.Level3Password = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.SaveUserGroupPasswordFile(this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType);
                }
            }
        }

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

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