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 ITC81DB_2H.Forms;
using ITC81DB_2H.DialogForms;
using ITC81DB_2H_ImageDll;
using ITC81DB_2H.Datastore;

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

        #region Constructor
        public ControlCenterSystemExternalOutput(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 == Define.E_LanguageID.English)
            {
                #region English
                this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundExternalOutput));

                this.comboBoxSorter1Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter1Mode_SelectedIndexChanged);
                this.comboBoxSorter1Mode.Items.Clear();
                this.comboBoxSorter1Mode.Items.Add("None");
                this.comboBoxSorter1Mode.Items.Add("Over");
                this.comboBoxSorter1Mode.Items.Add("Under");
                this.comboBoxSorter1Mode.Items.Add("NG");
                this.comboBoxSorter1Mode.Items.Add("Pass");
                this.comboBoxSorter1Mode.Items.Add("Run");
                this.comboBoxSorter1Mode.Items.Add("Count");
                //this.comboBoxSorter1Mode.Items.Add("Counting output1");
                //this.comboBoxSorter1Mode.Items.Add("Counting output2");
                //this.comboBoxSorter1Mode.Items.Add("ExNG");
                this.comboBoxSorter1Mode.Items.Add("Latch control");
                this.comboBoxSorter1Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter1Mode_SelectedIndexChanged);

                this.comboBoxSorter2Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter2Mode_SelectedIndexChanged);
                this.comboBoxSorter2Mode.Items.Clear();
                this.comboBoxSorter2Mode.Items.Add("None");
                this.comboBoxSorter2Mode.Items.Add("Over");
                this.comboBoxSorter2Mode.Items.Add("Under");
                this.comboBoxSorter2Mode.Items.Add("NG");
                this.comboBoxSorter2Mode.Items.Add("Pass");
                this.comboBoxSorter2Mode.Items.Add("Run");
                this.comboBoxSorter2Mode.Items.Add("Count");
                //this.comboBoxSorter2Mode.Items.Add("Counting output1");
                //this.comboBoxSorter2Mode.Items.Add("Counting output2");
                //this.comboBoxSorter2Mode.Items.Add("ExNG");
                this.comboBoxSorter2Mode.Items.Add("Latch control");
                this.comboBoxSorter2Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter2Mode_SelectedIndexChanged);

                this.comboBoxSorter3Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter3Mode_SelectedIndexChanged);
                this.comboBoxSorter3Mode.Items.Clear();
                this.comboBoxSorter3Mode.Items.Add("None");
                this.comboBoxSorter3Mode.Items.Add("Over");
                this.comboBoxSorter3Mode.Items.Add("Under");
                this.comboBoxSorter3Mode.Items.Add("NG");
                this.comboBoxSorter3Mode.Items.Add("Pass");
                this.comboBoxSorter3Mode.Items.Add("Run");
                this.comboBoxSorter3Mode.Items.Add("Count");
                //this.comboBoxSorter3Mode.Items.Add("Counting output1");
                //this.comboBoxSorter3Mode.Items.Add("Counting output2");
                //this.comboBoxSorter3Mode.Items.Add("ExNG");
                this.comboBoxSorter3Mode.Items.Add("Latch control");
                this.comboBoxSorter3Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter3Mode_SelectedIndexChanged);

                this.comboBoxSorter4Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter4Mode_SelectedIndexChanged);
                this.comboBoxSorter4Mode.Items.Clear();
                this.comboBoxSorter4Mode.Items.Add("None");
                this.comboBoxSorter4Mode.Items.Add("Over");
                this.comboBoxSorter4Mode.Items.Add("Under");
                this.comboBoxSorter4Mode.Items.Add("NG");
                this.comboBoxSorter4Mode.Items.Add("Pass");
                this.comboBoxSorter4Mode.Items.Add("Run");
                this.comboBoxSorter4Mode.Items.Add("Count");
                //this.comboBoxSorter4Mode.Items.Add("Counting output1");
                //this.comboBoxSorter4Mode.Items.Add("Counting output2");
                //this.comboBoxSorter4Mode.Items.Add("ExNG");
                this.comboBoxSorter4Mode.Items.Add("Latch control");
                this.comboBoxSorter4Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter4Mode_SelectedIndexChanged);

                this.comboBoxSorter5Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter5Mode_SelectedIndexChanged);
                this.comboBoxSorter5Mode.Items.Clear();
                this.comboBoxSorter5Mode.Items.Add("None");
                this.comboBoxSorter5Mode.Items.Add("Over");
                this.comboBoxSorter5Mode.Items.Add("Under");
                this.comboBoxSorter5Mode.Items.Add("NG");
                this.comboBoxSorter5Mode.Items.Add("Pass");
                this.comboBoxSorter5Mode.Items.Add("Run");
                this.comboBoxSorter5Mode.Items.Add("Count");
                //this.comboBoxSorter5Mode.Items.Add("Counting output1");
                //this.comboBoxSorter5Mode.Items.Add("Counting output2");
                //this.comboBoxSorter5Mode.Items.Add("ExNG");
                this.comboBoxSorter5Mode.Items.Add("Latch control");
                this.comboBoxSorter5Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter5Mode_SelectedIndexChanged);

                this.comboBoxSorter6Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter6Mode_SelectedIndexChanged);
                this.comboBoxSorter6Mode.Items.Clear();
                this.comboBoxSorter6Mode.Items.Add("None");
                this.comboBoxSorter6Mode.Items.Add("Over");
                this.comboBoxSorter6Mode.Items.Add("Under");
                this.comboBoxSorter6Mode.Items.Add("NG");
                this.comboBoxSorter6Mode.Items.Add("Pass");
                this.comboBoxSorter6Mode.Items.Add("Run");
                this.comboBoxSorter6Mode.Items.Add("Count");
                //this.comboBoxSorter6Mode.Items.Add("Counting output1");
                //this.comboBoxSorter6Mode.Items.Add("Counting output2");
                //this.comboBoxSorter6Mode.Items.Add("ExNG");
                this.comboBoxSorter6Mode.Items.Add("Latch control");
                this.comboBoxSorter6Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter6Mode_SelectedIndexChanged);
                #endregion
            }
            else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
            {
                #region Chinese
                this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundExternalOutput));

                this.comboBoxSorter1Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter1Mode_SelectedIndexChanged);
                this.comboBoxSorter1Mode.Items.Clear();
                this.comboBoxSorter1Mode.Items.Add("不使用");
                this.comboBoxSorter1Mode.Items.Add("超过");
                this.comboBoxSorter1Mode.Items.Add("低于");
                this.comboBoxSorter1Mode.Items.Add("不良");
                this.comboBoxSorter1Mode.Items.Add("通过");
                this.comboBoxSorter1Mode.Items.Add("运行");
                this.comboBoxSorter1Mode.Items.Add("计数");
                //this.comboBoxSorter1Mode.Items.Add("计数输出1");
                //this.comboBoxSorter1Mode.Items.Add("计数输出2");
                //this.comboBoxSorter1Mode.Items.Add("其他不良");
                //this.comboBoxSorter1Mode.Items.Add("闩锁控制");
                this.comboBoxSorter1Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter1Mode_SelectedIndexChanged);

                this.comboBoxSorter2Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter2Mode_SelectedIndexChanged);
                this.comboBoxSorter2Mode.Items.Clear();
                this.comboBoxSorter2Mode.Items.Add("不使用");
                this.comboBoxSorter2Mode.Items.Add("超过");
                this.comboBoxSorter2Mode.Items.Add("低于");
                this.comboBoxSorter2Mode.Items.Add("不良");
                this.comboBoxSorter2Mode.Items.Add("通过");
                this.comboBoxSorter2Mode.Items.Add("运行");
                this.comboBoxSorter2Mode.Items.Add("计数");
                //this.comboBoxSorter2Mode.Items.Add("计数输出1");
                //this.comboBoxSorter2Mode.Items.Add("计数输出2");
                //this.comboBoxSorter2Mode.Items.Add("其他不良");
                //this.comboBoxSorter2Mode.Items.Add("闩锁控制");
                this.comboBoxSorter2Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter2Mode_SelectedIndexChanged);

                this.comboBoxSorter3Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter3Mode_SelectedIndexChanged);
                this.comboBoxSorter3Mode.Items.Clear();
                this.comboBoxSorter3Mode.Items.Add("不使用");
                this.comboBoxSorter3Mode.Items.Add("超过");
                this.comboBoxSorter3Mode.Items.Add("低于");
                this.comboBoxSorter3Mode.Items.Add("不良");
                this.comboBoxSorter3Mode.Items.Add("通过");
                this.comboBoxSorter3Mode.Items.Add("运行");
                this.comboBoxSorter3Mode.Items.Add("计数");
                //this.comboBoxSorter3Mode.Items.Add("计数输出1");
                //this.comboBoxSorter3Mode.Items.Add("计数输出2");
                //this.comboBoxSorter3Mode.Items.Add("其他不良");
                //this.comboBoxSorter3Mode.Items.Add("闩锁控制");
                this.comboBoxSorter3Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter3Mode_SelectedIndexChanged);

                this.comboBoxSorter4Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter4Mode_SelectedIndexChanged);
                this.comboBoxSorter4Mode.Items.Clear();
                this.comboBoxSorter4Mode.Items.Add("不使用");
                this.comboBoxSorter4Mode.Items.Add("超过");
                this.comboBoxSorter4Mode.Items.Add("低于");
                this.comboBoxSorter4Mode.Items.Add("不良");
                this.comboBoxSorter4Mode.Items.Add("通过");
                this.comboBoxSorter4Mode.Items.Add("运行");
                this.comboBoxSorter4Mode.Items.Add("计数");
                //this.comboBoxSorter4Mode.Items.Add("计数输出1");
                //this.comboBoxSorter4Mode.Items.Add("计数输出2");
                //this.comboBoxSorter4Mode.Items.Add("其他不良");
                //this.comboBoxSorter4Mode.Items.Add("闩锁控制");
                this.comboBoxSorter4Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter4Mode_SelectedIndexChanged);

                this.comboBoxSorter5Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter5Mode_SelectedIndexChanged);
                this.comboBoxSorter5Mode.Items.Clear();
                this.comboBoxSorter5Mode.Items.Add("不使用");
                this.comboBoxSorter5Mode.Items.Add("超过");
                this.comboBoxSorter5Mode.Items.Add("低于");
                this.comboBoxSorter5Mode.Items.Add("不良");
                this.comboBoxSorter5Mode.Items.Add("通过");
                this.comboBoxSorter5Mode.Items.Add("运行");
                this.comboBoxSorter5Mode.Items.Add("计数");
                //this.comboBoxSorter5Mode.Items.Add("计数输出1");
                //this.comboBoxSorter5Mode.Items.Add("计数输出2");
                //this.comboBoxSorter5Mode.Items.Add("其他不良");
                this.comboBoxSorter5Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter5Mode_SelectedIndexChanged);

                this.comboBoxSorter6Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter6Mode_SelectedIndexChanged);
                this.comboBoxSorter6Mode.Items.Clear();
                this.comboBoxSorter6Mode.Items.Add("不使用");
                this.comboBoxSorter6Mode.Items.Add("超过");
                this.comboBoxSorter6Mode.Items.Add("低于");
                this.comboBoxSorter6Mode.Items.Add("不良");
                this.comboBoxSorter6Mode.Items.Add("通过");
                this.comboBoxSorter6Mode.Items.Add("运行");
                this.comboBoxSorter6Mode.Items.Add("计数");
                //this.comboBoxSorter6Mode.Items.Add("计数输出1");
                //this.comboBoxSorter6Mode.Items.Add("计数输出2");
                //this.comboBoxSorter6Mode.Items.Add("其他不良");
                this.comboBoxSorter6Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter6Mode_SelectedIndexChanged);
                #endregion
            }
            else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Czech)
            {
            }
            else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Russian)
            {
                #region Russian
                this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusBackgroundExternalOutput));

                this.comboBoxSorter1Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter1Mode_SelectedIndexChanged);
                this.comboBoxSorter1Mode.Items.Clear();
                this.comboBoxSorter1Mode.Items.Add("Нет");
                this.comboBoxSorter1Mode.Items.Add("Много");
                this.comboBoxSorter1Mode.Items.Add("Мало");
                this.comboBoxSorter1Mode.Items.Add("Дефект");
                this.comboBoxSorter1Mode.Items.Add("Норма");
                this.comboBoxSorter1Mode.Items.Add("Выполнение");
                this.comboBoxSorter1Mode.Items.Add("Подсчет");
                //this.comboBoxSorter1Mode.Items.Add("Счетный выход1");
                //this.comboBoxSorter1Mode.Items.Add("Счетный выход2");
                //this.comboBoxSorter1Mode.Items.Add("Другие неисправности");
                //this.comboBoxSorter1Mode.Items.Add("контроль защелки");
                this.comboBoxSorter1Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter1Mode_SelectedIndexChanged);

                this.comboBoxSorter2Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter2Mode_SelectedIndexChanged);
                this.comboBoxSorter2Mode.Items.Clear();
                this.comboBoxSorter2Mode.Items.Add("Нет");
                this.comboBoxSorter2Mode.Items.Add("Много");
                this.comboBoxSorter2Mode.Items.Add("Мало");
                this.comboBoxSorter2Mode.Items.Add("Дефект");
                this.comboBoxSorter2Mode.Items.Add("Норма");
                this.comboBoxSorter2Mode.Items.Add("Выполнение");
                this.comboBoxSorter2Mode.Items.Add("Подсчет");
                //this.comboBoxSorter2Mode.Items.Add("Счетный выход1");
                //this.comboBoxSorter2Mode.Items.Add("Счетный выход2");
                //this.comboBoxSorter2Mode.Items.Add("Другие неисправности");
                //this.comboBoxSorter2Mode.Items.Add("контроль защелки");
                this.comboBoxSorter2Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter2Mode_SelectedIndexChanged);

                this.comboBoxSorter3Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter3Mode_SelectedIndexChanged);
                this.comboBoxSorter3Mode.Items.Clear();
                this.comboBoxSorter3Mode.Items.Add("Нет");
                this.comboBoxSorter3Mode.Items.Add("Много");
                this.comboBoxSorter3Mode.Items.Add("Мало");
                this.comboBoxSorter3Mode.Items.Add("Дефект");
                this.comboBoxSorter3Mode.Items.Add("Норма");
                this.comboBoxSorter3Mode.Items.Add("Выполнение");
                this.comboBoxSorter3Mode.Items.Add("Подсчет");
                //this.comboBoxSorter3Mode.Items.Add("Счетный выход1");
                //this.comboBoxSorter3Mode.Items.Add("Счетный выход2");
                //this.comboBoxSorter3Mode.Items.Add("Другие неисправности");
                //this.comboBoxSorter3Mode.Items.Add("контроль защелки");
                this.comboBoxSorter3Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter3Mode_SelectedIndexChanged);

                this.comboBoxSorter4Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter4Mode_SelectedIndexChanged);
                this.comboBoxSorter4Mode.Items.Clear();
                this.comboBoxSorter4Mode.Items.Add("Нет");
                this.comboBoxSorter4Mode.Items.Add("Много");
                this.comboBoxSorter4Mode.Items.Add("Мало");
                this.comboBoxSorter4Mode.Items.Add("Дефект");
                this.comboBoxSorter4Mode.Items.Add("Норма");
                this.comboBoxSorter4Mode.Items.Add("Выполнение");
                this.comboBoxSorter4Mode.Items.Add("Подсчет");
                //this.comboBoxSorter4Mode.Items.Add("Счетный выход1");
                //this.comboBoxSorter4Mode.Items.Add("Счетный выход2");
                //this.comboBoxSorter4Mode.Items.Add("Другие неисправности");
                //this.comboBoxSorter4Mode.Items.Add("контроль защелки");
                this.comboBoxSorter4Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter4Mode_SelectedIndexChanged);

                this.comboBoxSorter5Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter5Mode_SelectedIndexChanged);
                this.comboBoxSorter5Mode.Items.Clear();
                this.comboBoxSorter5Mode.Items.Add("Нет");
                this.comboBoxSorter5Mode.Items.Add("Много");
                this.comboBoxSorter5Mode.Items.Add("Мало");
                this.comboBoxSorter5Mode.Items.Add("Дефект");
                this.comboBoxSorter5Mode.Items.Add("Норма");
                this.comboBoxSorter5Mode.Items.Add("Выполнение");
                this.comboBoxSorter5Mode.Items.Add("Подсчет");
                //this.comboBoxSorter5Mode.Items.Add("Счетный выход1");
                //this.comboBoxSorter5Mode.Items.Add("Счетный выход2");
                //this.comboBoxSorter5Mode.Items.Add("Другие неисправности");
                this.comboBoxSorter5Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter5Mode_SelectedIndexChanged);

                this.comboBoxSorter6Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter6Mode_SelectedIndexChanged);
                this.comboBoxSorter6Mode.Items.Clear();
                this.comboBoxSorter6Mode.Items.Add("Нет");
                this.comboBoxSorter6Mode.Items.Add("Много");
                this.comboBoxSorter6Mode.Items.Add("Мало");
                this.comboBoxSorter6Mode.Items.Add("Дефект");
                this.comboBoxSorter6Mode.Items.Add("Норма");
                this.comboBoxSorter6Mode.Items.Add("Выполнение");
                this.comboBoxSorter6Mode.Items.Add("Подсчет");
                //this.comboBoxSorter6Mode.Items.Add("Счетный выход1");
                //this.comboBoxSorter6Mode.Items.Add("Счетный выход2");
                //this.comboBoxSorter6Mode.Items.Add("Другие неисправности");
                this.comboBoxSorter6Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter6Mode_SelectedIndexChanged);
                #endregion
            }
            else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German)
            {
                #region German
                this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundExternalOutput));

                this.comboBoxSorter1Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter1Mode_SelectedIndexChanged);
                this.comboBoxSorter1Mode.Items.Clear();
                this.comboBoxSorter1Mode.Items.Add("Keiner");
                this.comboBoxSorter1Mode.Items.Add("Max.");
                this.comboBoxSorter1Mode.Items.Add("Min.");
                this.comboBoxSorter1Mode.Items.Add("Schlecht");
                this.comboBoxSorter1Mode.Items.Add("Bestehen");
                this.comboBoxSorter1Mode.Items.Add("Lauf");
                this.comboBoxSorter1Mode.Items.Add("Einstellen");
                //this.comboBoxSorter1Mode.Items.Add("Zählen der Ausgabe1");
                //this.comboBoxSorter1Mode.Items.Add("Zählen der Ausgabe2");
                //this.comboBoxSorter1Mode.Items.Add("Ex.Schlecht");
                //this.comboBoxSorter1Mode.Items.Add("Verriegelungssteuerung");
                this.comboBoxSorter1Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter1Mode_SelectedIndexChanged);

                this.comboBoxSorter2Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter2Mode_SelectedIndexChanged);
                this.comboBoxSorter2Mode.Items.Clear();
                this.comboBoxSorter2Mode.Items.Add("Keiner");
                this.comboBoxSorter2Mode.Items.Add("Max.");
                this.comboBoxSorter2Mode.Items.Add("Min.");
                this.comboBoxSorter2Mode.Items.Add("Schlecht");
                this.comboBoxSorter2Mode.Items.Add("Bestehen");
                this.comboBoxSorter2Mode.Items.Add("Lauf");
                this.comboBoxSorter2Mode.Items.Add("Einstellen");
                //this.comboBoxSorter2Mode.Items.Add("Zählen der Ausgabe1");
                //this.comboBoxSorter2Mode.Items.Add("Zählen der Ausgabe2");
                //this.comboBoxSorter2Mode.Items.Add("Ex.Schlecht");
                //this.comboBoxSorter2Mode.Items.Add("Verriegelungssteuerung");
                this.comboBoxSorter2Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter2Mode_SelectedIndexChanged);

                this.comboBoxSorter3Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter3Mode_SelectedIndexChanged);
                this.comboBoxSorter3Mode.Items.Clear();
                this.comboBoxSorter3Mode.Items.Add("Keiner");
                this.comboBoxSorter3Mode.Items.Add("Max.");
                this.comboBoxSorter3Mode.Items.Add("Min.");
                this.comboBoxSorter3Mode.Items.Add("Schlecht");
                this.comboBoxSorter3Mode.Items.Add("Bestehen");
                this.comboBoxSorter3Mode.Items.Add("Lauf");
                this.comboBoxSorter3Mode.Items.Add("Einstellen");
                //this.comboBoxSorter3Mode.Items.Add("Zählen der Ausgabe1");
                //this.comboBoxSorter3Mode.Items.Add("Zählen der Ausgabe2");
                //this.comboBoxSorter3Mode.Items.Add("Ex.Schlecht");
                //this.comboBoxSorter3Mode.Items.Add("Verriegelungssteuerung");
                this.comboBoxSorter3Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter3Mode_SelectedIndexChanged);

                this.comboBoxSorter4Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter4Mode_SelectedIndexChanged);
                this.comboBoxSorter4Mode.Items.Clear();
                this.comboBoxSorter4Mode.Items.Add("Keiner");
                this.comboBoxSorter4Mode.Items.Add("Max.");
                this.comboBoxSorter4Mode.Items.Add("Min.");
                this.comboBoxSorter4Mode.Items.Add("Schlecht");
                this.comboBoxSorter4Mode.Items.Add("Bestehen");
                this.comboBoxSorter4Mode.Items.Add("Lauf");
                this.comboBoxSorter4Mode.Items.Add("Einstellen");
                //this.comboBoxSorter4Mode.Items.Add("Zählen der Ausgabe1");
                //this.comboBoxSorter4Mode.Items.Add("Zählen der Ausgabe2");
                //this.comboBoxSorter4Mode.Items.Add("Ex.Schlecht");
                //this.comboBoxSorter4Mode.Items.Add("Verriegelungssteuerung");
                this.comboBoxSorter4Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter4Mode_SelectedIndexChanged);

                this.comboBoxSorter5Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter5Mode_SelectedIndexChanged);
                this.comboBoxSorter5Mode.Items.Clear();
                this.comboBoxSorter5Mode.Items.Add("Keiner");
                this.comboBoxSorter5Mode.Items.Add("Max.");
                this.comboBoxSorter5Mode.Items.Add("Min.");
                this.comboBoxSorter5Mode.Items.Add("Schlecht");
                this.comboBoxSorter5Mode.Items.Add("Bestehen");
                this.comboBoxSorter5Mode.Items.Add("Lauf");
                this.comboBoxSorter5Mode.Items.Add("Einstellen");
                //this.comboBoxSorter5Mode.Items.Add("Zählen der Ausgabe1");
                //this.comboBoxSorter5Mode.Items.Add("Zählen der Ausgabe2");
                //this.comboBoxSorter5Mode.Items.Add("Ex.Schlecht");
                this.comboBoxSorter5Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter5Mode_SelectedIndexChanged);

                this.comboBoxSorter6Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter6Mode_SelectedIndexChanged);
                this.comboBoxSorter6Mode.Items.Clear();
                this.comboBoxSorter6Mode.Items.Add("Keiner");
                this.comboBoxSorter6Mode.Items.Add("Max.");
                this.comboBoxSorter6Mode.Items.Add("Min.");
                this.comboBoxSorter6Mode.Items.Add("Schlecht");
                this.comboBoxSorter6Mode.Items.Add("Bestehen");
                this.comboBoxSorter6Mode.Items.Add("Lauf");
                this.comboBoxSorter6Mode.Items.Add("Einstellen");
                //this.comboBoxSorter6Mode.Items.Add("Zählen der Ausgabe1");
                //this.comboBoxSorter6Mode.Items.Add("Zählen der Ausgabe2");
                //this.comboBoxSorter6Mode.Items.Add("Ex.Schlecht");
                this.comboBoxSorter6Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter6Mode_SelectedIndexChanged);
                #endregion
            }
            else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
            {

            }
            else
            {
                #region Korean
                this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundExternalOutput));

                this.comboBoxSorter1Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter1Mode_SelectedIndexChanged);
                this.comboBoxSorter1Mode.Items.Clear();
                this.comboBoxSorter1Mode.Items.Add("사용안함");
                this.comboBoxSorter1Mode.Items.Add("과량");
                this.comboBoxSorter1Mode.Items.Add("경량");
                this.comboBoxSorter1Mode.Items.Add("불량");
                this.comboBoxSorter1Mode.Items.Add("정량");
                this.comboBoxSorter1Mode.Items.Add("운전");
                this.comboBoxSorter1Mode.Items.Add("개수");
                this.comboBoxSorter1Mode.Items.Add("시건장치 제어"); // 7
                //this.comboBoxSorter1Mode.Items.Add("카운터출력1");
                //this.comboBoxSorter1Mode.Items.Add("카운터출력2");
                //this.comboBoxSorter1Mode.Items.Add("ExNG");
                this.comboBoxSorter1Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter1Mode_SelectedIndexChanged);

                this.comboBoxSorter2Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter2Mode_SelectedIndexChanged);
                this.comboBoxSorter2Mode.Items.Clear();
                this.comboBoxSorter2Mode.Items.Add("사용안함");
                this.comboBoxSorter2Mode.Items.Add("과량");
                this.comboBoxSorter2Mode.Items.Add("경량");
                this.comboBoxSorter2Mode.Items.Add("불량");
                this.comboBoxSorter2Mode.Items.Add("정량");
                this.comboBoxSorter2Mode.Items.Add("운전");
                this.comboBoxSorter2Mode.Items.Add("개수");
                this.comboBoxSorter2Mode.Items.Add("시건장치 제어"); // 7
                //this.comboBoxSorter2Mode.Items.Add("카운터출력1");
                //this.comboBoxSorter2Mode.Items.Add("카운터출력2");
                //this.comboBoxSorter2Mode.Items.Add("ExNG");
                this.comboBoxSorter2Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter2Mode_SelectedIndexChanged);

                this.comboBoxSorter3Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter3Mode_SelectedIndexChanged);
                this.comboBoxSorter3Mode.Items.Clear();
                this.comboBoxSorter3Mode.Items.Add("사용안함");
                this.comboBoxSorter3Mode.Items.Add("과량");
                this.comboBoxSorter3Mode.Items.Add("경량");
                this.comboBoxSorter3Mode.Items.Add("불량");
                this.comboBoxSorter3Mode.Items.Add("정량");
                this.comboBoxSorter3Mode.Items.Add("운전");
                this.comboBoxSorter3Mode.Items.Add("개수");
                this.comboBoxSorter3Mode.Items.Add("시건장치 제어"); // 7
                //this.comboBoxSorter3Mode.Items.Add("카운터출력1");
                //this.comboBoxSorter3Mode.Items.Add("카운터출력2");
                //this.comboBoxSorter3Mode.Items.Add("ExNG");
                this.comboBoxSorter3Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter3Mode_SelectedIndexChanged);

                this.comboBoxSorter4Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter4Mode_SelectedIndexChanged);
                this.comboBoxSorter4Mode.Items.Clear();
                this.comboBoxSorter4Mode.Items.Add("사용안함");
                this.comboBoxSorter4Mode.Items.Add("과량");
                this.comboBoxSorter4Mode.Items.Add("경량");
                this.comboBoxSorter4Mode.Items.Add("불량");
                this.comboBoxSorter4Mode.Items.Add("정량");
                this.comboBoxSorter4Mode.Items.Add("운전");
                this.comboBoxSorter4Mode.Items.Add("개수");
                this.comboBoxSorter4Mode.Items.Add("시건장치 제어"); // 7
                //this.comboBoxSorter4Mode.Items.Add("카운터출력1");
                //this.comboBoxSorter4Mode.Items.Add("카운터출력2");
                //this.comboBoxSorter4Mode.Items.Add("ExNG");
                this.comboBoxSorter4Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter4Mode_SelectedIndexChanged);

                this.comboBoxSorter5Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter5Mode_SelectedIndexChanged);
                this.comboBoxSorter5Mode.Items.Clear();
                this.comboBoxSorter5Mode.Items.Add("사용안함");
                this.comboBoxSorter5Mode.Items.Add("과량");
                this.comboBoxSorter5Mode.Items.Add("경량");
                this.comboBoxSorter5Mode.Items.Add("불량");
                this.comboBoxSorter5Mode.Items.Add("정량");
                this.comboBoxSorter5Mode.Items.Add("운전");
                this.comboBoxSorter5Mode.Items.Add("개수");
                this.comboBoxSorter5Mode.Items.Add("시건장치 제어"); // 7
                //this.comboBoxSorter5Mode.Items.Add("카운터출력1");
                //this.comboBoxSorter5Mode.Items.Add("카운터출력2");
                //this.comboBoxSorter5Mode.Items.Add("ExNG");
                this.comboBoxSorter5Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter5Mode_SelectedIndexChanged);

                this.comboBoxSorter6Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter6Mode_SelectedIndexChanged);
                this.comboBoxSorter6Mode.Items.Clear();
                this.comboBoxSorter6Mode.Items.Add("사용안함");
                this.comboBoxSorter6Mode.Items.Add("과량");
                this.comboBoxSorter6Mode.Items.Add("경량");
                this.comboBoxSorter6Mode.Items.Add("불량");
                this.comboBoxSorter6Mode.Items.Add("정량");
                this.comboBoxSorter6Mode.Items.Add("운전");
                this.comboBoxSorter6Mode.Items.Add("개수");
                this.comboBoxSorter6Mode.Items.Add("시건장치 제어"); // 7
                //this.comboBoxSorter6Mode.Items.Add("카운터출력1");
                //this.comboBoxSorter6Mode.Items.Add("카운터출력2");
                //this.comboBoxSorter6Mode.Items.Add("ExNG");
                this.comboBoxSorter6Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter6Mode_SelectedIndexChanged);
                #endregion
            }            
        }
        private void DefaultSetting()
        {

        }

        private void SetControls(SystemParameter3 item)
        {
            string value = "";
            int index = 0;

            #region ExternalOut1
            this.comboBoxSorter1Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter1Mode_SelectedIndexChanged);
            index = int.Parse(item.ExternalOut1Mode.Trim());
            if (this.comboBoxSorter1Mode.SelectedIndex != index)
                this.comboBoxSorter1Mode.SelectedIndex = index;
            this.comboBoxSorter1Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter1Mode_SelectedIndexChanged);
            value = item.ExternalOut1DelayTime.Trim();
            if (this.labelSorter1DelayTime.Text != value)
                this.labelSorter1DelayTime.Text = value;
            value = item.ExternalOut1RunTime.Trim();
            if (this.labelSorter1RunTime.Text != value)
                this.labelSorter1RunTime.Text = value; 
            #endregion

            #region ExternalOut2
            this.comboBoxSorter2Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter2Mode_SelectedIndexChanged);
            index = int.Parse(item.ExternalOut2Mode.Trim());
            if (this.comboBoxSorter2Mode.SelectedIndex != index)
                this.comboBoxSorter2Mode.SelectedIndex = index;
            this.comboBoxSorter2Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter2Mode_SelectedIndexChanged);
            value = item.ExternalOut2DelayTime.Trim();
            if (this.labelSorter2DelayTime.Text != value)
                this.labelSorter2DelayTime.Text = value;
            value = item.ExternalOut2RunTime.Trim();
            if (this.labelSorter2RunTime.Text != value)
                this.labelSorter2RunTime.Text = value;
            #endregion

            #region ExternalOut3
            this.comboBoxSorter3Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter3Mode_SelectedIndexChanged);
            index = int.Parse(item.ExternalOut3Mode.Trim());
            if (this.comboBoxSorter3Mode.SelectedIndex != index)
                this.comboBoxSorter3Mode.SelectedIndex = index;
            this.comboBoxSorter3Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter3Mode_SelectedIndexChanged);
            value = item.ExternalOut3DelayTime.Trim();
            if (this.labelSorter3DelayTime.Text != value)
                this.labelSorter3DelayTime.Text = value;
            value = item.ExternalOut3RunTime.Trim();
            if (this.labelSorter3RunTime.Text != value)
                this.labelSorter3RunTime.Text = value;
            #endregion

            #region ExternalOut4
            this.comboBoxSorter4Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter4Mode_SelectedIndexChanged);
            index = int.Parse(item.ExternalOut4Mode.Trim());
            if (this.comboBoxSorter4Mode.SelectedIndex != index)
                this.comboBoxSorter4Mode.SelectedIndex = index;
            this.comboBoxSorter4Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter4Mode_SelectedIndexChanged);
            value = item.ExternalOut4DelayTime.Trim();
            if (this.labelSorter4DelayTime.Text != value)
                this.labelSorter4DelayTime.Text = value;
            value = item.ExternalOut4RunTime.Trim();
            if (this.labelSorter4RunTime.Text != value)
                this.labelSorter4RunTime.Text = value;
            #endregion

            #region ExternalOut5
            this.comboBoxSorter5Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter5Mode_SelectedIndexChanged);
            index = int.Parse(item.ExternalOut5Mode.Trim());
            if (this.comboBoxSorter5Mode.SelectedIndex != index)
                this.comboBoxSorter5Mode.SelectedIndex = index;
            this.comboBoxSorter5Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter5Mode_SelectedIndexChanged);
            value = item.ExternalOut5DelayTime.Trim();
            if (this.labelSorter5DelayTime.Text != value)
                this.labelSorter5DelayTime.Text = value;
            value = item.ExternalOut5RunTime.Trim();
            if (this.labelSorter5RunTime.Text != value)
                this.labelSorter5RunTime.Text = value;
            #endregion

            #region ExternalOut6
            this.comboBoxSorter6Mode.SelectedIndexChanged -= new EventHandler(this.comboBoxSorter6Mode_SelectedIndexChanged);
            index = int.Parse(item.ExternalOut6Mode.Trim());
            if (this.comboBoxSorter6Mode.SelectedIndex != index)
                this.comboBoxSorter6Mode.SelectedIndex = index;
            this.comboBoxSorter6Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSorter6Mode_SelectedIndexChanged);
            value = item.ExternalOut6DelayTime.Trim();
            if (this.labelSorter6DelayTime.Text != value)
                this.labelSorter6DelayTime.Text = value;
            value = item.ExternalOut6RunTime.Trim();
            if (this.labelSorter6RunTime.Text != value)
                this.labelSorter6RunTime.Text = value;
            #endregion
        }

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

            this.SetControls(this.ParentForm.ParentForm.CurrentSystemParameter3);
        }
        #endregion

        #region Event Handler
        #region ExternalOut1
        private void comboBoxSorter1Mode_SelectedIndexChanged(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";

            before = this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.ReturnExternalOutput(
    int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut1Mode));

            this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut1Mode = this.comboBoxSorter1Mode.SelectedIndex.ToString();

            after = this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.ReturnExternalOutput(
     int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut1Mode));

            value = Helper.StringZeroFillDigits4(this.comboBoxSorter1Mode.SelectedIndex.ToString());
            this.ParentForm.ParentForm.ChildFormMainDisplay.MainSubMenu.UpdateDryContactControl(this.ParentForm.ParentForm.CurrentSystemParameter3);
            this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
            this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut1Mode, value);

            if (before != after)
                this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut1Mode, "", before, after);
        }
        private void labelSorter1DelayTime_Click(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";
            before = this.labelSorter1DelayTime.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter1DelayTime.Text, 4, 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
                {
                    after = this.labelSorter1DelayTime.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut1DelayTime = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
                    this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut1DelayTime, value);

                    if (before != after)
                        this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut1Delay, "", before, after);
                }
            }
        }
        private void labelSorter1RunTime_Click(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";
            before = this.labelSorter1RunTime.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter1RunTime.Text, 4, 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
                {
                    after = this.labelSorter1RunTime.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut1RunTime = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
                    this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut1RunTime, value);

                    if (before != after)
                        this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut1Run, "", before, after);
                }
            }
        } 
        #endregion

        #region ExternalOut2
        private void comboBoxSorter2Mode_SelectedIndexChanged(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";

            before = this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.ReturnExternalOutput(
    int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut2Mode));

            this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut2Mode = this.comboBoxSorter2Mode.SelectedIndex.ToString();

            after = this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.ReturnExternalOutput(
    int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut2Mode));

            value = Helper.StringZeroFillDigits4(this.comboBoxSorter2Mode.SelectedIndex.ToString());
            this.ParentForm.ParentForm.ChildFormMainDisplay.MainSubMenu.UpdateDryContactControl(this.ParentForm.ParentForm.CurrentSystemParameter3);
            this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
            this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut2Mode, value);

            if (before != after)
                this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut2Mode, "", before, after);
        }
        private void labelSorter2DelayTime_Click(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";
            before = this.labelSorter2DelayTime.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter2DelayTime.Text, 4, 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
                {
                    after = this.labelSorter2DelayTime.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut2DelayTime = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
                    this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut2DelayTime, value);

                    if (before != after)
                        this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut2Delay, "", before, after);
                }
            }
        }
        private void labelSorter2RunTime_Click(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";
            before = this.labelSorter2RunTime.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter2RunTime.Text, 4, 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
                {
                    after = this.labelSorter2RunTime.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut2RunTime = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
                    this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut2RunTime, value);

                    if (before != after)
                        this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut2Run, "", before, after);
                }
            }
        } 
        #endregion

        #region ExternalOut3
        private void comboBoxSorter3Mode_SelectedIndexChanged(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";

            before = this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.ReturnExternalOutput(
    int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut3Mode));

            this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut3Mode = this.comboBoxSorter3Mode.SelectedIndex.ToString();

            after = this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.ReturnExternalOutput(
    int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut3Mode));

            value = Helper.StringZeroFillDigits4(this.comboBoxSorter3Mode.SelectedIndex.ToString());
            this.ParentForm.ParentForm.ChildFormMainDisplay.MainSubMenu.UpdateDryContactControl(this.ParentForm.ParentForm.CurrentSystemParameter3);
            this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
            this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut3Mode, value);

            if (before != after)
                this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut3Mode, "", before, after);
        }
        private void labelSorter3DelayTime_Click(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";
            before = this.labelSorter3DelayTime.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter3DelayTime.Text, 4, 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
                {
                    after = this.labelSorter3DelayTime.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut3DelayTime = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
                    this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut3DelayTime, value);

                    if (before != after)
                        this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut3Delay, "", before, after);
                }
            }
        }
        private void labelSorter3RunTime_Click(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";
            before = this.labelSorter3RunTime.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter3RunTime.Text, 4, 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
                {
                    after = this.labelSorter3RunTime.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut3RunTime = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
                    this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut3RunTime, value);

                    if (before != after)
                        this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut3Run, "", before, after);
                }
            }
        } 
        #endregion

        #region ExternalOut4
        private void comboBoxSorter4Mode_SelectedIndexChanged(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";

            before = this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.ReturnExternalOutput(
    int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut4Mode));

            this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut4Mode = this.comboBoxSorter4Mode.SelectedIndex.ToString();

            after = this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.ReturnExternalOutput(
     int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut4Mode));

            value = Helper.StringZeroFillDigits4(this.comboBoxSorter4Mode.SelectedIndex.ToString());
            this.ParentForm.ParentForm.ChildFormMainDisplay.MainSubMenu.UpdateDryContactControl(this.ParentForm.ParentForm.CurrentSystemParameter3);
            this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
            this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut4Mode, value);

            if (before != after)
                this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut4Mode, "", before, after);
        }
        private void labelSorter4DelayTime_Click(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";
            before = this.labelSorter4DelayTime.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter4DelayTime.Text, 4, 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
                {
                    after = this.labelSorter4DelayTime.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut4DelayTime = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
                    this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut4DelayTime, value);

                    if (before != after)
                        this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut4Delay, "", before, after);
                }
            }
        }
        private void labelSorter4RunTime_Click(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";
            before = this.labelSorter4RunTime.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter4RunTime.Text, 4, 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
                {
                    after = this.labelSorter4RunTime.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut4RunTime = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
                    this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut4RunTime, value);

                    if (before != after)
                        this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut4Run, "", before, after);
                }
            }
        } 
        #endregion

        #region ExternalOut5
        private void comboBoxSorter5Mode_SelectedIndexChanged(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";

            before = this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.ReturnExternalOutput(
    int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut5Mode));

            this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut5Mode = this.comboBoxSorter5Mode.SelectedIndex.ToString();

            after = this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.ReturnExternalOutput(
        int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut5Mode));

            value = Helper.StringZeroFillDigits4(this.comboBoxSorter5Mode.SelectedIndex.ToString());
            this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
            this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut5Mode, value);

            if (before != after)
                this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut5Mode, "", before, after);
        }
        private void labelSorter5DelayTime_Click(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";
            before = this.labelSorter5DelayTime.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter5DelayTime.Text, 4, 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
                {
                    after = this.labelSorter5DelayTime.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut5DelayTime = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
                    this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut5DelayTime, value);

                    if (before != after)
                        this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut5Delay, "", before, after);
                }
            }
        }
        private void labelSorter5RunTime_Click(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";
            before = this.labelSorter5RunTime.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter5RunTime.Text, 4, 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
                {
                    after = this.labelSorter5RunTime.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut5RunTime = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
                    this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut5RunTime, value);

                    if (before != after)
                        this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut5Run, "", before, after);
                }
            }
        } 
        #endregion

        #region ExternalOut6
        private void comboBoxSorter6Mode_SelectedIndexChanged(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";

            before = this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.ReturnExternalOutput(
        int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut6Mode));

            this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut6Mode = this.comboBoxSorter6Mode.SelectedIndex.ToString();

            after = this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystem3.ReturnExternalOutput(
        int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut6Mode));

            value = Helper.StringZeroFillDigits4(this.comboBoxSorter6Mode.SelectedIndex.ToString());
            this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
            this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut6Mode, value);

            if (before != after)
                this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut6Mode, "", before, after);
        }
        private void labelSorter6DelayTime_Click(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";
            before = this.labelSorter6DelayTime.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter6DelayTime.Text, 4, 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
                {
                    after = this.labelSorter6DelayTime.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut6DelayTime = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
                    this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut6DelayTime, value);

                    if (before != after)
                        this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut6Delay, "", before, after);
                }
            }
        }
        private void labelSorter6RunTime_Click(object sender, EventArgs e)
        {
            string value = "";
            string before = "", after = "";
            before = this.labelSorter6RunTime.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter6RunTime.Text, 4, 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
                {
                    after = this.labelSorter6RunTime.Text = myKeyPad.StringValue;

                    this.ParentForm.ParentForm.CurrentSystemParameter3.ExternalOut6RunTime = myKeyPad.StringValue;

                    value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
                    this.ParentForm.ParentForm.SaveSystemParameter3File(this.ParentForm.ParentForm.CurrentSystemParameter3);
                    this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalOut6RunTime, value);

                    if (before != after)
                        this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.ExOut6Run, "", before, after);
                }
            }
        } 
        #endregion
        #endregion
    }
}
