using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Windows.Forms;

using SmartX;
using INT63DC_ImageDll;
using INT63DC_2C.Controls;
using INT63DC_2C.DialogForms;
using INT63DC_2C.Part11_UserManager;

namespace INT63DC_2C.Forms
{
    public partial class FormMainDisplay : Form
    {
        #region Field
        private FormMain m_ParentForm;
        private int SubmenuIndex;
        private bool IsFistAlarmView;
        public string ChangeID;

        private DataStore.FormMainDisplayStore MainDisplay;

        private ControlMainDisplayAlarm MainDisplayAlarmList;

        private ControlMainDisplayEachBarGraph5 MainDisplayEachBarGraph5;
        private ControlMainDisplayEachBarGraph6 MainDisplayEachBarGraph6;
        private ControlMainDisplayEachBarGraph7 MainDisplayEachBarGraph7;
        private ControlMainDisplayEachBarGraph8 MainDisplayEachBarGraph8;
        private ControlMainDisplayEachBarGraph10 MainDisplayEachBarGraph10;
        private ControlMainDisplayEachBarGraph12 MainDisplayEachBarGraph12;
        private ControlMainDisplayEachBarGraph15 MainDisplayEachBarGraph15;
        private ControlMainDisplayEachBarGraph16 MainDisplayEachBarGraph16;
        private ControlMainDisplayDotGraph2 MainDisplayDotGraph2;
        private ControlMainDisplayDotGraph3 MainDisplayDotGraph3;
        private ControlMainDisplayDotGraph4 MainDisplayDotGraph4;
        private ControlMainDisplayDotGraph5 MainDisplayDotGraph5;
        private ControlMainDisplayDotGraph6 MainDisplayDotGraph6;
        private ControlMainDisplayDotGraph7 MainDisplayDotGraph7;
        private ControlMainDisplayDotGraph8 MainDisplayDotGraph8;
        private ControlMainDisplayDotGraph10 MainDisplayDotGraph10;
        private ControlMainDisplayDotGraph12 MainDisplayDotGraph12;
        private ControlMainDisplayDotGraph15 MainDisplayDotGraph15;
        private ControlMainDisplayDotGraph16 MainDisplayDotGraph16;
        private ControlMainDisplayTable5 MainDisplayTable5;
        private ControlMainDisplayTable6 MainDisplayTable6;
        private ControlMainDisplayTable7 MainDisplayTable7;
        private ControlMainDisplayTable8 MainDisplayTable8;
        private ControlMainDisplayTable10 MainDisplayTable10;
        private ControlMainDisplayTable12 MainDisplayTable12;
        private ControlMainDisplayTable15 MainDisplayTable15;
        private ControlMainDisplayTable16 MainDisplayTable16;

        private ControlMainDisplay2 MainDisplay2;
        private ControlMainDisplay3 MainDisplay3;
        private ControlMainDisplay4 MainDisplay4;
        #endregion

        #region Constructor
        public FormMainDisplay(FormMain parent)
        {
            InitializeComponent();

            this.ParentForm = parent;

            this.InitializeDesign();
            this.InitializeControl();
            this.DefaultSetting();
        }
        #endregion

        #region Property
        public FormMain ParentForm
        {
            get { return this.m_ParentForm; }
            private set { this.m_ParentForm = value; }
        }
        #endregion

        #region Method
        /// <summary>
        /// 언어별 화면 디자인
        /// </summary>
        private void InitializeDesign()
        {
            ImageDll images = new ImageDll();
            Font font = new Font("New Gulim", 8F, FontStyle.Regular);
            Font font1 = new Font("New Gulim", 14F, FontStyle.Bold);

            switch (this.ParentForm.SystemConfig.Language)
            {
                case DataStore.E_LanguageID.Korean:
                    #region Korean
                    if (this.ParentForm.SystemConfig.IsLogin == true)
                    {
                        this.buttonMenu.Location = new Point(929, 666);

                        this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korFormMainMenuSmallDisable));
                        this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korFormMainMenuSmallDown));
                        this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korFormMainMenuSmallUp));
                    }
                    else
                    {
                        this.buttonMenu.Location = new Point(839, 666);

                        this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korFormMainMenuDisable));
                        this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korFormMainMenuDown));
                        this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korFormMainMenuUp));
                    }
                    #endregion
                    break;
                case DataStore.E_LanguageID.English:
                    #region English
                    this.buttonOver.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainOverDisable));
                    this.buttonOver.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainOverDown));
                    this.buttonOver.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainOverUp));
                    this.buttonPass.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainPassDisable));
                    this.buttonPass.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainPassDown));
                    this.buttonPass.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainPassUp));
                    this.buttonUnder.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainUnderDisable));
                    this.buttonUnder.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainUnderDown));
                    this.buttonUnder.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainUnderUp));
                    this.buttonTare.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainTareDisable));
                    this.buttonTare.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainTareDown));
                    this.buttonTare.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainTareUp));

                    this.buttonScaleZero.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainZeroDown));
                    this.buttonScaleZero.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainZeroUp));
                    this.buttonClear.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainClearDisable));
                    this.buttonClear.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainClearDown));
                    this.buttonClear.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainClearUp));
                    if (this.ParentForm.SystemConfig.IsLogin == true)
                    {
                        this.buttonMenu.Location = new Point(929, 666);

                        this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainMenuSmallDisable));
                        this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainMenuSmallDown));
                        this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainMenuSmallUp));
                    }
                    else
                    {
                        this.buttonMenu.Location = new Point(839, 666);

                        this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainMenuDisable));
                        this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainMenuDown));
                        this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainMenuUp));
                    }
                    this.buttonSubMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainSubMenuDisable));
                    this.buttonSubMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainSubMenuDown));
                    this.buttonSubMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainSubMenuUp));
                    this.buttonBypassDirection.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engSubMenuNGUp));
                    this.buttonBypassDirection.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engSubMenuPassUp));
                    this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engSubMenuContinueUp));
                    this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engSubMenuOnceUp));
                    this.buttonSamplingOnce.DownImage = this.buttonLeakSamplingOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engSubMenuContinueUp));
                    this.buttonSamplingOnce.UpImage = this.buttonLeakSamplingOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engSubMenuOnceUp));

                    this.groupBoxSorter.Text = "Sorter settings";
                    this.labelStaticSorter1DelayTime.Text = "Sorter1 Delay";
                    this.labelStaticSorter1RunTime.Text = "Sorter1 Run";
                    this.labelStaticSorter2DelayTime.Text = "Sorter2 Delay";
                    this.labelStaticSorter2RunTime.Text = "Sorter2 Run";
                    this.labelStaticSorter3DelayTime.Text = "Sorter3 Delay";
                    this.labelStaticSorter3RunTime.Text = "Sorter3 Run";
                    this.labelStaticSorter4DelayTime.Text = "Sorter4 Delay";
                    this.labelStaticSorter4RunTime.Text = "Sorter4 Run";
                    this.labelStaticEntryGateDelayTime.Text = "Entry gate delay";
                    this.labelStaticEntryGateRunTime.Text = "Entry gate run";
                    this.labelStaticDischargeStopperDelayTime.Font = font;
                    this.labelStaticDischargeStopperDelayTime.Text = "Discharge stopper delay";
                    this.labelStaticDischargeStopperRunTime.Font = font;
                    this.labelStaticDischargeStopperRunTime.Text = "Discharge stopper run";
                    this.labelStaticStopper2DelayTime.Text = "Stopper2 Delay";
                    this.labelStaticStopper2RunTime.Text = "Stopper2 Run";

                    this.groupBoxJudgmentSetting.Text = "Judgment settings";
                    this.labelStaticFilter.Text = "Filter";
                    this.labelStaticJudgmentDelayTime.Text = "J.Delay";
                    this.labelStaticJudgmentCount.Text = "J.Count";
                    this.labelStaticForcedZeroDelayTime.Text = "Forced zero delay";
                    this.labelStaticTurnDelayTime.Text = "Turn Delay";

                    this.labelMessage3.Text = "Pinch point Alarm";
                    this.labelMessage5.Text = "Please set the servo motor origin";

                    this.labelStaticSamplingCount.Text = "Count";
                    this.labelStaticSamplingTime.Text = "Time(min)";

                    this.labelStaticLeakSamplingTime.Text = "Time(min)";

                    this.labelStaticOverRange.Text = "Over";
                    this.labelStaticPassRange.Text = "Pass";
                    this.labelStaticUnderRange.Text = "Under";
                    this.labelStaticOverRangeLimit.Text = "Over Limit";
                    this.labelStaticUnderRangeLimit.Text = "Under Limit";
                    #endregion
                    break;
                case DataStore.E_LanguageID.Chinese:
                    #region Chinese
                    this.buttonOver.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainOverDisable));
                    this.buttonOver.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainOverDown));
                    this.buttonOver.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainOverUp));
                    this.buttonPass.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainPassDisable));
                    this.buttonPass.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainPassDown));
                    this.buttonPass.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainPassUp));
                    this.buttonUnder.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainUnderDisable));
                    this.buttonUnder.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainUnderDown));
                    this.buttonUnder.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainUnderUp));
                    this.buttonTare.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainTareDisable));
                    this.buttonTare.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainTareDown));
                    this.buttonTare.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainTareUp));

                    this.buttonScaleZero.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainZeroDown));
                    this.buttonScaleZero.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainZeroUp));
                    this.buttonClear.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainClearDisable));
                    this.buttonClear.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainClearDown));
                    this.buttonClear.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainClearUp));
                    if (this.ParentForm.SystemConfig.IsLogin == true)
                    {
                        this.buttonMenu.Location = new Point(929, 666);

                        this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainMenuSmallDisable));
                        this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainMenuSmallDown));
                        this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainMenuSmallUp));
                    }
                    else
                    {
                        this.buttonMenu.Location = new Point(839, 666);

                        this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainMenuDisable));
                        this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainMenuDown));
                        this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainMenuUp));
                    }
                    this.buttonSubMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainSubMenuDisable));
                    this.buttonSubMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainSubMenuDown));
                    this.buttonSubMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainSubMenuUp));
                    this.buttonBypassDirection.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnSubMenuNGUp));
                    this.buttonBypassDirection.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnSubMenuPassUp));
                    this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnSubMenuContinueUp));
                    this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnSubMenuOnceUp));
                    this.buttonUser.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainLoginDisable));
                    this.buttonUser.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainLogOutDown));
                    this.buttonUser.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainLoginUp));
                    this.buttonSamplingOnce.DownImage = this.buttonLeakSamplingOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnSubMenuContinueUp));
                    this.buttonSamplingOnce.UpImage = this.buttonLeakSamplingOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnSubMenuOnceUp));

                    this.groupBoxSorter.Text = "筛选设定";
                    this.labelStaticSorter1DelayTime.Text = "分类机1 延迟时间";
                    this.labelStaticSorter1RunTime.Text = "分类机1 运行时间";
                    this.labelStaticSorter2DelayTime.Text = "分类机2 延迟时间";
                    this.labelStaticSorter2RunTime.Text = "分类机2 运行时间";
                    this.labelStaticSorter3DelayTime.Text = "分类机3 延迟时间";
                    this.labelStaticSorter3RunTime.Text = "分类机3 运行时间";
                    this.labelStaticSorter4DelayTime.Text = "分类机4 延迟时间";
                    this.labelStaticSorter4RunTime.Text = "分类机4 运行时间";
                    this.labelStaticEntryGateDelayTime.Text = "料门延迟时间";
                    this.labelStaticEntryGateRunTime.Text = "料门动作时间";
                    this.labelStaticDischargeStopperDelayTime.Text = "出料限位器延迟时间";
                    this.labelStaticDischargeStopperRunTime.Text = "出料限位器动作时间";
                    this.labelStaticStopper2DelayTime.Text = "限位2 器延迟时间";
                    this.labelStaticStopper2RunTime.Text = "限位2 器动作时间";

                    this.groupBoxJudgmentSetting.Text = "判断设置";
                    this.labelStaticFilter.Text = "滤波器";
                    this.labelStaticJudgmentDelayTime.Text = "判断延迟";
                    this.labelStaticJudgmentCount.Text = "重复延迟";
                    this.labelStaticTurnDelayTime.Text = "旋转延迟";
                    this.labelStaticForcedZeroDelayTime.Text = "零延迟时间";

                    this.labelMessage3.Text = "Pinch point Alarm";
                    this.labelMessage5.Text = "伺服电机不在远点";
                    this.buttonClose.Text = "关闭";

                    this.labelTitleTotalCount.Text = "计数";
                    this.labelTitleNG.Text = "不良";
                    this.labelTitleBypass.Text = "选别选项";
                    this.labelTitleScreen.Text = "屏幕";

                    this.labelTitleSampling.Text = "取样";
                    this.labelStaticSamplingCount.Text = "计数";
                    this.labelStaticSamplingTime.Text = "时间(分钟)";

                    this.labelTitleLeakSampling.Text = "泄露 取样";
                    this.labelStaticLeakSamplingTime.Text = "时间(分钟)";

                    this.labelStaticOverRange.Text = "上限";
                    this.labelStaticPassRange.Text = "标准";
                    this.labelStaticUnderRange.Text = "下限";
                    this.labelStaticOverRangeLimit.Text = "上极限报警";
                    this.labelStaticUnderRangeLimit.Text = "下极限报警";
                    #endregion
                    break;
                case DataStore.E_LanguageID.Czech:
                    #region Czech
                    this.buttonOver.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainOverDown));
                    this.buttonOver.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainOverUp));
                    this.buttonPass.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainPassDown));
                    this.buttonPass.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainPassUp));
                    this.buttonUnder.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainUnderDown));
                    this.buttonUnder.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainUnderUp));
                    this.buttonTare.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainTareDown));
                    this.buttonTare.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainTareUp));

                    this.buttonScaleZero.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainZeroDown));
                    this.buttonScaleZero.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainZeroUp));
                    this.buttonClear.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainClearDisable));
                    this.buttonClear.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainClearDown));
                    this.buttonClear.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainClearUp));
                    if (this.ParentForm.SystemConfig.IsLogin == true)
                    {
                        this.buttonMenu.Location = new Point(929, 666);

                        this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainMenuSmallDisable));
                        this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainMenuSmallDown));
                        this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainMenuSmallUp));
                    }
                    else
                    {
                        this.buttonMenu.Location = new Point(839, 666);

                        this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainMenuDisable));
                        this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainMenuDown));
                        this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainMenuUp));
                    }
                    this.buttonSubMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainSubMenuDisable));
                    this.buttonSubMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainSubMenuDown));
                    this.buttonSubMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainSubMenuUp));
                    this.buttonBypassDirection.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeSubMenuNGUp));
                    this.buttonBypassDirection.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeSubMenuPassUp));
                    this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeSubMenuContinueUp));
                    this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeSubMenuOnceUp));
                    this.buttonSamplingOnce.DownImage = this.buttonLeakSamplingOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeSubMenuContinueUp));
                    this.buttonSamplingOnce.UpImage = this.buttonLeakSamplingOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeSubMenuOnceUp));

                    this.groupBoxSorter.Text = "Nastavení třídiče";
                    this.labelStaticSorter1DelayTime.Text = "Vyřazovač1 Zpoždění";
                    this.labelStaticSorter1RunTime.Text = "Vyřazovač1 Čas chodu";
                    this.labelStaticSorter2DelayTime.Text = "Vyřazovač2 Zpoždění";
                    this.labelStaticSorter2RunTime.Text = "Vyřazovač2 Čas chodu";
                    this.labelStaticSorter3DelayTime.Text = "Vyřazovač3 Zpoždění";
                    this.labelStaticSorter3RunTime.Text = "Vyřazovač3 Čas chodu";
                    this.labelStaticSorter4DelayTime.Text = "Vyřazovač4 Zpoždění";
                    this.labelStaticSorter4RunTime.Text = "Vyřazovač4 Čas chodu";
                    this.labelStaticEntryGateDelayTime.Text = "zpoždění vstupní brány";
                    this.labelStaticEntryGateRunTime.Text = "Provozní vjezdové brány";
                    this.labelStaticDischargeStopperDelayTime.Text = "zpoždění vybíjecí zátky";
                    this.labelStaticDischargeStopperRunTime.Text = "provozu vypouštěcí zátky";
                    this.labelStaticStopper2DelayTime.Text = "Zastavování2 Zpoždění";
                    this.labelStaticStopper2RunTime.Text = "Zastavování2 Čas chodu";

                    this.groupBoxJudgmentSetting.Text = "Nastavení rozhodnutí";
                    this.labelStaticFilter.Text = "Filtr";
                    this.labelStaticJudgmentDelayTime.Text = "Zpoždění kapsy";
                    this.labelStaticJudgmentCount.Text = "Číslo kapsy";
                    this.labelStaticTurnDelayTime.Text = "Zpoždění rotace";
                    this.labelStaticForcedZeroDelayTime.Font = font;
                    this.labelStaticForcedZeroDelayTime.Text = "Vynucená nulového zpoždění";

                    this.labelMessage3.Text = "Pinch point Alarm";
                    this.labelMessage5.Text = "Nastavte prosím původ servomotoru";

                    this.labelTitleSampling.Text = "vzorkování";
                    this.labelStaticSamplingCount.Text = "Počet";
                    this.labelStaticSamplingTime.Text = "Čas(min)";

                    this.labelTitleLeakSampling.Text = "unikat Počet";
                    this.labelStaticLeakSamplingTime.Text = "Čas(min)";

                    this.labelStaticOverRange.Text = "Max.";
                    this.labelStaticPassRange.Text = "Váha";
                    this.labelStaticUnderRange.Text = "Min.";
                    this.labelStaticOverRangeLimit.Text = "Max. omezit";
                    this.labelStaticUnderRangeLimit.Text = "Min. omezit";
                    #endregion
                    break;
                case DataStore.E_LanguageID.German:
                    #region German
                    this.buttonOver.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainOverDown));
                    this.buttonOver.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainOverUp));
                    this.buttonPass.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainPassDown));
                    this.buttonPass.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainPassUp));
                    this.buttonUnder.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainUnderDown));
                    this.buttonUnder.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainUnderUp));
                    this.buttonTare.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainTareDown));
                    this.buttonTare.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainTareUp));

                    this.buttonScaleZero.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainZeroDown));
                    this.buttonScaleZero.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainZeroUp));
                    this.buttonClear.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainClearDisable));
                    this.buttonClear.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainClearDown));
                    this.buttonClear.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainClearUp));
                    if (this.ParentForm.SystemConfig.IsLogin == true)
                    {
                        this.buttonMenu.Location = new Point(929, 666);

                        this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainMenuSmallDisable));
                        this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainMenuSmallDown));
                        this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainMenuSmallUp));
                    }
                    else
                    {
                        this.buttonMenu.Location = new Point(839, 666);

                        this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainMenuDisable));
                        this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainMenuDown));
                        this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainMenuUp));
                    }
                    this.buttonSubMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainSubMenuDisable));
                    this.buttonSubMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainSubMenuDown));
                    this.buttonSubMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainSubMenuUp));
                    this.buttonBypassDirection.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerSubMenuNGUp));
                    this.buttonBypassDirection.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerSubMenuPassUp));
                    this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerSubMenuContinueUp));
                    this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerSubMenuOnceUp));
                    this.buttonSamplingOnce.DownImage = this.buttonLeakSamplingOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerSubMenuContinueUp));
                    this.buttonSamplingOnce.UpImage = this.buttonLeakSamplingOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerSubMenuOnceUp));

                    this.groupBoxSorter.Text = "Sortierereinstellung";
                    this.labelStaticSorter1DelayTime.Text = "Sortierer1 Vezögerung";
                    this.labelStaticSorter1RunTime.Text = "Sortierer1 Laufzeit";
                    this.labelStaticSorter2DelayTime.Text = "Sortierer2 Vezögerung";
                    this.labelStaticSorter2RunTime.Text = "Sortierer2 Laufzeit";
                    this.labelStaticSorter3DelayTime.Text = "Sortierer3 Vezögerung";
                    this.labelStaticSorter3RunTime.Text = "Sortierer3 Laufzeit";
                    this.labelStaticSorter4DelayTime.Text = "Sortierer4 Vezögerung";
                    this.labelStaticSorter4RunTime.Text = "Sortierer4 Laufzeit";
                    this.labelStaticEntryGateDelayTime.Font = font;
                    this.labelStaticEntryGateDelayTime.Text = "Verzögerungszeit Eingangstors";
                    this.labelStaticEntryGateRunTime.Font = font;
                    this.labelStaticEntryGateRunTime.Text = "Einfahrtstor Betriebszeit";
                    this.labelStaticDischargeStopperDelayTime.Font = font;
                    this.labelStaticDischargeStopperDelayTime.Text = "Verzögerungszeit Entladestoppers";
                    this.labelStaticDischargeStopperRunTime.Font = font;
                    this.labelStaticDischargeStopperRunTime.Text = "Betriebszeit Entladungsstoppers";
                    this.labelStaticStopper2DelayTime.Text = "Stoppen2 Vezögerung";
                    this.labelStaticStopper2RunTime.Text = "Stoppen2 Laufzeit";

                    this.groupBoxJudgmentSetting.Text = "Tascheneinstellung";
                    this.labelStaticFilter.Text = "Filter";
                    this.labelStaticJudgmentDelayTime.Text = "Taschenverzögerung";
                    this.labelStaticJudgmentCount.Text = "Taschennummer";
                    this.labelStaticTurnDelayTime.Text = "Rotationsverzögerung";
                    this.labelStaticForcedZeroDelayTime.Font = font;
                    this.labelStaticForcedZeroDelayTime.Text = "Erzwungene Null-Verzögerung";

                    this.labelMessage3.Text = "Pinch point Alarm";
                    this.labelMessage5.Text = "Bitte stellen Sie den Ursprung des Servomotors ein";

                    this.labelTitleSampling.Text = "Probenahme";
                    this.labelStaticSamplingCount.Text = "Zahl";
                    this.labelStaticSamplingTime.Text = "Zeit(min)";

                    this.labelTitleLeakSampling.Text = "Leck Probenahme";
                    this.labelStaticLeakSamplingTime.Text = "Zeit(min)";

                    this.labelStaticOverRange.Text = "Max.";
                    this.labelStaticPassRange.Text = "Bestehen";
                    this.labelStaticUnderRange.Text = "Min.";
                    this.labelStaticOverRangeLimit.Text = "Max. Grenze";
                    this.labelStaticUnderRangeLimit.Text = "Min. Grenze";
                    #endregion
                    break;
                case DataStore.E_LanguageID.Japanese:
                    #region Japanese
                    this.buttonOver.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainOverDown));
                    this.buttonOver.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainOverUp));
                    this.buttonPass.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainPassDown));
                    this.buttonPass.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainPassUp));
                    this.buttonUnder.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainUnderDown));
                    this.buttonUnder.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainUnderUp));
                    this.buttonTare.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainTareDown));
                    this.buttonTare.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainTareUp));

                    this.buttonScaleZero.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainZeroDown));
                    this.buttonScaleZero.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainZeroUp));
                    this.buttonClear.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainClearDisable));
                    this.buttonClear.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainClearDown));
                    this.buttonClear.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainClearUp));
                    if (this.ParentForm.SystemConfig.IsLogin == true)
                    {
                        this.buttonMenu.Location = new Point(929, 666);

                        this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainMenuSmallDisable));
                        this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainMenuSmallDown));
                        this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainMenuSmallUp));
                    }
                    else
                    {
                        this.buttonMenu.Location = new Point(839, 666);

                        this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainMenuDisable));
                        this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainMenuDown));
                        this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainMenuUp));
                    }
                    this.buttonSubMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainSubMenuDisable));
                    this.buttonSubMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainSubMenuDown));
                    this.buttonSubMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainSubMenuUp));
                    this.buttonBypassDirection.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnSubMenuNGUp));
                    this.buttonBypassDirection.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnSubMenuPassUp));
                    this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnSubMenuContinueUp));
                    this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnSubMenuOnceUp));
                    this.buttonUser.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainLoginDisable));
                    this.buttonUser.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainLogoffUp));
                    this.buttonUser.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainLoginUp));
                    this.buttonSamplingOnce.DownImage = this.buttonLeakSamplingOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnSubMenuContinueUp));
                    this.buttonSamplingOnce.UpImage = this.buttonLeakSamplingOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnSubMenuOnceUp));

                    this.groupBoxSorter.Text = "ソㅡタㅡ設定";
                    this.labelStaticSorter1DelayTime.Text = "ソㅡタㅡ1 遅延時間";
                    this.labelStaticSorter1RunTime.Text = "ソㅡタㅡ1 運転時間";
                    this.labelStaticSorter2DelayTime.Text = "ソㅡタㅡ2 遅延時間";
                    this.labelStaticSorter2RunTime.Text = "ソㅡタㅡ2 運転時間";
                    this.labelStaticSorter3DelayTime.Text = "ソㅡタㅡ3 遅延時間";
                    this.labelStaticSorter3RunTime.Text = "ソㅡタㅡ3 運転時間";
                    this.labelStaticSorter4DelayTime.Text = "ソㅡタㅡ4 遅延時間";
                    this.labelStaticSorter4RunTime.Text = "ソㅡタㅡ4 運転時間";
                    this.labelStaticEntryGateDelayTime.Text = "エントリㅡゲㅡトの遅延時間";
                    this.labelStaticEntryGateRunTime.Text = "エントリㅡゲㅡトの運転時間";
                    this.labelStaticDischargeStopperDelayTime.Font = font;
                    this.labelStaticDischargeStopperDelayTime.Text = "排出ストッパㅡの遅延時間";
                    this.labelStaticDischargeStopperRunTime.Font = font;
                    this.labelStaticDischargeStopperRunTime.Text = "排出ストッパㅡの運転時間";
                    this.labelStaticStopper2DelayTime.Text = "ストッパー2 遅延時間";
                    this.labelStaticStopper2RunTime.Text = "ストッパー2 運転時間";

                    this.groupBoxJudgmentSetting.Text = "判定設定";
                    this.labelStaticFilter.Text = "フィルタㅡ";
                    this.labelStaticJudgmentDelayTime.Text = "判定の遅れ";
                    this.labelStaticJudgmentCount.Text = "判定番号";
                    this.labelStaticForcedZeroDelayTime.Text = "強制ゼロ遅延時間";
                    this.labelStaticTurnDelayTime.Text = "タㅡン遅延";

                    this.labelTitleTotalCount.Text = "総カウント";
                    this.labelTitleNG.Text = "合計NG";
                    this.labelTitleBypass.Text = "バイパス";
                    this.labelTitleScreen.Text = "画面";
                    this.labelTitleSampling.Text = "サンプリング";

                    this.labelMessage3.Text = "ピンチポイントアラㅡム";
                    this.labelMessage5.Text = "サㅡボモㅡタの原点を設定してください";
                    this.buttonClose.Text = "クロㅡズ";

                    this.labelTitleTotalCount.Font = font1;
                    this.labelTitleTotalCount.Text = "総カウント";
                    this.labelTitleNG.Text = "不良";
                    this.labelTitleBypass.Text = "バイパスモㅡド";
                    this.labelTitleScreen.Text = "画面";
                    this.labelStaticSamplingCount.Text = "カウント";
                    this.labelStaticSamplingTime.Text = "時間(分)";

                    this.labelTitleLeakSampling.Text = "リーク サンプリング";
                    this.labelStaticLeakSamplingTime.Text = "時間(分)";

                    this.labelStaticOverRange.Text = "上限";
                    this.labelStaticPassRange.Text = "合格";
                    this.labelStaticUnderRange.Text = "不足";
                    this.labelStaticOverRangeLimit.Text = "上限リミット";
                    this.labelStaticUnderRangeLimit.Text = "下限リミット";

                    // label 크기 재조정 및 글씨 크기 재조정
                    this.labelTitleTotalCount.Font = new Font("New Gulim", 15F, System.Drawing.FontStyle.Bold);
                    this.labelTitleTotalCount.Location = new Point(25, 704);
                    this.labelTitleTotalCount.Size = new Size(113, 41);

                    this.labelTotalCount.Font = new Font("Tahoma", 16F, System.Drawing.FontStyle.Bold);
                    this.labelTotalCount.Location = new Point(144, 704);
                    this.labelTotalCount.Size = new Size(128, 41);

                    this.labelTitleNG.Font = new Font("New Gulim", 15F, System.Drawing.FontStyle.Bold);
                    this.labelTitleNG.Location = new Point(307, 704);
                    this.labelTitleNG.Size = new Size(71, 41);

                    this.labelNGCount.Font = new Font("Tahoma", 16F, System.Drawing.FontStyle.Bold);
                    this.labelNGCount.Location = new Point(384, 704);
                    this.labelNGCount.Size = new Size(111, 41);
                    #endregion
                    break;
                default:
                    break;
            }
        }
        private void InitializeControl()
        {
            if (this.ParentForm.IsBootingComplete == false)
                this.buttonProductNo.Text = "**";
            else
                this.buttonProductNo.Text = this.ParentForm.SystemConfig.ProductNumber.ToString();

            this.buttonUnder.Text = this.labelUnderRange.Text = Helper.StringToDecimalPlaces(this.ParentForm.CurrentProductItem.UnderRange, this.ParentForm.SystemConfig.DecimalPlaces);
            this.buttonPass.Text = this.labelPassRange.Text = Helper.StringToDecimalPlaces(this.ParentForm.CurrentProductItem.PassRange, this.ParentForm.SystemConfig.DecimalPlaces);
            this.buttonOver.Text = this.labelOverRange.Text = Helper.StringToDecimalPlaces(this.ParentForm.CurrentProductItem.OverRange, this.ParentForm.SystemConfig.DecimalPlaces);
            this.buttonTare.Text = Helper.StringToDecimalPlaces(this.ParentForm.CurrentProductItem.TareRange, this.ParentForm.SystemConfig.DecimalPlaces);
            this.labelUnderRangeLimit.Text = Helper.StringToDecimalPlaces(this.ParentForm.CurrentProductItem.UnderRangeLimit, this.ParentForm.SystemConfig.DecimalPlaces);
            this.labelOverRangeLimit.Text = Helper.StringToDecimalPlaces(this.ParentForm.CurrentProductItem.OverRangeLimit, this.ParentForm.SystemConfig.DecimalPlaces);

            this.labelProductName.Text = this.ParentForm.CurrentProductItem.Name;
            this.labelLotNo.Text = this.ParentForm.CurrentProductItem.LotNo;
            this.labelProductionSpeed.Text = "0";

            if (this.ParentForm.SystemConfig.IsBypassDirectionPass == true)
                this.buttonBypassDirection.ButtonUp();
            else
                this.buttonBypassDirection.ButtonDown();

            if (this.ParentForm.SystemConfig.IsBypassOnce == true)
            {
                this.buttonBypassOnce.ButtonUp();
                this.buttonBypassRun.Mode = SmartButton.BUTTONMODE.NORMAL;
            }
            else
            {
                this.buttonBypassOnce.ButtonDown();
                this.buttonBypassRun.Mode = SmartButton.BUTTONMODE.PUSH;
            }

            this.panelSetting.Location = new Point(429, 74);
            this.panelSetting.Visible = false;
            this.panelSetting.BringToFront();

            this.panelSubMenu1.Location = new Point(4, 573);
            this.panelSubMenu1.Visible = false;
            this.panelSubMenu1.BringToFront();

            this.panelSubMenu2.Location = new Point(4, 573);
            this.panelSubMenu2.Visible = false;
            this.panelSubMenu2.BringToFront();

            this.panelSubMenu3.Location = new Point(4, 573);
            this.panelSubMenu3.Visible = false;
            this.panelSubMenu3.BringToFront();

            this.MainDisplayAlarmList = new ControlMainDisplayAlarm();
            this.Controls.Add(this.MainDisplayAlarmList);
            this.MainDisplayAlarmList.Location = new Point(658, 74);
            this.MainDisplayAlarmList.Visible = false;

            // ICON 
            this.pictureBoxUSBBackOn.Visible = this.ParentForm.SystemConfig.IsDataBackup;
            this.pictureBoxBypass.Visible = this.ParentForm.SystemConfig.IsBypassMode;

            if (this.ParentForm.SystemConfig.Serial3Mode != 0)
                this.pictureBoxCH3.Visible = true;
            else
                this.pictureBoxCH3.Visible = false;

            this.buttonBarGraphForm.ButtonDown();

            // Sorter 3
            if (this.ParentForm.SystemConfig.Sorter3Location == 0)
            {
                this.labelStaticSorter3DelayTime.Visible = false;
                this.labelStaticSorter3RunTime.Visible = false;
                this.labelSorter3DelayTime.Visible = false;
                this.labelSorter3RunTime.Visible = false;

                this.labelTitleSampling.Visible = false;
                this.labelStaticSamplingTime.Visible = false;
                this.labelStaticSamplingCount.Visible = false;
                this.labelSamplingTime.Visible = false;
                this.labelSamplingCount.Visible = false;
                this.buttonSamplingOnce.Visible = false;
                this.buttonSampling.Visible = false;
            }

            // Sorter 4
            if (this.ParentForm.SystemConfig.Sorter4Location == 0)
            {
                this.labelStaticSorter4DelayTime.Visible = false;
                this.labelStaticSorter4RunTime.Visible = false;
                this.labelSorter4DelayTime.Visible = false;
                this.labelSorter4RunTime.Visible = false;

                this.labelStaticStopper2DelayTime.Visible = false;
                this.labelStaticStopper2RunTime.Visible = false;
                this.labelStopper2DelayTime.Visible = false;
                this.labelStopper2RunTime.Visible = false;
            }

            this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    this.MainDisplay2 = new ControlMainDisplay2(this);
                    this.Controls.Add(this.MainDisplay2);
                    this.MainDisplay2.BringToFront();
                    this.MainDisplay2.Location = new Point(0, 75);
                    this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

                    this.MainDisplayDotGraph2 = new ControlMainDisplayDotGraph2(this);
                    this.Controls.Add(this.MainDisplayDotGraph2);
                    this.MainDisplayDotGraph2.BringToFront();
                    this.MainDisplayDotGraph2.Location = new Point(0, 75);
                    break;
                case 3:
                    this.MainDisplay3 = new ControlMainDisplay3(this);
                    this.Controls.Add(this.MainDisplay3);
                    this.MainDisplay3.BringToFront();
                    this.MainDisplay3.Location = new Point(0, 75);
                    this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

                    this.MainDisplayDotGraph3 = new ControlMainDisplayDotGraph3(this);
                    this.Controls.Add(this.MainDisplayDotGraph3);
                    this.MainDisplayDotGraph3.BringToFront();
                    this.MainDisplayDotGraph3.Location = new Point(0, 75);
                    break;
                case 4:
                    this.MainDisplay4 = new ControlMainDisplay4(this);
                    this.Controls.Add(this.MainDisplay4);
                    this.MainDisplay4.BringToFront();
                    this.MainDisplay4.Location = new Point(0, 75);
                    this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

                    this.MainDisplayDotGraph4 = new ControlMainDisplayDotGraph4(this);
                    this.Controls.Add(this.MainDisplayDotGraph4);
                    this.MainDisplayDotGraph4.BringToFront();
                    this.MainDisplayDotGraph4.Location = new Point(0, 75);
                    break;
                case 5:
                    this.MainDisplayEachBarGraph5 = new ControlMainDisplayEachBarGraph5(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph5);
                    this.MainDisplayEachBarGraph5.BringToFront();
                    this.MainDisplayEachBarGraph5.Location = new Point(0, 75);
                    this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

                    this.MainDisplayDotGraph5 = new ControlMainDisplayDotGraph5(this);
                    this.Controls.Add(this.MainDisplayDotGraph5);
                    this.MainDisplayDotGraph5.BringToFront();
                    this.MainDisplayDotGraph5.Location = new Point(0, 75);

                    this.MainDisplayTable5 = new ControlMainDisplayTable5(this);
                    this.Controls.Add(this.MainDisplayTable5);
                    this.MainDisplayTable5.BringToFront();
                    this.MainDisplayTable5.Location = new Point(0, 75);
                    break;
                case 6:
                    this.MainDisplayEachBarGraph6 = new ControlMainDisplayEachBarGraph6(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph6);
                    this.MainDisplayEachBarGraph6.BringToFront();
                    this.MainDisplayEachBarGraph6.Location = new Point(0, 75);
                    this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

                    this.MainDisplayDotGraph6 = new ControlMainDisplayDotGraph6(this);
                    this.Controls.Add(this.MainDisplayDotGraph6);
                    this.MainDisplayDotGraph6.BringToFront();
                    this.MainDisplayDotGraph6.Location = new Point(0, 75);

                    this.MainDisplayTable6 = new ControlMainDisplayTable6(this);
                    this.Controls.Add(this.MainDisplayTable6);
                    this.MainDisplayTable6.BringToFront();
                    this.MainDisplayTable6.Location = new Point(0, 75);
                    break;
                case 7:
                    this.MainDisplayEachBarGraph7 = new ControlMainDisplayEachBarGraph7(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph7);
                    this.MainDisplayEachBarGraph7.BringToFront();
                    this.MainDisplayEachBarGraph7.Location = new Point(0, 75);
                    this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

                    this.MainDisplayDotGraph7 = new ControlMainDisplayDotGraph7(this);
                    this.Controls.Add(this.MainDisplayDotGraph7);
                    this.MainDisplayDotGraph7.BringToFront();
                    this.MainDisplayDotGraph7.Location = new Point(0, 75);

                    this.MainDisplayTable7 = new ControlMainDisplayTable7(this);
                    this.Controls.Add(this.MainDisplayTable7);
                    this.MainDisplayTable7.BringToFront();
                    this.MainDisplayTable7.Location = new Point(0, 75);
                    break;
                case 8:
                    this.MainDisplayEachBarGraph8 = new ControlMainDisplayEachBarGraph8(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph8);
                    this.MainDisplayEachBarGraph8.BringToFront();
                    this.MainDisplayEachBarGraph8.Location = new Point(0, 75);
                    this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

                    this.MainDisplayDotGraph8 = new ControlMainDisplayDotGraph8(this);
                    this.Controls.Add(this.MainDisplayDotGraph8);
                    this.MainDisplayDotGraph8.BringToFront();
                    this.MainDisplayDotGraph8.Location = new Point(0, 75);

                    this.MainDisplayTable8 = new ControlMainDisplayTable8(this);
                    this.Controls.Add(this.MainDisplayTable8);
                    this.MainDisplayTable8.BringToFront();
                    this.MainDisplayTable8.Location = new Point(0, 75);
                    break;
                case 10:
                    this.MainDisplayEachBarGraph10 = new ControlMainDisplayEachBarGraph10(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph10);
                    this.MainDisplayEachBarGraph10.BringToFront();
                    this.MainDisplayEachBarGraph10.Location = new Point(0, 75);
                    this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

                    this.MainDisplayDotGraph10 = new ControlMainDisplayDotGraph10(this);
                    this.Controls.Add(this.MainDisplayDotGraph10);
                    this.MainDisplayDotGraph10.BringToFront();
                    this.MainDisplayDotGraph10.Location = new Point(0, 75);

                    this.MainDisplayTable10 = new ControlMainDisplayTable10(this);
                    this.Controls.Add(this.MainDisplayTable10);
                    this.MainDisplayTable10.BringToFront();
                    this.MainDisplayTable10.Location = new Point(0, 75);
                    break;
                case 12:
                    this.MainDisplayEachBarGraph12 = new ControlMainDisplayEachBarGraph12(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph12);
                    this.MainDisplayEachBarGraph12.BringToFront();
                    this.MainDisplayEachBarGraph12.Location = new Point(0, 75);
                    this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

                    this.MainDisplayDotGraph12 = new ControlMainDisplayDotGraph12(this);
                    this.Controls.Add(this.MainDisplayDotGraph12);
                    this.MainDisplayDotGraph12.BringToFront();
                    this.MainDisplayDotGraph12.Location = new Point(0, 75);

                    this.MainDisplayTable12 = new ControlMainDisplayTable12(this);
                    this.Controls.Add(this.MainDisplayTable12);
                    this.MainDisplayTable12.BringToFront();
                    this.MainDisplayTable12.Location = new Point(0, 75);
                    break;
                case 15:
                    this.MainDisplayEachBarGraph15 = new ControlMainDisplayEachBarGraph15(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph15);
                    this.MainDisplayEachBarGraph15.BringToFront();
                    this.MainDisplayEachBarGraph15.Location = new Point(0, 75);
                    this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

                    this.MainDisplayDotGraph15 = new ControlMainDisplayDotGraph15(this);
                    this.Controls.Add(this.MainDisplayDotGraph15);
                    this.MainDisplayDotGraph15.BringToFront();
                    this.MainDisplayDotGraph15.Location = new Point(0, 75);

                    this.MainDisplayTable15 = new ControlMainDisplayTable15(this);
                    this.Controls.Add(this.MainDisplayTable15);
                    this.MainDisplayTable15.BringToFront();
                    this.MainDisplayTable15.Location = new Point(0, 75);
                    break;
                case 16:
                    this.MainDisplayEachBarGraph16 = new ControlMainDisplayEachBarGraph16(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph16);
                    this.MainDisplayEachBarGraph16.BringToFront();
                    this.MainDisplayEachBarGraph16.Location = new Point(0, 75);
                    this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

                    this.MainDisplayDotGraph16 = new ControlMainDisplayDotGraph16(this);
                    this.Controls.Add(this.MainDisplayDotGraph16);
                    this.MainDisplayDotGraph16.BringToFront();
                    this.MainDisplayDotGraph16.Location = new Point(0, 75);

                    this.MainDisplayTable16 = new ControlMainDisplayTable16(this);
                    this.Controls.Add(this.MainDisplayTable16);
                    this.MainDisplayTable16.BringToFront();
                    this.MainDisplayTable16.Location = new Point(0, 75);
                    break;
                default:
                    break;
            }
            this.UpdateDisplay(this.MainDisplay);
        }
        private void DefaultSetting()
        {
            int x = 0, y = 0;

            this.SubmenuIndex = 0;
            this.IsFistAlarmView = false;
            this.ChangeID = "";

            this.RescaleControl();

            // AlarmMessageBox2
            x = Screen.PrimaryScreen.Bounds.Width / 2 - this.panelAlarmMessageBox2.Size.Width / 2;
            y = Screen.PrimaryScreen.Bounds.Height / 2 - this.panelAlarmMessageBox2.Size.Height / 2;
            this.panelAlarmMessageBox2.Location = new Point(x, y);
            this.panelAlarmMessageBox2.Visible = false;
            this.panelAlarmMessageBox2.BringToFront();
            // AlarmMessageBox3
            this.panelAlarmMessageBox3.Location = new Point(x, y);
            this.panelAlarmMessageBox3.Visible = false;
            this.panelAlarmMessageBox3.BringToFront();
            // AlarmMessageBox4
            this.panelAlarmMessageBox4.Location = new Point(x, y);
            this.panelAlarmMessageBox4.Visible = false;
            this.panelAlarmMessageBox4.BringToFront();

            if (this.ParentForm.SystemConfig.IsLogin == true)
                   this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
            else
            {
                this.buttonUser.Visible = false;
                this.labelUserID.Visible = false;
                this.labelUserLevel.Visible = false;

                this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.NotLogin;
            }

            // 샘플링
            if (this.ParentForm.SystemConfig.IsSamplingOnce == true)
            {
                this.buttonSamplingOnce.ButtonUp();
                this.buttonSampling.Mode = SmartButton.BUTTONMODE.NORMAL;
            }
            else
            {
                this.buttonSamplingOnce.ButtonDown();
                this.buttonSampling.Mode = SmartButton.BUTTONMODE.PUSH;
            }
            this.labelSamplingTime.Text = this.ParentForm.SystemConfig.SamplingTime.ToString();
            this.labelSamplingCount.Text = this.ParentForm.SystemConfig.SamplingCount.ToString();
            this.buttonSampling.Enabled = false;

            // Leak Sampling
            if (this.ParentForm.SystemConfig.IsLeakSamplingOnce == true)
            {
                this.buttonLeakSamplingOnce.ButtonUp();
                this.buttonLeakSampling.Mode = SmartButton.BUTTONMODE.NORMAL;
            }
            else
            {
                this.buttonLeakSamplingOnce.ButtonDown();
                this.buttonLeakSampling.Mode = SmartButton.BUTTONMODE.PUSH;
            }
            this.labelLeakSamplingTime.Text = this.ParentForm.SystemConfig.LeakSamplingTime.ToString();
            this.buttonLeakSampling.Enabled = false;

            // Interlock weight stop
            if (this.ParentForm.SystemConfig.IsWeightLimitEnable == true)
                this.buttonOnOff.ButtonDown();
            else
                this.buttonOnOff.ButtonUp();

            // Ethernet Icon
            this.pictureBoxEthernetDisconnection.Visible = this.ParentForm.SystemConfig.IsEthernetEnable;
        }

        public void RescaleControl()
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplay2 != null)
                        this.MainDisplay2.RescaleControl();
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.RescaleControl();
                    break;
                case 3:
                    if (this.MainDisplay3 != null)
                        this.MainDisplay3.RescaleControl();
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.RescaleControl();
                    break;
                case 4:
                    if (this.MainDisplay4 != null)
                        this.MainDisplay4.RescaleControl();
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.RescaleControl();
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.RescaleControl();
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.RescaleControl();
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.RescaleControl();
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.RescaleControl();
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.RescaleControl();
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.RescaleControl();
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.RescaleControl();
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.RescaleControl();
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.RescaleControl();
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.RescaleControl();
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.RescaleControl();
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.RescaleControl();
                    break;
                case 15:
                    if (this.MainDisplayEachBarGraph15 != null)
                        this.MainDisplayEachBarGraph15.RescaleControl();
                    if (this.MainDisplayDotGraph15 != null)
                        this.MainDisplayDotGraph15.RescaleControl();
                    break;
                case 16:
                    if (this.MainDisplayEachBarGraph16 != null)
                        this.MainDisplayEachBarGraph16.RescaleControl();
                    if (this.MainDisplayDotGraph16 != null)
                        this.MainDisplayDotGraph16.RescaleControl();
                    break;
                default:
                    break;
            }
        }
        private bool UI_Invoke(ThreadStart invoker)
        {
            try
            {
                if (this.InvokeRequired)
                {
                    if (this.IsDisposed)
                        return true;

                    this.Invoke(invoker);
                }
                else
                {
                    invoker();
                }

                return true;

            }
            catch (Exception e)
            {
                return false;
            }

        }
        private void UpdateDisplay(DataStore.FormMainDisplayStore displayForm)
        {
            if (displayForm == DataStore.FormMainDisplayStore.FormMainDisplayBarGraph)
            {
                #region BarGraph
                switch (this.ParentForm.SystemConfig.EquipmentColumns)
                {
                    case 2:
                        if (this.MainDisplay2 != null)
                            this.MainDisplay2.Visible = true;
                        if (this.MainDisplayDotGraph2 != null)
                            this.MainDisplayDotGraph2.Visible = false;
                        break;
                    case 3:
                        if (this.MainDisplay3 != null)
                            this.MainDisplay3.Visible = true;
                        if (this.MainDisplayDotGraph3 != null)
                            this.MainDisplayDotGraph3.Visible = false;
                        break;
                    case 4:
                        if (this.MainDisplay4 != null)
                            this.MainDisplay4.Visible = true;
                        if (this.MainDisplayDotGraph4 != null)
                            this.MainDisplayDotGraph4.Visible = false;
                        break;
                    case 5:
                        if (this.MainDisplayEachBarGraph5 != null)
                            this.MainDisplayEachBarGraph5.Visible = true;
                        if (this.MainDisplayDotGraph5 != null)
                            this.MainDisplayDotGraph5.Visible = false;
                        if (this.MainDisplayTable5 != null)
                            this.MainDisplayTable5.Visible = false;
                        break;
                    case 6:
                        if (this.MainDisplayEachBarGraph6 != null)
                            this.MainDisplayEachBarGraph6.Visible = true;
                        if (this.MainDisplayDotGraph6 != null)
                            this.MainDisplayDotGraph6.Visible = false;
                        if (this.MainDisplayTable6 != null)
                            this.MainDisplayTable6.Visible = false;
                        break;
                    case 7:
                        if (this.MainDisplayEachBarGraph7 != null)
                            this.MainDisplayEachBarGraph7.Visible = true;
                        if (this.MainDisplayDotGraph7 != null)
                            this.MainDisplayDotGraph7.Visible = false;
                        if (this.MainDisplayTable7 != null)
                            this.MainDisplayTable7.Visible = false;
                        break;
                    case 8:
                        if (this.MainDisplayEachBarGraph8 != null)
                            this.MainDisplayEachBarGraph8.Visible = true;
                        if (this.MainDisplayDotGraph8 != null)
                            this.MainDisplayDotGraph8.Visible = false;
                        if (this.MainDisplayTable8 != null)
                            this.MainDisplayTable8.Visible = false;
                        break;
                    case 10:
                        if (this.MainDisplayEachBarGraph10 != null)
                            this.MainDisplayEachBarGraph10.Visible = true;
                        if (this.MainDisplayDotGraph10 != null)
                            this.MainDisplayDotGraph10.Visible = false;
                        if (this.MainDisplayTable10 != null)
                            this.MainDisplayTable10.Visible = false;
                        break;
                    case 12:
                        if (this.MainDisplayEachBarGraph12 != null)
                            this.MainDisplayEachBarGraph12.Visible = true;
                        if (this.MainDisplayDotGraph12 != null)
                            this.MainDisplayDotGraph12.Visible = false;
                        if (this.MainDisplayTable12 != null)
                            this.MainDisplayTable12.Visible = false;
                        break;
                    case 15:
                        if (this.MainDisplayEachBarGraph15 != null)
                            this.MainDisplayEachBarGraph15.Visible = true;
                        if (this.MainDisplayDotGraph15 != null)
                            this.MainDisplayDotGraph15.Visible = false;
                        if (this.MainDisplayTable15 != null)
                            this.MainDisplayTable15.Visible = false;
                        break;
                    case 16:
                        if (this.MainDisplayEachBarGraph16 != null)
                            this.MainDisplayEachBarGraph16.Visible = true;
                        if (this.MainDisplayDotGraph16 != null)
                            this.MainDisplayDotGraph16.Visible = false;
                        if (this.MainDisplayTable16 != null)
                            this.MainDisplayTable16.Visible = false;
                        break;
                    default:
                        break;
                }
                #endregion
                this.UpdateDisplayButton(SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
            }
            else if (displayForm == DataStore.FormMainDisplayStore.FormMainDisplayDotGraph)
            {
                #region DotGraph
                switch (this.ParentForm.SystemConfig.EquipmentColumns)
                {
                    case 2:
                        if (this.MainDisplay2 != null)
                            this.MainDisplay2.Visible = false;
                        if (this.MainDisplayDotGraph2 != null)
                            this.MainDisplayDotGraph2.Visible = true;
                        break;
                    case 3:
                        if (this.MainDisplay3 != null)
                            this.MainDisplay3.Visible = false;
                        if (this.MainDisplayDotGraph3 != null)
                            this.MainDisplayDotGraph3.Visible = true;
                        break;
                    case 4:
                        if (this.MainDisplay4 != null)
                            this.MainDisplay4.Visible = false;
                        if (this.MainDisplayDotGraph4 != null)
                            this.MainDisplayDotGraph4.Visible = true;
                        break;
                    case 5:
                        if (this.MainDisplayEachBarGraph5 != null)
                            this.MainDisplayEachBarGraph5.Visible = false;
                        if (this.MainDisplayDotGraph5 != null)
                            this.MainDisplayDotGraph5.Visible = true;
                        if (this.MainDisplayTable5 != null)
                            this.MainDisplayTable5.Visible = false;
                        break;
                    case 6:
                        if (this.MainDisplayEachBarGraph6 != null)
                            this.MainDisplayEachBarGraph6.Visible = false;
                        if (this.MainDisplayDotGraph6 != null)
                            this.MainDisplayDotGraph6.Visible = true;
                        if (this.MainDisplayTable6 != null)
                            this.MainDisplayTable6.Visible = false;
                        break;
                    case 7:
                        if (this.MainDisplayEachBarGraph7 != null)
                            this.MainDisplayEachBarGraph7.Visible = false;
                        if (this.MainDisplayDotGraph7 != null)
                            this.MainDisplayDotGraph7.Visible = true;
                        if (this.MainDisplayTable7 != null)
                            this.MainDisplayTable7.Visible = false;
                        break;
                    case 8:
                        if (this.MainDisplayEachBarGraph8 != null)
                            this.MainDisplayEachBarGraph8.Visible = false;
                        if (this.MainDisplayDotGraph8 != null)
                            this.MainDisplayDotGraph8.Visible = true;
                        if (this.MainDisplayTable8 != null)
                            this.MainDisplayTable8.Visible = false;
                        break;
                    case 10:
                        if (this.MainDisplayEachBarGraph10 != null)
                            this.MainDisplayEachBarGraph10.Visible = false;
                        if (this.MainDisplayDotGraph10 != null)
                            this.MainDisplayDotGraph10.Visible = true;
                        if (this.MainDisplayTable10 != null)
                            this.MainDisplayTable10.Visible = false;
                        break;
                    case 12:
                        if (this.MainDisplayEachBarGraph12 != null)
                            this.MainDisplayEachBarGraph12.Visible = false;
                        if (this.MainDisplayDotGraph12 != null)
                            this.MainDisplayDotGraph12.Visible = true;
                        if (this.MainDisplayTable12 != null)
                            this.MainDisplayTable12.Visible = false;
                        break;
                    case 15:
                        if (this.MainDisplayEachBarGraph15 != null)
                            this.MainDisplayEachBarGraph15.Visible = false;
                        if (this.MainDisplayDotGraph15 != null)
                            this.MainDisplayDotGraph15.Visible = true;
                        if (this.MainDisplayTable15 != null)
                            this.MainDisplayTable15.Visible = false;
                        break;
                    case 16:
                        if (this.MainDisplayEachBarGraph16 != null)
                            this.MainDisplayEachBarGraph16.Visible = false;
                        if (this.MainDisplayDotGraph16 != null)
                            this.MainDisplayDotGraph16.Visible = true;
                        if (this.MainDisplayTable16 != null)
                            this.MainDisplayTable16.Visible = false;
                        break;
                    default:
                        break;
                }
                #endregion
                this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP);
            }
            else if (displayForm == DataStore.FormMainDisplayStore.FormMainDisplayTable)
            {
                #region Table
                switch (this.ParentForm.SystemConfig.EquipmentColumns)
                {
                    case 2:
                        if (this.MainDisplay2 != null)
                            this.MainDisplay2.Visible = true;
                        if (this.MainDisplayDotGraph2 != null)
                            this.MainDisplayDotGraph2.Visible = false;
                        break;
                    case 3:
                        if (this.MainDisplay3 != null)
                            this.MainDisplay3.Visible = true;
                        if (this.MainDisplayDotGraph3 != null)
                            this.MainDisplayDotGraph3.Visible = false;
                        break;
                    case 4:
                        if (this.MainDisplay4 != null)
                            this.MainDisplay4.Visible = true;
                        if (this.MainDisplayDotGraph4 != null)
                            this.MainDisplayDotGraph4.Visible = false;
                        break;
                    case 5:
                        if (this.MainDisplayEachBarGraph5 != null)
                            this.MainDisplayEachBarGraph5.Visible = false;
                        if (this.MainDisplayDotGraph5 != null)
                            this.MainDisplayDotGraph5.Visible = false;
                        if (this.MainDisplayTable5 != null)
                            this.MainDisplayTable5.Visible = true;
                        break;
                    case 6:
                        if (this.MainDisplayEachBarGraph6 != null)
                            this.MainDisplayEachBarGraph6.Visible = false;
                        if (this.MainDisplayDotGraph6 != null)
                            this.MainDisplayDotGraph6.Visible = false;
                        if (this.MainDisplayTable6 != null)
                            this.MainDisplayTable6.Visible = true;
                        break;
                    case 7:
                        if (this.MainDisplayEachBarGraph7 != null)
                            this.MainDisplayEachBarGraph7.Visible = false;
                        if (this.MainDisplayDotGraph7 != null)
                            this.MainDisplayDotGraph7.Visible = false;
                        if (this.MainDisplayTable7 != null)
                            this.MainDisplayTable7.Visible = true;
                        break;
                    case 8:
                        if (this.MainDisplayEachBarGraph8 != null)
                            this.MainDisplayEachBarGraph8.Visible = false;
                        if (this.MainDisplayDotGraph8 != null)
                            this.MainDisplayDotGraph8.Visible = false;
                        if (this.MainDisplayTable8 != null)
                            this.MainDisplayTable8.Visible = true;
                        break;
                    case 10:
                        if (this.MainDisplayEachBarGraph10 != null)
                            this.MainDisplayEachBarGraph10.Visible = false;
                        if (this.MainDisplayDotGraph10 != null)
                            this.MainDisplayDotGraph10.Visible = false;
                        if (this.MainDisplayTable10 != null)
                            this.MainDisplayTable10.Visible = true;
                        break;
                    case 12:
                        if (this.MainDisplayEachBarGraph12 != null)
                            this.MainDisplayEachBarGraph12.Visible = false;
                        if (this.MainDisplayDotGraph12 != null)
                            this.MainDisplayDotGraph12.Visible = false;
                        if (this.MainDisplayTable12 != null)
                            this.MainDisplayTable12.Visible = true;
                        break;
                    case 15:
                        if (this.MainDisplayEachBarGraph15 != null)
                            this.MainDisplayEachBarGraph15.Visible = false;
                        if (this.MainDisplayDotGraph15 != null)
                            this.MainDisplayDotGraph15.Visible = false;
                        if (this.MainDisplayTable15 != null)
                            this.MainDisplayTable15.Visible = true;
                        break;
                    case 16:
                        if (this.MainDisplayEachBarGraph16 != null)
                            this.MainDisplayEachBarGraph16.Visible = false;
                        if (this.MainDisplayDotGraph16 != null)
                            this.MainDisplayDotGraph16.Visible = false;
                        if (this.MainDisplayTable16 != null)
                            this.MainDisplayTable16.Visible = true;
                        break;
                    default:
                        break;
                }
                #endregion
                this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN);
            }
        }
        private void UpdateDisplayButton(SmartButton.BUTSTATUS buttonBar, SmartButton.BUTSTATUS buttonDot, SmartButton.BUTSTATUS buttonTable)
        {
            if(buttonBar == SmartButton.BUTSTATUS.DOWN)
                this.buttonBarGraphForm.ButtonDown();
            else
                this.buttonBarGraphForm.ButtonUp();

            if (buttonDot == SmartButton.BUTSTATUS.DOWN)
                this.buttonDotGraphForm.ButtonDown();
            else
                this.buttonDotGraphForm.ButtonUp();

            if (buttonTable == SmartButton.BUTSTATUS.DOWN)
                this.buttonTableForm.ButtonDown();
            else
                this.buttonTableForm.ButtonUp();
        }
        public void UpdateDisplayUser(UserItem user)
        {
            string id = "", group = "", expirePW = "";
            int expireDate = 0;
            Color colorExpirePW = this.ParentForm.ColorLogOff;

            switch (user.Group)
            {
                case DataStore.UserGroup.None:
                    break;
                case DataStore.UserGroup.Level1:
                    id = user.ID;
                    group = this.ParentForm.SystemConfig.User_Level1_Name;

                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.labelExpireOfPassword.Visible = true;

                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
                        this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;

                    this.buttonUser.ButtonDown();
                    this.buttonProductNo.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayProductNo;
                    this.buttonSubMenu.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMainDisplaySubMenu;
                    this.buttonClear.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayClear;
                    this.buttonUnder.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayWeightSetting;
                    this.buttonPass.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayWeightSetting;
                    this.buttonOver.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayWeightSetting;
                    this.buttonTare.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayWeightSetting;

                    this.buttonMenu.Enabled = true;
                    break;
                case DataStore.UserGroup.Level2:
                    id = user.ID;
                    group = this.ParentForm.SystemConfig.User_Level2_Name;

                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.labelExpireOfPassword.Visible = true;

                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
                        this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;

                    this.buttonUser.ButtonDown();
                    this.buttonProductNo.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayProductNo;
                    this.buttonSubMenu.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMainDisplaySubMenu;
                    this.buttonClear.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayClear;
                    this.buttonUnder.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayWeightSetting;
                    this.buttonPass.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayWeightSetting;
                    this.buttonOver.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayWeightSetting;
                    this.buttonTare.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayWeightSetting;

                    this.buttonMenu.Enabled = true;
                    break;
                case DataStore.UserGroup.Level3:
                    id = user.ID;
                    group = this.ParentForm.SystemConfig.User_Level3_Name;

                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.labelExpireOfPassword.Visible = true;

                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
                        this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;

                    this.buttonUser.ButtonDown();
                    this.buttonProductNo.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayProductNo;
                    this.buttonSubMenu.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMainDisplaySubMenu;
                    this.buttonClear.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayClear;
                    this.buttonUnder.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayWeightSetting;
                    this.buttonPass.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayWeightSetting;
                    this.buttonOver.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayWeightSetting;
                    this.buttonTare.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayWeightSetting;

                    this.buttonMenu.Enabled = true;
                    break;
                case DataStore.UserGroup.Admin:
                    id = user.ID;
                    if (this.ParentForm.SystemConfig.Language == DataStore.E_LanguageID.German)
                        group = "Administrator";
                    else
                        group = "Administrator";

                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.labelExpireOfPassword.Visible = true;

                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
                        this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;

                    this.buttonUser.ButtonDown();
                    this.buttonProductNo.Enabled = true;
                    this.buttonSubMenu.Enabled = true;
                    this.buttonClear.Enabled = true;
                    this.buttonUnder.Enabled = true;
                    this.buttonPass.Enabled = true;
                    this.buttonOver.Enabled = true;
                    this.buttonTare.Enabled = true;

                    this.buttonMenu.Enabled = true;
                    break;
                case DataStore.UserGroup.Developer:
                    id = user.ID;
                    if (this.ParentForm.SystemConfig.Language == DataStore.E_LanguageID.German)
                        group = "Entwickler";
                    else
                        group = "Developer";

                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.labelExpireOfPassword.Visible = true;

                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
                        this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;

                    this.buttonUser.ButtonDown();
                    this.buttonProductNo.Enabled = true;
                    this.buttonSubMenu.Enabled = true;
                    this.buttonClear.Enabled = true;
                    this.buttonUnder.Enabled = true;
                    this.buttonPass.Enabled = true;
                    this.buttonOver.Enabled = true;
                    this.buttonTare.Enabled = true;

                    this.buttonMenu.Enabled = true;
                    break;
                case DataStore.UserGroup.NotLogin:
                    id = "";
                    group = "";

                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
                        this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;

                    this.buttonProductNo.Enabled = true;
                    this.buttonSubMenu.Enabled = true;
                    this.buttonClear.Enabled = true;
                    this.buttonUnder.Enabled = true;
                    this.buttonPass.Enabled = true;
                    this.buttonOver.Enabled = true;
                    this.buttonTare.Enabled = true;

                    this.buttonMenu.Enabled = true;
                    break;
                case DataStore.UserGroup.LogOut:
                    id = "";
                    if (this.ParentForm.SystemConfig.Language == DataStore.E_LanguageID.German)
                        group = "Ausloggen";
                    else if (this.ParentForm.SystemConfig.Language == DataStore.E_LanguageID.Chinese)
                        group = "登出";
                    else
                        group = "Log out";

                    this.labelExpireOfPassword.Visible = false;

                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
                        this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOff;

                    this.buttonUser.ButtonUp();
                    this.buttonProductNo.Enabled = false;
                    this.buttonSubMenu.Enabled = false;
                    this.buttonClear.Enabled = false;
                    this.buttonUnder.Enabled = false;
                    this.buttonPass.Enabled = false;
                    this.buttonOver.Enabled = false;
                    this.buttonTare.Enabled = false;

                    this.buttonMenu.Enabled = false;
                    break;
                default:
                    break;
            }

            if (this.ParentForm.SystemConfig.IsLogin == true)
            {
                if (this.ParentForm.SystemConfig.IsPart11 == true)
                {
                    if (user.ExpirePassword != 0)
                    {
                        expireDate = user.GetPasswordExpiryDday();
                        if (expireDate == 9999)
                        {
                            // Administrator or Developer
                            colorExpirePW = this.ParentForm.ColorLogOn;
                            expirePW = "-";
                        }
                        else
                        {
                            if (expireDate >= -10)
                            {
                                colorExpirePW = this.ParentForm.ColorLogOff;
                                if (expireDate > 0)
                                    expirePW = string.Format("D+{0}", expireDate);
                                else
                                    expirePW = string.Format("D{0}", expireDate);
                            }
                            else
                            {
                                colorExpirePW = this.ParentForm.ColorLogOn;
                                expirePW = string.Format("D{0}", expireDate);
                            }
                        }
                    }
                    else
                    {
                        colorExpirePW = this.ParentForm.ColorLogOn;
                        expirePW = "-";
                    }
                }
                else
                {
                    // Part11 미사용
                    colorExpirePW = this.ParentForm.ColorLogOn;
                    expirePW = "-";
                }
            }

            if (this.labelUserLevel.Text != group)
                this.labelUserLevel.Text = group;
            if (this.labelUserID.Text != id)
                this.labelUserID.Text = id;
            if (this.labelExpireOfPassword.ForeColor != colorExpirePW)
                this.labelExpireOfPassword.ForeColor = colorExpirePW;
            if (this.labelExpireOfPassword.Text != expirePW)
                this.labelExpireOfPassword.Text = expirePW;
        }

        public void UpdateCurrentProductDisplay(DataStore.EquipmentStatus status, ProductItem pItem,JudgmentSetItem jItem, Collection<WeightData> weightDatas)
        {
            string value = "";

            this.labelTimeroutCount.Visible = false;

            value = pItem.Number.ToString();
            if (this.buttonProductNo.Text != value)
                this.buttonProductNo.Text = value;

            value = pItem.Name;
            if (this.labelProductName.Text != value)
                this.labelProductName.Text = value;

            value = pItem.LotNo;
            if (this.labelLotNo.Text != value)
                this.labelLotNo.Text = value;

            value = Helper.StringToDecimalPlaces(pItem.UnderRange, this.ParentForm.SystemConfig.DecimalPlaces);
            if (this.buttonUnder.Text != value)
            {
                this.buttonUnder.Text = value;
                this.labelUnderRange.Text = value;
            }

            value = Helper.StringToDecimalPlaces(pItem.PassRange, this.ParentForm.SystemConfig.DecimalPlaces);
            if (this.buttonPass.Text != value)
            {
                this.buttonPass.Text = value;
                this.labelPassRange.Text = value;
            }

            value = Helper.StringToDecimalPlaces(pItem.OverRange, this.ParentForm.SystemConfig.DecimalPlaces);
            if (this.buttonOver.Text != value)
            {
                this.buttonOver.Text = value;
                this.labelOverRange.Text = value;
            }

            value = Helper.StringToDecimalPlaces(pItem.TareRange, this.ParentForm.SystemConfig.DecimalPlaces);
            if (this.buttonTare.Text != value)
                this.buttonTare.Text = value;

            value = Helper.StringToDecimalPlaces(pItem.OverRangeLimit, this.ParentForm.SystemConfig.DecimalPlaces);
            if (this.labelOverRangeLimit.Text != value)
                this.labelOverRangeLimit.Text = value;

            value = Helper.StringToDecimalPlaces(pItem.UnderRangeLimit, this.ParentForm.SystemConfig.DecimalPlaces);
            if (this.labelUnderRangeLimit.Text != value)
                this.labelUnderRangeLimit.Text = value;

            value = jItem.Sorter1DelayTime.ToString();
            if (this.labelSorter1DelayTime.Text != value)
                this.labelSorter1DelayTime.Text = value;

            value = jItem.Sorter1RunTime.ToString();
            if (this.labelSorter1RunTime.Text != value)
                this.labelSorter1RunTime.Text = value;

            value = jItem.Sorter2DelayTime.ToString();
            if (this.labelSorter2DelayTime.Text != value)
                this.labelSorter2DelayTime.Text = value;

            value = jItem.Sorter2RunTime.ToString();
            if (this.labelSorter2RunTime.Text != value)
                this.labelSorter2RunTime.Text = value;

            value = jItem.Sorter3DelayTime;
            if (this.labelSorter3DelayTime.Text != value)
                this.labelSorter3DelayTime.Text = value;

            value = jItem.Sorter3RunTime;
            if (this.labelSorter3RunTime.Text != value)
                this.labelSorter3RunTime.Text = value;

            value = jItem.Sorter4DelayTime;
            if (this.labelSorter4DelayTime.Text != value)
                this.labelSorter4DelayTime.Text = value;

            value = jItem.Sorter4RunTime;
            if (this.labelSorter4RunTime.Text != value)
                this.labelSorter4RunTime.Text = value;

            value = jItem.EntryGateDelayTime.ToString();
            if (this.labelEntryGateDelayTime.Text != value)
                this.labelEntryGateDelayTime.Text = value;

            value = jItem.EntryGateRunTime.ToString();
            if (this.labelEntryGateRunTime.Text != value)
                this.labelEntryGateRunTime.Text = value;

            value = jItem.DischargeStopperDelayTime.ToString();
            if (this.labelDischargeStopperDelayTime.Text != value)
                this.labelDischargeStopperDelayTime.Text = value;

            value = jItem.DischargeStopperRunTime.ToString();
            if (this.labelDischargeStopperRunTime.Text != value)
                this.labelDischargeStopperRunTime.Text = value;

            value = jItem.Stopper2DelayTime.ToString();
            if (this.labelStopper2DelayTime.Text != value)
                this.labelStopper2DelayTime.Text = value;

            value = jItem.Stopper2RunTime.ToString();
            if (this.labelStopper2RunTime.Text != value)
                this.labelStopper2RunTime.Text = value;

            value = jItem.Filter.ToString();
            if (this.labelFilter.Text != value)
                this.labelFilter.Text = value;

            value = jItem.JudgmentDelayTime.ToString();
            if (this.labelJudgmentDelayTime.Text != value)
                this.labelJudgmentDelayTime.Text = value;

            value = jItem.JudgmentCount.ToString();
            if (this.labelJudgmentCount.Text != value)
                this.labelJudgmentCount.Text = value;

            value = jItem.ForcedZeroDelayTime.ToString();
            if (this.labelForcedZeroDelayTime.Text != value)
                this.labelForcedZeroDelayTime.Text = value;

            value = jItem.TurnDelayTime.ToString();
            if (this.labelTurnDelayTime.Text != value)
                this.labelTurnDelayTime.Text = value;

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplay2 != null)
                        this.MainDisplay2.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 3:
                    if (this.MainDisplay3 != null)
                        this.MainDisplay3.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 4:
                    if (this.MainDisplay4 != null)
                        this.MainDisplay4.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 15:
                    if (this.MainDisplayEachBarGraph15 != null)
                        this.MainDisplayEachBarGraph15.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph15 != null)
                        this.MainDisplayDotGraph15.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable15 != null)
                        this.MainDisplayTable15.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 16:
                    if (this.MainDisplayEachBarGraph16 != null)
                        this.MainDisplayEachBarGraph16.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph16 != null)
                        this.MainDisplayDotGraph16.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable16 != null)
                        this.MainDisplayTable16.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                default:
                    break;
            }

            this.RescaleControl();

            #region 서보모터 속도 변경
            if (this.ParentForm.SystemConfig.MotorSelect == 1)
            {
                this.ParentForm.ServoMotorWrite1(1, ServoMotorParameterAddress.Speed1, jItem.FeedSpeed);
                //Thread.Sleep(50);
                this.ParentForm.ServoMotorWrite(1, ServoMotorParameterAddress.SaveAllParameters, ServoMotorParameterAddress.EEPROM);

                if (this.ParentForm.SystemConfig.IsLogin == true)
                {
                    this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
                }
                else
                {
                    this.buttonProductNo.Enabled = true;
                    this.buttonUnder.Enabled = true;
                    this.buttonPass.Enabled = true;
                    this.buttonOver.Enabled = true;
                    this.buttonTare.Enabled = true;
                    this.buttonSubMenu.Enabled = true;
                    this.buttonMenu.Enabled = true;
                }
            }
            #endregion
        }
        public void UpdateEquipmentStatusDisplay(DataStore.EquipmentStatus status)
        {
            StringBuilder sb = new StringBuilder();

            if (status == DataStore.EquipmentStatus.Start)
            {
                #region Start
                this.pictureBoxStart.Visible = true;
                this.pictureBoxStop.Visible = false;
                this.buttonProductNo.Enabled = false;
                this.labelProductName.Enabled = false;

                // 샘플링
                this.buttonSampling.Enabled = true;
                // Leak Sampling
                this.buttonLeakSampling.Enabled = true;

                // 공압 알람 이면 장비 정지
                if(this.ParentForm.CurrentAlarmList.IsPressureError == true)
                    this.ParentForm.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
                #endregion
            }
            else
            {
                #region Stop
                this.ParentForm.SaveCounterFile1(this.ParentForm.CollectionWeightData, this.ParentForm.SystemConfig.ProductNumber - 1);
                if (this.ParentForm.SystemConfig.EquipmentColumns >= 13)
                    this.ParentForm.SaveCounterFile2(this.ParentForm.CollectionWeightData, this.ParentForm.SystemConfig.ProductNumber - 1);

                this.pictureBoxStart.Visible = false;
                this.pictureBoxStop.Visible = true;
                this.labelProductName.Enabled = true;

                if (this.panelSetting.Visible == true)
                    this.panelSetting.Visible = false;

                this.buttonCut.ButtonUp();
                this.timerCutSignal.Enabled = false;

                // 샘플링 초기화
                this.buttonSampling.ButtonUp();
                this.buttonSampling.Enabled = false;
                this.buttonSamplingOnce.Enabled = true;
                this.labelSamplingTime.Enabled = true;
                this.labelSamplingCount.Enabled = true;
                this.labelSamplingTime.BackColor = Color.White;
                this.labelSamplingCount.BackColor = Color.White;
                this.ParentForm.SystemConfig.IsSamplingRun = false;
                this.ParentForm.timerSampling.Enabled = false;
                this.ParentForm.SystemConfig.SamplingCurrentCount = 0;

                // Leak Sampling 초기화
                this.buttonLeakSampling.ButtonUp();
                this.buttonLeakSampling.Enabled = false;
                this.buttonLeakSamplingOnce.Enabled = true;
                this.labelLeakSamplingTime.BackColor = Color.White;
                this.ParentForm.SystemConfig.IsLeakSamplingRun = false;
                this.ParentForm.timerLeakSampling.Enabled = false;
                this.smartTimerLeakRunDelay.Stop();

                if (this.ParentForm.SystemConfig.IsPart11 == true)
                    this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
                else
                    this.buttonProductNo.Enabled = true;
                #endregion
            }

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplay2 != null)
                        this.MainDisplay2.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.UpdateEquipmentStatusDisplay(status);
                    break;
                case 3:
                    if (this.MainDisplay3 != null)
                        this.MainDisplay3.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.UpdateEquipmentStatusDisplay(status);
                    break;
                case 4:
                    if (this.MainDisplay4 != null)
                        this.MainDisplay4.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateEquipmentStatusDisplay(status);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateEquipmentStatusDisplay(status);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateEquipmentStatusDisplay(status);
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateEquipmentStatusDisplay(status);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateEquipmentStatusDisplay(status);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateEquipmentStatusDisplay(status);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateEquipmentStatusDisplay(status);
                    break;
                case 15:
                    if (this.MainDisplayEachBarGraph15 != null)
                        this.MainDisplayEachBarGraph15.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph15 != null)
                        this.MainDisplayDotGraph15.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable15 != null)
                        this.MainDisplayTable15.UpdateEquipmentStatusDisplay(status);
                    break;
                case 16:
                    if (this.MainDisplayEachBarGraph16 != null)
                        this.MainDisplayEachBarGraph16.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph16 != null)
                        this.MainDisplayDotGraph16.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable16 != null)
                        this.MainDisplayTable16.UpdateEquipmentStatusDisplay(status);
                    break;
                default:
                    break;
            }
        }
        public void UpdateStopWeightDisplay(DataStore.EquipmentStatus status, Collection<WeightData> weightDatas)
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplay2 != null)
                        this.MainDisplay2.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 3:
                    if (this.MainDisplay3 != null)
                        this.MainDisplay3.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 4:
                    if (this.MainDisplay4 != null)
                        this.MainDisplay4.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 15:
                    if (this.MainDisplayEachBarGraph15 != null)
                        this.MainDisplayEachBarGraph15.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph15 != null)
                        this.MainDisplayDotGraph15.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable15 != null)
                        this.MainDisplayTable15.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 16:
                    if (this.MainDisplayEachBarGraph16 != null)
                        this.MainDisplayEachBarGraph16.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph16 != null)
                        this.MainDisplayDotGraph16.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable16 != null)
                        this.MainDisplayTable16.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                default:
                    break;
            }
        }
        public void UpdateStartWeightDisplay(DataStore.EquipmentStatus status, Collection<WeightData> weightDatas)
        {
            string value = "";

            value = weightDatas[0].ProductionSpeed.ToString();
            if (this.labelProductionSpeed.Text != value)
                this.labelProductionSpeed.Text = value;

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplay2 != null)
                        this.MainDisplay2.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 3:
                    if (this.MainDisplay3 != null)
                        this.MainDisplay3.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 4:
                    if (this.MainDisplay4 != null)
                        this.MainDisplay4.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 15:
                    if (this.MainDisplayEachBarGraph15 != null)
                        this.MainDisplayEachBarGraph15.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph15 != null)
                        this.MainDisplayDotGraph15.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable15 != null)
                        this.MainDisplayTable15.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 16:
                    if (this.MainDisplayEachBarGraph16 != null)
                        this.MainDisplayEachBarGraph16.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph16 != null)
                        this.MainDisplayDotGraph16.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable16 != null)
                        this.MainDisplayTable16.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateDisplayAlarmView(AlarmList alarm)
        {
            bool isAlarmMessageView = false;

            if (alarm.IsEntrySensorError == true || alarm.IsLoadcellError == true || alarm.IsPressureError == true ||
                alarm.IsEmergencyStop == true || alarm.IsServoAlarm == true || alarm.IsServoAlarmTorque == true ||
                alarm.IsProductDischargeError == true || alarm.IsSorter1Error == true || alarm.IsSorter2Error == true)
            {
                this.pictureBoxAlarm.Visible = true;
            }
            else
            {
                this.IsFistAlarmView = false;
                this.pictureBoxAlarm.Visible = false;
                this.MainDisplayAlarmList.Visible = false;
            }

            this.MainDisplayAlarmList.listBoxMessage.ClearAll();

            if (alarm.IsEntrySensorError == true)
            {
                this.MainDisplayAlarmList.listBoxMessage.AddItem("Entry sensor error");
                isAlarmMessageView = true;
            }
            if (alarm.IsLoadcellError == true)
            {
                this.MainDisplayAlarmList.listBoxMessage.AddItem("LoadCell error");
                isAlarmMessageView = true;
            }
            if (alarm.IsPressureError == true)
            {
                this.MainDisplayAlarmList.listBoxMessage.AddItem("Pressure error");
                isAlarmMessageView = true;
            }
            if (alarm.IsEmergencyStop == true)
            {
                this.MainDisplayAlarmList.listBoxMessage.AddItem("Emergency stop");
                //isAlarmMessageView = true;
            }
            if (alarm.IsServoAlarm == true)
            {
                this.MainDisplayAlarmList.listBoxMessage.AddItem("Servo alarm");
                isAlarmMessageView = true;
            }
            if (alarm.IsServoAlarmTorque == true)
            {
                this.MainDisplayAlarmList.listBoxMessage.AddItem("Servo torque alarm");
                isAlarmMessageView = true;
            }
            if (alarm.IsProductDischargeError == true)
            {
                this.MainDisplayAlarmList.listBoxMessage.AddItem("Product discharge error");
                isAlarmMessageView = true;
            }
            if (alarm.IsSorter1Error == true)
            {
                this.MainDisplayAlarmList.listBoxMessage.AddItem("Sorter1 error");
                isAlarmMessageView = true;
            }
            if (alarm.IsSorter2Error == true)
            {
                this.MainDisplayAlarmList.listBoxMessage.AddItem("Sorter2 error");
                isAlarmMessageView = true;
            }

            if (this.IsFistAlarmView == false && isAlarmMessageView == true)
            {
                this.IsFistAlarmView = true;
                this.UpdateDisplayAlarmMessage1(alarm);
            }
        }
        public void UpdateDisplayProductChangeInfo(int cnt)
        {
            this.labelTimeroutCount.Visible = true;
            this.labelTimeroutCount.Text = cnt.ToString();
        }
        public void UpdateDisplayProductJamAlarm(string lane)
        {
            string message = "";
            switch (this.ParentForm.SystemConfig.Language)
            {
                case DataStore.E_LanguageID.Korean:
                    message = "제품 끼임 발생!";
                    break;
                case DataStore.E_LanguageID.English:
                    message = "Product Jam!";
                    break;
                case DataStore.E_LanguageID.Chinese:
                    message = "Product Jam!";
                    break;
                case DataStore.E_LanguageID.Czech:
                    message = "Product Jam!";
                    break;
                case DataStore.E_LanguageID.German:
                    message = "Product Jam!";
                    break;
                case DataStore.E_LanguageID.Japanese:
                    message = "ピンチポイントアラㅡム!";
                    break;
                default:
                    break;
            }

            this.labelMessage3.Text = string.Format("{0} Lane", lane);
            this.labelMessage4.Text = message;
            this.panelAlarmMessageBox3.BringToFront();
            this.panelAlarmMessageBox3.Visible = true;
            //if (this.ParentForm.CurrentAlarmList.IsBuzzerStatus == false)
            //{
            //    this.ParentForm.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard);
            //    this.ParentForm.CurrentAlarmList.IsBuzzerStatus = true;
            //}
        }
        public void UpdateDisplayAlarmMessage1(AlarmList alarm)
        {
            this.smartListBox1.ClearAll();

            //if (alarm.IsEmergencyStop == true)
            //    this.smartListBox1.AddItem("Emergency Stop");
            if (alarm.IsLoadcellError == true)
                this.smartListBox1.AddItem("LoadCell Error");
            if (alarm.IsPressureError == true)
                this.smartListBox1.AddItem("Pressure Error");
            if (alarm.IsServoAlarm == true)
                this.smartListBox1.AddItem("Servo Alarm");
            if (alarm.IsServoAlarmTorque == true)
                this.smartListBox1.AddItem("Servo Torque Alarm");
            if (alarm.IsEntrySensorError == true)
                this.smartListBox1.AddItem("Entry Sensor Error");
            if (alarm.IsProductDischargeError == true)
                this.smartListBox1.AddItem("Product discharge error");
            if (alarm.IsSorter1Error == true)
                this.smartListBox1.AddItem("Sorter1 error");
            if (alarm.IsSorter2Error == true)
                this.smartListBox1.AddItem("Sorter2 error");

            // bypass 설정 체크
            bool isBypass = false;
            if (alarm.IsLoadcellError == true)
            {
                foreach (WeightData data in this.ParentForm.CollectionWeightData)
                {
                    if (data.IsBypassMode == true)
                    {
                        isBypass = true;
                        continue;
                    }
                }
            }

            if (alarm.IsLoadcellError == true)
            {
                if (isBypass == true)
                    return;
            }

            if (this.ParentForm.CurrentAlarmList.IsBuzzerStatus == false)
            {
                this.panelAlarmMessageBox2.BringToFront();
                this.panelAlarmMessageBox2.Visible = true;

                this.ParentForm.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
                this.ParentForm.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard);
                this.ParentForm.CurrentAlarmList.IsBuzzerStatus = true;
            }
        }
        public void UpdateDisplayAlarmMessageServoOrigin()
        {
            if (this.ParentForm.IsServoOrigin == true)
            {
                this.panelAlarmMessageBox4.BringToFront();
                this.panelAlarmMessageBox4.Visible = true;
            }
        }
        public void UpdateEthernetStatusDisplay(bool status)
        {
            if (status == true)
            {
                this.pictureBoxEthernetConnection.Visible = true;
                this.pictureBoxEthernetDisconnection.Visible = false;
            }
            else
            {
                this.pictureBoxEthernetConnection.Visible = false;
                this.pictureBoxEthernetDisconnection.Visible = true;
            }
        }

        private void PasswordExpirationCheck(UserItem user)
        {
            int expiryDay = 0;

            // 만료일 -10 일때 메시지 띄우기
            expiryDay = user.GetPasswordExpiryDday();
            if (expiryDay >= -10)
            {
                //Console.WriteLine("password : " + expiryDay.ToString());
                DialogFormYesNo myDlg = new DialogFormYesNo(this.ParentForm.SystemConfig.Language, 2, expiryDay.ToString());
                if (myDlg.ShowDialog() == DialogResult.Yes)
                {
                    // 비밀 번호 변경 띄우기
                    DialogFormLogOn logOn = new DialogFormLogOn(this.ParentForm, true, true);
                    if (logOn.ShowDialog() == DialogResult.OK)
                    {

                    }
                }
            }
        }
        private void DirectLogin(string id, string pass)
        {
            UserManager.UserMgr_user_info_t userInfo = new UserManager.UserMgr_user_info_t();

            UserManager.UserManager_UserLoginDirect(id, pass, ref userInfo);
            //Console.WriteLine(string.Format("status : {0}", userInfo.status));
            //Console.WriteLine("ID : " + id);
            //Console.WriteLine("pass : " + pass);

            if (userInfo.status == 0)
            {
                #region 로그인 성공
                if (userInfo.active_level == 1)
                    this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level1;
                else if (userInfo.active_level == 2)
                    this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level2;
                else if (userInfo.active_level == 3)
                    this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level3;
                else if (userInfo.active_level == 9)
                    this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Admin;
                else if (userInfo.active_level == 10)
                    this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Developer;

                this.ParentForm.SystemConfig.CurrentUser.ID = userInfo.user_id;
                this.ParentForm.SystemConfig.CurrentUser.Password = userInfo.user_pw;

                this.ParentForm.SystemConfig.CurrentUser.ExpireId = userInfo.id_expire_period;
                this.ParentForm.SystemConfig.CurrentUser.ExpirePassword = userInfo.password_expire_period;

                //Console.WriteLine(userInfo.password_register_date.GetDateTime());
                //Console.WriteLine(userInfo.id_login_date.GetDateTime());
                //Console.WriteLine(userInfo.id_expire_date.GetDateTime());
                //Console.WriteLine(userInfo.password_expire_date.GetDateTime());

                DateTime time = DateTime.ParseExact(userInfo.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null);
                this.ParentForm.SystemConfig.CurrentUser.DatePasswordRegister = time;
                time = DateTime.ParseExact(userInfo.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null);
                this.ParentForm.SystemConfig.CurrentUser.DateIdLogin = time;
                time = DateTime.ParseExact(userInfo.id_expire_date.GetDateTime(), "yyyyMMddHHmmss", null);
                this.ParentForm.SystemConfig.CurrentUser.DateIdExpire = time;
                time = DateTime.ParseExact(userInfo.password_expire_date.GetDateTime(), "yyyyMMddHHmmss", null);
                this.ParentForm.SystemConfig.CurrentUser.DatePasswordExpire = time;

                this.ParentForm.SystemConfig.CurrentUser.IsLockAccount = userInfo.id_flock_status == 0 ? false : true;
                this.ParentForm.SystemConfig.CurrentUser.IsLockPassword = userInfo.password_flock_status == 0 ? false : true;

                this.ParentForm.SystemConfig.CurrentUser.IsAdmin = userInfo.fadmin == 0 ? false : true;

                this.ParentForm.SystemConfig.CurrentUser.ActiveLevel = userInfo.active_level;
                this.ParentForm.SystemConfig.CurrentUser.IsFirstPassword = userInfo.fFirstPW;
                #endregion

                this.UI_Invoke(delegate
                {
                    this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
                });
            }
        }

        private void Login()
        {
            DialogResult result;

            DialogFormLogOn logOn = new DialogFormLogOn(this.ParentForm, false, false);
            result = logOn.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Level1 ||
                    this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Level2 ||
                    this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Level3)
                {
                    // 비밀번호 만료일 10일 미만 체크 후 비밀번호 변경
                    this.PasswordExpirationCheck(this.ParentForm.SystemConfig.CurrentUser);
                }

                this.buttonUser.ButtonDown();
                this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
            }
            else if (result == DialogResult.Abort)
            {
                // 비밀 번호 변경 띄우기
                DialogFormLogOn logOn1 = new DialogFormLogOn(this.ParentForm, false, true);
                if (logOn1.ShowDialog() == DialogResult.OK)
                {
                    this.buttonUser.ButtonDown();
                    this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
                }
                else
                    this.buttonUser.ButtonUp();
            }
            else
            {
                this.buttonUser.ButtonUp();
            }
        }
        public void Logout()
        {
            this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.LogOut;
            this.buttonUser.ButtonUp();
            this.DisplayRefresh();
            this.ChangeID = "";

            // Part 11
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.Logout, "");
        }
        public void Part11AutomaticLogoutReset()
        {
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                UserManager.UserManager_AutoLogoutTimeoutReset();
        }

        public void CallBackUserListLoginTimeoutDataEvent(UserManager.UserMgr_login_timeout_t user)
        {
            string code = "", message1 = "", message2 = "";
            int warningTime = 0;

            if (user.remainder_time != 0)
            {
                switch (this.ParentForm.SystemConfig.Language)
                {
                    case DataStore.E_LanguageID.Korean:
                        code = "로그인";
                        message1 = "잠시 후에 로그아웃 됩니다";
                        message2 = "";
                        break;
                    case DataStore.E_LanguageID.English:
                        code = "Login";
                        message1 = "You will be logged out after a while";
                        message2 = "";
                        break;
                    case DataStore.E_LanguageID.Chinese:
                        code = "Login";
                        message1 = "You will be logged out after a while";
                        message2 = "";
                        break;
                    case DataStore.E_LanguageID.Czech:
                        code = "Login";
                        message1 = "You will be logged out after a while";
                        message2 = "";
                        break;
                    case DataStore.E_LanguageID.German:
                        code = "Login";
                        message1 = "You will be logged out after a while";
                        message2 = "";
                        break;
                    default:
                        break;
                }

                warningTime = this.ParentForm.FlagAutomaticLogoutWarningTime - 2;

                this.UI_Invoke(delegate
                {
                    DialogFormMessage msg = new DialogFormMessage(DataStore.MessageBoxIcon.Asterisk, code, message1, message2, warningTime, this.ParentForm.SystemConfig.Language);
                    msg.ShowDialog();
                });
            }
            else
            {
                switch (this.ParentForm.SystemConfig.Language)
                {
                    case DataStore.E_LanguageID.Korean:
                        code = "Login";
                        message1 = "자동 로그아웃 되었습니다";
                        message2 = "";
                        break;
                    case DataStore.E_LanguageID.English:
                        code = "Login";
                        message1 = "automatically logged out";
                        message2 = "";
                        break;
                    case DataStore.E_LanguageID.Chinese:
                        code = "Login";
                        message1 = "automatically logged out";
                        message2 = "";
                        break;
                    case DataStore.E_LanguageID.Czech:
                        code = "Login";
                        message1 = "automatically logged out";
                        message2 = "";
                        break;
                    case DataStore.E_LanguageID.German:
                        code = "Login";
                        message1 = "automatically logged out";
                        message2 = "";
                        break;
                    default:
                        break;
                }

                // User Logout
                UserManager.UserManager_UserLogout();

                this.UI_Invoke(delegate
                {
                    this.Logout();
                });

                this.UI_Invoke(delegate
                {
                    DialogFormMessage msg = new DialogFormMessage(DataStore.MessageBoxIcon.Asterisk, code, message1, message2, 0, this.ParentForm.SystemConfig.Language);
                    msg.ShowDialog();
                });
            }
        }
        public void UpdateDisplayTime()
        {
            this.labelTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        }
        public void SetTotalCount()
        {
            int toTalAll = 0, toTalPass = 0, toTalNG = 0;

            for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
            {
                toTalAll += this.ParentForm.CollectionWeightData[i].TotalCount;
                toTalPass += this.ParentForm.CollectionWeightData[i].PassCount;
                toTalNG += this.ParentForm.CollectionWeightData[i].TotalNGCount;
            }

            // Total All Count
            // Total Pass Count
            if (this.labelTitleTotalCount.Text == "Pass" || this.labelTitleTotalCount.Text == "通过" || this.labelTitleTotalCount.Text == "Váha"
                || this.labelTitleTotalCount.Text == "Bestehen" || this.labelTitleTotalCount.Text == "合格")
            {
                //if (this.labelTotalCount.Text != toTalPass.ToString())
                //    this.labelTotalCount.Text = toTalPass.ToString();
                this.labelTotalCount.BeginInvoke(new Action(() =>
                    {
                        this.labelTotalCount.Text = toTalPass.ToString();
                    }));
            }
            else
            {
                //if (this.labelTotalCount.Text != toTalAll.ToString())
                //    this.labelTotalCount.Text = toTalAll.ToString();
                this.labelTotalCount.BeginInvoke(new Action(() =>
                {
                    this.labelTotalCount.Text = toTalAll.ToString();
                }));
            }

            // Total NG Count
            //if (this.labelNGCount.Text != toTalNG.ToString())
            //    this.labelNGCount.Text = toTalNG.ToString();
            this.labelNGCount.BeginInvoke(new Action(() =>
            {
                this.labelNGCount.Text = toTalNG.ToString();
            }));
        }
        public void ProductChange(int productNumber)
        {
            this.buttonProductNo.Text = "**";

            if (this.ParentForm.SystemConfig.MotorSelect == 1)
            {
                this.buttonProductNo.Enabled = false;
                this.buttonMenu.Enabled = false;
                this.buttonUnder.Enabled = false;
                this.buttonPass.Enabled = false;
                this.buttonOver.Enabled = false;
                this.buttonTare.Enabled = false;

                // SubMenu
                this.buttonSubMenu.Enabled = false;
                this.panelSubMenu1.Visible = false;
                this.panelSubMenu2.Visible = false;
                this.panelSubMenu3.Visible = false;
                this.SubmenuIndex = 0;
            }

            this.ParentForm.ProductChange(productNumber);
        }
        public void Clear()
        {
            this.ParentForm.TransferData(CommunicationCommand.Clear, CommunicationID.SubBoardAll);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplay2 != null)
                        this.MainDisplay2.Clear();
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.Clear();
                    break;
                case 3:
                    if (this.MainDisplay3 != null)
                        this.MainDisplay3.Clear();
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.Clear();
                    break;
                case 4:
                    if (this.MainDisplay4 != null)
                        this.MainDisplay4.Clear();
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.Clear();
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.Clear();
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.Clear();
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.Clear();
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.Clear();
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.Clear();
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.Clear();
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.Clear();
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.Clear();
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.Clear();
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.Clear();
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.Clear();
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.Clear();
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.Clear();
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.Clear();
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.Clear();
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.Clear();
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.Clear();
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.Clear();
                    break;
                case 15:
                    if (this.MainDisplayEachBarGraph15 != null)
                        this.MainDisplayEachBarGraph15.Clear();
                    if (this.MainDisplayDotGraph15 != null)
                        this.MainDisplayDotGraph15.Clear();
                    if (this.MainDisplayTable15 != null)
                        this.MainDisplayTable15.Clear();
                    break;
                case 16:
                    if (this.MainDisplayEachBarGraph16 != null)
                        this.MainDisplayEachBarGraph16.Clear();
                    if (this.MainDisplayDotGraph16 != null)
                        this.MainDisplayDotGraph16.Clear();
                    if (this.MainDisplayTable16 != null)
                        this.MainDisplayTable16.Clear();
                    break;
                default:
                    break;
            }
        }
        public void UpdateUnderRangeChange(string weight)
        {
            string value = "";

            this.buttonUnder.Text = weight;
            this.labelUnderRange.Text = weight;
            this.ParentForm.CurrentProductItem.UnderRange = weight.Replace(".", "");
            this.ParentForm.SaveProductFile(this.ParentForm.CurrentProductItem, this.ParentForm.SystemConfig.ProductNumber - 1);

            value = Helper.StringZeroFillDigits7(this.ParentForm.CurrentProductItem.UnderRange);
            this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2002_UnderRange, value);

            this.RescaleControl();
        }
        public void UpdateUnderRangeLimitCheck(bool isModbus)
        {
            int underRangeLimit = 0, underRange = 0;
            string before = "", after = "", number = "";

            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            underRangeLimit = int.Parse(this.ParentForm.CurrentProductItem.UnderRangeLimit);
            underRange = int.Parse(this.ParentForm.CurrentProductItem.UnderRange);

            if (underRange < underRangeLimit)
            {
                before = this.labelUnderRangeLimit.Text;

                this.ParentForm.CurrentProductItem.UnderRangeLimit = "0";
                this.labelUnderRangeLimit.Text = Helper.StringToDecimalPlaces(this.ParentForm.CurrentProductItem.UnderRangeLimit, this.ParentForm.SystemConfig.DecimalPlaces);
                this.ParentForm.SaveProductFile(this.ParentForm.CurrentProductItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                after = this.labelUnderRangeLimit.Text;

                // Part 11
                if (this.ParentForm.SystemConfig.IsPart11 == true)
                {
                    if (isModbus == false)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightUnderRangeLimit, number, before, after);
                    else
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.MB_WeightUnderRangeLimit, number, before, after);
                }

                // 중량 Limit 설정 확인하세요!
                // Low Limit Range
                DialogFormMessage myMsg = new DialogFormMessage(11, this.ParentForm.SystemConfig.Language);
                myMsg.ShowDialog();
            }
        }
        public void UpdatePassRangeChange(string weight)
        {
            string value = "";

            this.buttonPass.Text = weight;
            this.labelPassRange.Text = weight;
            this.ParentForm.CurrentProductItem.PassRange = weight.Replace(".", "");
            this.ParentForm.SaveProductFile(this.ParentForm.CurrentProductItem, this.ParentForm.SystemConfig.ProductNumber - 1);

            value = Helper.StringZeroFillDigits7(this.ParentForm.CurrentProductItem.PassRange);
            this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2003_PassRange, value);

            this.RescaleControl();
        }
        public void UpdateOverRangeChange(string weight)
        {
            string value = "";

            this.buttonOver.Text = weight;
            this.labelOverRange.Text = weight;
            this.ParentForm.CurrentProductItem.OverRange = weight.Replace(".", "");
            this.ParentForm.SaveProductFile(this.ParentForm.CurrentProductItem, this.ParentForm.SystemConfig.ProductNumber - 1);

            value = Helper.StringZeroFillDigits7(this.ParentForm.CurrentProductItem.OverRange);
            this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2004_OverRange, value);

            this.RescaleControl();
        }
        public void UpdateOverRangeLimitCheck(bool isModbus)
        {
            int overRangeLimit = 0, overRange = 0;
            string before = "", after = "", number = "";

            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            overRangeLimit = int.Parse(this.ParentForm.CurrentProductItem.OverRangeLimit);
            overRange = int.Parse(this.ParentForm.CurrentProductItem.OverRange);

            if (overRange > overRangeLimit)
            {
                before = this.labelOverRangeLimit.Text;

                this.ParentForm.CurrentProductItem.OverRangeLimit = "99999";
                this.labelOverRangeLimit.Text = Helper.StringToDecimalPlaces(this.ParentForm.CurrentProductItem.OverRangeLimit, this.ParentForm.SystemConfig.DecimalPlaces);
                this.ParentForm.SaveProductFile(this.ParentForm.CurrentProductItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                after = this.labelOverRangeLimit.Text;

                // Part 11
                if (this.ParentForm.SystemConfig.IsPart11 == true)
                {
                    if (isModbus == false)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightOverRangeLimit, number, before, after);
                    else
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.MB_WeightOverRangeLimit, number, before, after);
                }

                // 중량 Limit 설정 확인하세요!
                // Low Limit Range
                DialogFormMessage myMsg = new DialogFormMessage(11, this.ParentForm.SystemConfig.Language);
                myMsg.ShowDialog();
            }
        }
        public void UpdateTareRnageChange(string weight)
        {
            string value = "";

            this.buttonTare.Text = weight;
            this.ParentForm.CurrentProductItem.TareRange = weight.Replace(".", "");
            this.ParentForm.SaveProductFile(this.ParentForm.CurrentProductItem, this.ParentForm.SystemConfig.ProductNumber - 1);

            value = Helper.StringZeroFillDigits7(this.ParentForm.CurrentProductItem.TareRange);
            this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2005_TareRange, value);
        }
        public void TimerServer(bool value)
        {
            if (value == false)
            {
                if (this.timerServer.Enabled == true)
                    this.timerServer.Enabled = false;
            }
            else
            {
                if (this.timerServer.Enabled == false)
                    this.timerServer.Enabled = true;
            }
        }

        public void DisplayRefresh()
        {
            this.ParentForm.TransferData(CommunicationCommand.ModeNormal, CommunicationID.MainBoard);
            this.ParentForm.SystemConfig.CurrentForm = DataStore.FormStore.FormMainDisplay;

            this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;
            this.UpdateDisplay(this.MainDisplay);
            this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
          
            if (this.ParentForm.EquipmentStatus == DataStore.EquipmentStatus.Stop)
                this.ProductChange(this.ParentForm.SystemConfig.ProductNumber);

            this.pictureBoxUSBBackOn.Visible = this.ParentForm.SystemConfig.IsDataBackup;
            this.pictureBoxBypass.Visible = this.ParentForm.SystemConfig.IsBypassMode;
            
            if (this.ParentForm.SystemConfig.Serial3Mode != 0)
                this.pictureBoxCH3.Visible = true;
            else
                this.pictureBoxCH3.Visible = false;

            if (this.ParentForm.SystemConfig.IsBypassDirectionPass == true)
                this.buttonBypassDirection.ButtonUp();
            else
                this.buttonBypassDirection.ButtonDown();

            if (this.ParentForm.SystemConfig.IsBypassOnce == true)
            {
                this.buttonBypassOnce.ButtonUp();
                this.buttonBypassRun.Mode = SmartButton.BUTTONMODE.NORMAL;
            }
            else
            {
                this.buttonBypassOnce.ButtonDown();
                this.buttonBypassRun.Mode = SmartButton.BUTTONMODE.PUSH;
            }

            // SubMenu
            this.panelSubMenu1.Visible = false;
            this.panelSubMenu2.Visible = false;
            this.panelSubMenu3.Visible = false;
            this.SubmenuIndex = 0;

            // CUT 
            if (this.ParentForm.SystemConfig.IsCutView == true)
            {
                this.labelCutSignalInterval.Visible = true;
                this.buttonCut.Visible = true;
            }
            else
            {
                this.labelCutSignalInterval.Visible = false;
                this.buttonCut.Visible = false;
            }

            // Alarm Message4 - Servo Origin
            if (this.ParentForm.IsServoOrigin == false)
                this.panelAlarmMessageBox4.Visible = false;

            // Ethernet Icon
            this.pictureBoxEthernetConnection.Visible = this.ParentForm.SystemConfig.IsEthernetEnable;
            this.pictureBoxEthernetDisconnection.Visible = this.ParentForm.SystemConfig.IsEthernetEnable;
            // Ethernet 
            if (this.ParentForm.SystemConfig.IsEthernetEnable == true)
            {
                if (this.ParentForm.SystemConfig.EthernetOperationMode == 2)
                    this.ParentForm.EthernetClientDisconnect();
                else
                {
                    if (this.ParentForm.smartTCPMultiServer.IsStart == false)
                        this.ParentForm.smartTCPMultiServer.Start();
                }
            }
            else
            {
                if (this.ParentForm.SystemConfig.EthernetOperationMode == 2)
                    this.ParentForm.EthernetClientDisconnect();
                else
                {
                    if (this.ParentForm.smartTCPMultiServer.IsStart == true)
                        this.ParentForm.smartTCPMultiServer.Stop();
                }
            }

            // Bypass Display
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplay2 != null)
                        this.MainDisplay2.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    break;
                case 3:
                    if (this.MainDisplay3 != null)
                        this.MainDisplay3.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    break;
                case 4:
                    if (this.MainDisplay4 != null)
                        this.MainDisplay4.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    break;
                case 16:
                    if (this.MainDisplayEachBarGraph16 != null)
                        this.MainDisplayEachBarGraph16.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayDotGraph16 != null)
                        this.MainDisplayDotGraph16.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayTable16 != null)
                        this.MainDisplayTable16.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    //if (this.MainDisplayTable16_1 != null)
                    //    this.MainDisplayTable16_1.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    break;
                default:
                    break;
            }
        }
        #endregion

        #region Event Handler
        private void pictureBoxStart_Click(object sender, EventArgs e)
        {
            this.ParentForm.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
        }
        private void pictureBoxStop_Click(object sender, EventArgs e)
        {
            this.ParentForm.TransferData(CommunicationCommand.Start, CommunicationID.MainBoard);
        }
        private void pictureBoxAlarm_Click(object sender, EventArgs e)
        {
            if (this.MainDisplayAlarmList.Visible == true)
                this.MainDisplayAlarmList.Visible = false;
            else
            {
                this.MainDisplayAlarmList.BringToFront();
                this.MainDisplayAlarmList.Visible = true;
            }
        }

        private void buttonProductNo_Click(object sender, EventArgs e)
        {
            string before = "", after = "";

            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            before = this.buttonProductNo.Text;

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonProductNo.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    after = myKeyPad.StringValue;

                    // Part 11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.ProductNumber, "", before, after);
                }
            }
        }
        private void buttonUnder_Click(object sender, EventArgs e)
        {
            string before = "", after = "", number = "";

            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            before = this.buttonUnder.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonUnder.Text, 5, this.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.SystemConfig.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.doubleValue > Helper.StringToWeight(this.ParentForm.CurrentProductItem.PassRange, this.ParentForm.SystemConfig.DecimalPlaces))
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    after = myKeyPad.StringValue;

                    this.UpdateUnderRangeChange(myKeyPad.StringValue);
                    this.UpdateUnderRangeLimitCheck(false);

                    // Part 11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightUnderRange, number, before, after);
                }
            }
        }
        private void buttonPass_Click(object sender, EventArgs e)
        {
            string value = "", before = "", after = "", number = "";

            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            before = this.buttonPass.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonPass.Text, 5, this.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.SystemConfig.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if ((myKeyPad.doubleValue > Helper.StringToWeight(this.ParentForm.CurrentProductItem.OverRange, this.ParentForm.SystemConfig.DecimalPlaces))
                    || (myKeyPad.doubleValue < Helper.StringToWeight(this.ParentForm.CurrentProductItem.UnderRange, this.ParentForm.SystemConfig.DecimalPlaces)))
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    after = myKeyPad.StringValue;

                    this.UpdatePassRangeChange(myKeyPad.StringValue);

                    // Part 11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightPassRange, number, before, after);
                }
            }
        }
        private void buttonOver_Click(object sender, EventArgs e)
        {
            string before = "", after = "", number = "";

            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            before = this.buttonOver.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonOver.Text, 5, this.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.SystemConfig.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.doubleValue < Helper.StringToWeight(this.ParentForm.CurrentProductItem.PassRange, this.ParentForm.SystemConfig.DecimalPlaces))
                {
                    this.ParentForm.Refresh();
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    after = myKeyPad.StringValue;

                    this.UpdateOverRangeChange(myKeyPad.StringValue);
                    this.UpdateOverRangeLimitCheck(false);

                    // Part 11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightOverRange, number, before, after);
                }
            }
        }
        private void buttonTare_Click(object sender, EventArgs e)
        {
            string value = "", before = "", after = "", number = "";

            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            before = this.buttonTare.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonTare.Text, 5, this.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.SystemConfig.Language);

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

                    this.UpdateTareRnageChange(myKeyPad.StringValue);

                    // Part 11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightTareRange, number, before, after);
                }
            }
        }
        private void buttonClear_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            DialogFormYesNo myDlg = new DialogFormYesNo(this.ParentForm.SystemConfig.Language, 8);
            if (myDlg.ShowDialog() == DialogResult.Yes)
            {
                this.Clear();

                // Part 11
                if (this.ParentForm.SystemConfig.IsPart11 == true)
                    this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.Clear, "");
            }
        }
        private void buttonMenu_Click(object sender, EventArgs e)
        {
            if (this.ParentForm.EquipmentStatus == DataStore.EquipmentStatus.Stop)
            {
                // Automatic Logout Pause
                if (this.ParentForm.SystemConfig.IsPart11 == true)
                    UserManager.UserManager_AutoLogoutTimeoutPause();

                this.ParentForm.ChildFormMenu.DisplayRefresh();
                ((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMenu);
            }
            else
            {
                // Automatic Logout Reset
                if (this.ParentForm.SystemConfig.IsPart11 == true)
                    this.Part11AutomaticLogoutReset();

                if (this.ParentForm.SystemConfig.IsLogin == true && this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer)
                {
                    this.groupBoxJudgmentSetting.Visible = true;
                    this.labelFilter.Visible = true;
                    this.labelJudgmentDelayTime.Visible = true;
                    this.labelJudgmentCount.Visible = true;
                    this.labelStaticFilter.Visible = true;
                    this.labelStaticJudgmentDelayTime.Visible = true;
                    this.labelStaticJudgmentCount.Visible = true;
                }
                else
                {
                    this.groupBoxJudgmentSetting.Visible = false;
                    this.labelFilter.Visible = false;
                    this.labelJudgmentDelayTime.Visible = false;
                    this.labelJudgmentCount.Visible = false;
                    this.labelStaticFilter.Visible = false;
                    this.labelStaticJudgmentDelayTime.Visible = false;
                    this.labelStaticJudgmentCount.Visible = false;
                }

                switch (this.ParentForm.SystemConfig.CurrentUser.Group)
                {
                    case DataStore.UserGroup.None:
                        break;
                    case DataStore.UserGroup.Level1:
                        if (this.ParentForm.CurrentUserGroup.Level1.IsMenuSystem == true)
                        {
                            this.panelSetting.BringToFront();
                            this.panelSetting.Visible = true;
                        }
                        break;
                    case DataStore.UserGroup.Level2:
                        if (this.ParentForm.CurrentUserGroup.Level2.IsMenuSystem == true)
                        {
                            this.panelSetting.BringToFront();
                            this.panelSetting.Visible = true;
                        }
                        break;
                    case DataStore.UserGroup.Level3:
                        if (this.ParentForm.CurrentUserGroup.Level3.IsMenuSystem == true)
                        {
                            this.panelSetting.BringToFront();
                            this.panelSetting.Visible = true;
                        }
                        break;
                    case DataStore.UserGroup.Admin:
                    case DataStore.UserGroup.Developer:
                    case DataStore.UserGroup.NotLogin:
                    case DataStore.UserGroup.LogOut:
                        this.panelSetting.BringToFront();
                        this.panelSetting.Visible = true;
                        break;
                    default:
                        break;
                }
            }
        }
        private void buttonDisplay_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            SmartButton button = sender as SmartButton;

            if (button == null)
                return;

            if (button == this.buttonBarGraphForm)
                this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;
            else if (button == this.buttonDotGraphForm)
                this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayDotGraph;
            else if (button == this.buttonTableForm)
                this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayTable;
            else
                this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

            this.UpdateDisplay(this.MainDisplay);
        }
        private void buttonScaleZero_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            this.ParentForm.TransferData(CommunicationCommand.Zero, CommunicationID.SubBoardAll);

            // Part 11
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.Zero, "");
        }
        private void buttonClose_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            this.panelSetting.Visible = false;
        }
        private void buttonAlarm2OK_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            this.ParentForm.CurrentAlarmList.IsBuzzerStatus = false;
            this.ParentForm.TransferData(CommunicationCommand.BuzzerOff, CommunicationID.MainBoard);
            this.panelAlarmMessageBox2.Visible = false;
        }
        private void buttonAlarm3Ok_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            this.ParentForm.CurrentAlarmList.IsBuzzerStatus = false;
            this.ParentForm.TransferData(CommunicationCommand.BuzzerOff, CommunicationID.MainBoard);
            this.panelAlarmMessageBox3.Visible = false;
        }
        private void buttonAlarm4Ok_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            this.panelAlarmMessageBox4.Visible = false;
        }
        private void buttonAllNG_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            this.ParentForm.TransferData(CommunicationCommand.NgSignal, CommunicationID.SubBoardAll);
        }
        private void buttonAllPass_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            this.ParentForm.TransferData(CommunicationCommand.PassSignal, CommunicationID.SubBoardAll);
        }
        private void buttonUser_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.LogOut)
            {
                this.Login();
            }
            else
            {
                DialogFormYesNo msg = new DialogFormYesNo(this.ParentForm.SystemConfig.Language, 12);
                if (msg.ShowDialog() == DialogResult.Yes)
                {
                    this.Logout();
                }
            }
        }
        private void buttonBypassDirection_Click(object sender, EventArgs e)
        {
            string before = "", after = "";

            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            if (this.buttonBypassDirection.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                this.ParentForm.SystemConfig.IsBypassDirectionPass = false;
                before = "PASS";
                after = "NG";
            }
            else
            {
                this.ParentForm.SystemConfig.IsBypassDirectionPass = true;
                before = "NG";
                after = "PASS";
            }

            // Part 11
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Direction, "", before, after);
        }
        private void buttonBypassOnce_Click(object sender, EventArgs e)
        {
            string before = "", after = "";

            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();


            if (this.buttonBypassOnce.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                this.ParentForm.SystemConfig.IsBypassOnce = false;
                this.buttonBypassRun.Mode = SmartButton.BUTTONMODE.PUSH;

                before = "Once";
                after = "Cotinue";
            }
            else
            {
                this.ParentForm.SystemConfig.IsBypassOnce = true;
                this.buttonBypassRun.Mode = SmartButton.BUTTONMODE.NORMAL;

                before = "Cotinue";
                after = "Once";
            }

            // Part 11
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Mode, "", before, after);
        }
        private void buttonBypassRun_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            if (this.ParentForm.SystemConfig.IsBypassOnce == true)
            {
                if (this.ParentForm.SystemConfig.IsBypassDirectionPass == true)
                {
                    this.ParentForm.TransferData(CommunicationCommand.BypassOnce, CommunicationID.MainBoard);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.BP_PassOnce, "");
                }
                else
                {
                    this.ParentForm.TransferData(CommunicationCommand.ByNGOnce, CommunicationID.MainBoard);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.BP_NgOnce, "");
                }
            }
            else
            {
                if (this.buttonBypassRun.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    this.buttonBypassDirection.Enabled = false;
                    this.buttonBypassOnce.Enabled = false;

                    if (this.ParentForm.SystemConfig.IsBypassDirectionPass == true)
                    {
                        this.ParentForm.TransferData(CommunicationCommand.BypassON, CommunicationID.MainBoard);

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.BP_PassON, "");
                    }
                    else
                    {
                        this.ParentForm.TransferData(CommunicationCommand.ByNGON, CommunicationID.MainBoard);

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.BP_NgON, "");
                    }
                }
                else
                {
                    this.buttonBypassDirection.Enabled = true;
                    this.buttonBypassOnce.Enabled = true;

                    if (this.ParentForm.SystemConfig.IsBypassDirectionPass == true)
                    {
                        this.ParentForm.TransferData(CommunicationCommand.BypassOFF, CommunicationID.MainBoard);

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.BP_PassOFF, "");
                    }
                    else
                    {
                        this.ParentForm.TransferData(CommunicationCommand.ByNGOFF, CommunicationID.MainBoard);

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.BP_NgOFF, "");
                    }
                }
            }
        }
        private void buttonSubMenu_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            if (this.SubmenuIndex == 0)
            {
                this.panelSubMenu1.BringToFront();
                this.panelSubMenu1.Visible = true;

                this.panelSubMenu2.Visible = false;
                this.panelSubMenu3.Visible = false;

                this.SubmenuIndex = 1;
            }
            else if (this.SubmenuIndex == 1)
            {
                this.panelSubMenu2.BringToFront();
                this.panelSubMenu2.Visible = true;

                this.panelSubMenu1.Visible = false;
                this.panelSubMenu3.Visible = false;

                this.SubmenuIndex = 2;
            }
            else if (this.SubmenuIndex == 2)
            {
                if (this.ParentForm.SystemConfig.Sorter4Location == 1)
                {
                    this.panelSubMenu3.BringToFront();
                    this.panelSubMenu3.Visible = true;

                    this.panelSubMenu1.Visible = false;
                    this.panelSubMenu2.Visible = false;

                    this.SubmenuIndex = 3;
                }
                else
                {
                    this.panelSubMenu1.Visible = false;
                    this.panelSubMenu2.Visible = false;
                    this.panelSubMenu3.Visible = false;

                    this.SubmenuIndex = 0;
                }
            }
            else
            {
                this.panelSubMenu1.Visible = false;
                this.panelSubMenu2.Visible = false;
                this.panelSubMenu3.Visible = false;

                this.SubmenuIndex = 0;
            }
        }
        private void buttonCutSignal_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            this.ParentForm.TransferData(CommunicationCommand.CutInpupt, CommunicationID.MainBoard);

            // Part11
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.MainCut, "");
        }
        private void buttonHidden_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            if (this.ParentForm.SystemConfig.IsLogin == false && this.ParentForm.IsDeveloperMode == false)
            {
                this.ParentForm.CurrentUserPasswordType.SetDefinedPassword(OptionPassword.Default);
                DialogFormPasswordKeyPad pass = new DialogFormPasswordKeyPad(this.ParentForm.SystemConfig.Language, this.ParentForm.CurrentUserPasswordType, 8);

                if (pass.ShowDialog() == DialogResult.OK)
                {
                    this.groupBoxJudgmentSetting.Visible = true;
                    this.labelFilter.Visible = true;
                    this.labelJudgmentDelayTime.Visible = true;
                    this.labelJudgmentCount.Visible = true;
                    this.labelStaticFilter.Visible = true;
                    this.labelStaticJudgmentDelayTime.Visible = true;
                    this.labelStaticJudgmentCount.Visible = true;
                }
            }
            else
                this.groupBoxJudgmentSetting.Visible = true;
        }

        private void labelSorter1DelayTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelSorter1DelayTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter1DelayTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelSorter1DelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5102_Sorter1DelayTime, value);

                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Sorter1DelayTime, number, before, after);
                }
            }
        }
        private void labelSorter1RunTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelSorter1RunTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter1RunTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelSorter1RunTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5103_Sorter1RunTime, value);

                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Sorter1RunTime, number, before, after);
                }
            }
        }
        private void labelSorter2DelayTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelSorter2DelayTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter2DelayTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelSorter2DelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5105_Sorter2DelayTime, value);

                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Sorter2DelayTime, number, before, after);
                }
            }
        }
        private void labelSorter2RunTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelSorter2RunTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter2RunTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelSorter2RunTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5106_Sorter2RunTime, value);

                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Sorter2RunTime, number, before, after);
                }
            }
        }
        private void labelSorter3DelayTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelSorter3DelayTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter3DelayTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelSorter3DelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5108_Sorter3DelayTime, value);

                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Sorter3DelayTime, number, before, after);
                }
            }
        }
        private void labelSorter3RunTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelSorter3RunTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter3RunTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelSorter3RunTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5109_Sorter3RunTime, value);

                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Sorter3RunTime, number, before, after);
                }
            }
        }
        private void labelSorter4DelayTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelSorter4DelayTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter4DelayTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelSorter4DelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5111_Sorter4DelayTime, value);

                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Sorter4DelayTime, number, before, after);
                }
            }
        }
        private void labelSorter4RunTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelSorter4RunTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorter4RunTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelSorter4RunTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5112_Sorter4RunTime, value);

                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Sorter4RunTime, number, before, after);
                }
            }
        }
        private void labelTotalCount_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            switch (this.ParentForm.SystemConfig.Language)
            {
                case DataStore.E_LanguageID.Korean:
                case DataStore.E_LanguageID.English:
                    if (this.labelTitleTotalCount.Text != "Total")
                        this.labelTitleTotalCount.Text = "Total";
                    else
                        this.labelTitleTotalCount.Text = "Pass";
                    break;
                case DataStore.E_LanguageID.Chinese:
                    if (this.labelTitleTotalCount.Text != "计数")
                        this.labelTitleTotalCount.Text = "计数";
                    else
                        this.labelTitleTotalCount.Text = "通过";
                    break;
                case DataStore.E_LanguageID.Czech:
                    if (this.labelTitleTotalCount.Text != "Celkem")
                        this.labelTitleTotalCount.Text = "Celkem";
                    else
                        this.labelTitleTotalCount.Text = "Váha";
                    break;
                case DataStore.E_LanguageID.German:
                    if (this.labelTitleTotalCount.Text != "Insgesamt")
                        this.labelTitleTotalCount.Text = "Insgesamt";
                    else
                        this.labelTitleTotalCount.Text = "Bestehen";
                    break;
                case DataStore.E_LanguageID.Japanese:
                if (this.labelTitleTotalCount.Text != "総カウント")
                    this.labelTitleTotalCount.Text = "総カウント";
                else
                    this.labelTitleTotalCount.Text = "合格";
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        private void labelFilter_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelFilter.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelFilter.Text, 2, 0, false, this.ParentForm.SystemConfig.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 16)
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.labelFilter.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentJudgmentSetItem.Filter = myKeyPad.IntValue;
                    after = this.labelFilter.Text;

                    value = Helper.StringZeroFillDigits4(this.labelFilter.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5001_Filter, value);

                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.JudgmentFilter, number, before, after);
                }
            }
        }
        private void labelJudgmentDelayTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelJudgmentDelayTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelJudgmentDelayTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);
            myKeyPad.Location = new Point(300, 90);

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

                    value = Helper.StringZeroFillDigits4(this.labelJudgmentDelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5002_JudgmentDelayTime, value);

                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.JudgmentDelayTime, number, before, after);
                }
            }
        }
        private void labelJudgmentCount_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelJudgmentCount.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelJudgmentCount.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 50)
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.labelJudgmentCount.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentJudgmentSetItem.JudgmentCount = myKeyPad.IntValue;
                    after = this.labelJudgmentCount.Text;

                    value = Helper.StringZeroFillDigits4(this.labelJudgmentCount.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5004_JudgmentCount, value);

                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.JudgmentCount, number, before, after);
                }
            }
        }
        private void labelDischargeStopperRunTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelDischargeStopperRunTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelDischargeStopperRunTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelDischargeStopperRunTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5034_DischargeStopperRunTime, value);

                    this.ParentForm.SaveDynamicCorrectionFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.DischargeStopperRunTime, number, before, after);
                }
            }
        }
        private void labelDischargeStopperDelayTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelDischargeStopperDelayTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelDischargeStopperDelayTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelDischargeStopperDelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5034_DischargeStopperDelayTime, value);

                    this.ParentForm.SaveDynamicCorrectionFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.DischargeStopperDelayTime, number, before, after);
                }
            }
        }
        private void labelEntryGateRunTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelEntryGateRunTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelEntryGateRunTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelEntryGateRunTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5033_EntryGateRunTime, value);
                    this.ParentForm.SaveDynamicCorrectionFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.EntryGateRunTime, number, before, after);
                }
            }
        }
        private void labelEntryGateDelayTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelEntryGateDelayTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelEntryGateDelayTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelEntryGateDelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5032_EntryGateDelayTime, value);

                    this.ParentForm.SaveDynamicCorrectionFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.EntryGateDelayTime, number, before, after);
                }
            }
        }
        private void labelForcedZeroDelayTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelForcedZeroDelayTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelForcedZeroDelayTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelForcedZeroDelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._4501_ForcedZeroDelayTime, value);
                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.ForcedZeroDelayTime, number, before, after);
                }
            }
        }
        private void labelTurnDelayTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelTurnDelayTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelTurnDelayTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelTurnDelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5017_TurnDelayTime, value);
                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.ForcedZeroDelayTime, number, before, after);
                }
            }
        }
        private void labelStopper2DelayTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelStopper2DelayTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelStopper2DelayTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelStopper2DelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5036_Stopper2DelayTime, value);
                    this.ParentForm.SaveDynamicCorrectionFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Stopper2DelayTime, number, before, after);
                }
            }
        }
        private void labelStopper2RunTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelStopper2RunTime.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelStopper2RunTime.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

                    value = Helper.StringZeroFillDigits4(this.labelStopper2RunTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._5037_Stopper2RunTime, value);
                    this.ParentForm.SaveDynamicCorrectionFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Stopper2RunTime, number, before, after);
                }
            }
        }

        private void timerCutSignal_Tick(object sender, EventArgs e)
        {
            this.ParentForm.TransferData(CommunicationCommand.CutInpupt, CommunicationID.MainBoard);
        }
        private void buttonCut_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            if (this.buttonCut.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                this.timerCutSignal.Enabled = true;
            else
                this.timerCutSignal.Enabled = false;
        }
        private void labelCutSignalInterval_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelCutSignalInterval.Text, 4, 0, false, this.ParentForm.SystemConfig.Language);

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

        private void labelSamplingTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string before = "", after = "";

            before = this.labelSamplingTime.Text;

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSamplingTime.Text, 2, 0, false, this.ParentForm.SystemConfig.Language);

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

                    this.ParentForm.timerSampling.Interval = myKeyPad.IntValue * 60000;
                    this.ParentForm.SystemConfig.SamplingTime = myKeyPad.IntValue;
                    this.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.SystemConfig);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.SP_Time, "", before, after);
                }
            }
        }
        private void labelSamplingCount_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string before = "", after = "";

            before = this.labelSamplingCount.Text;

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSamplingCount.Text, 2, 0, false, this.ParentForm.SystemConfig.Language);

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

                    this.ParentForm.SystemConfig.SamplingCount = myKeyPad.IntValue;
                    this.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.SystemConfig);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.SP_Count, "", before, after);
                }
            }
        }
        private void buttonSamplingOnce_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string before = "", after = "";

            if (this.buttonSamplingOnce.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                this.ParentForm.SystemConfig.IsSamplingOnce = false;
                this.buttonSampling.Mode = SmartButton.BUTTONMODE.PUSH;

                before = "Once";
                after = "Cotinue";
            }
            else
            {
                this.ParentForm.SystemConfig.IsSamplingOnce = true;
                this.buttonSampling.Mode = SmartButton.BUTTONMODE.NORMAL;

                before = "Cotinue";
                after = "Once";
            }

            this.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.SystemConfig);

            // Part 11
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.SP_Mode, "", before, after);
        }
        private void buttonSampling_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            if (this.ParentForm.SystemConfig.IsSamplingOnce == true)
            {
                this.ParentForm.TransferData(CommunicationCommand.SamplingSignal, CommunicationID.MainBoard);

                // Part11
                if (this.ParentForm.SystemConfig.IsPart11 == true)
                    this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.SP_Once, "");
            }
            else
            {
                this.ParentForm.SystemConfig.SamplingCurrentCount = 0;

                if (this.buttonSampling.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    this.buttonSamplingOnce.Enabled = false;
                    this.labelSamplingTime.Enabled = false;
                    this.labelSamplingCount.Enabled = false;
                    this.labelSamplingTime.BackColor = Color.Gainsboro;
                    this.labelSamplingCount.BackColor = Color.Gainsboro;
                    this.ParentForm.SystemConfig.IsSamplingRun = true;

                    this.ParentForm.timerSampling.Interval = this.ParentForm.SystemConfig.SamplingTime * 60000;
                    this.ParentForm.timerSampling.Enabled = true;

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.SP_ON, "");
                }
                else
                {
                    this.buttonSamplingOnce.Enabled = true;
                    this.labelSamplingTime.Enabled = true;
                    this.labelSamplingCount.Enabled = true;
                    this.labelSamplingTime.BackColor = Color.White;
                    this.labelSamplingCount.BackColor = Color.White;
                    this.ParentForm.SystemConfig.IsSamplingRun = false;
                    this.ParentForm.timerSampling.Enabled = false;

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.SP_ON, "");
                }
            }
        }
       
        private void buttonLeakSignal_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            if (this.ParentForm.SystemConfig.IsLeakSamplingOnce == true)
            {
                this.ParentForm.TransferData(CommunicationCommand.LeakSamplingSignal, CommunicationID.MainBoard);
                this.smartTimerLeakRunDelay.Start();
                this.buttonLeakSampling.Enabled = false;
            }
            else
            {
                if (this.buttonLeakSampling.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    //this.ParentForm.TransferData(CommunicationCommand.LeakSamplingSignal, CommunicationID.MainBoard);

                    this.buttonLeakSamplingOnce.Enabled = false;
                    this.labelLeakSamplingTime.Enabled = false;
                    this.labelLeakSamplingTime.BackColor = Color.Gainsboro;
                    this.ParentForm.SystemConfig.IsLeakSamplingRun = true;

                    this.ParentForm.timerLeakSampling.Interval = this.ParentForm.SystemConfig.LeakSamplingTime * 60000;
                    this.ParentForm.timerLeakSampling.Enabled = true;
                }
                else
                {
                    this.buttonLeakSamplingOnce.Enabled = true;
                    this.labelLeakSamplingTime.Enabled = true;
                    this.labelLeakSamplingTime.BackColor = Color.White;
                    this.ParentForm.SystemConfig.IsLeakSamplingRun = false;
                    this.ParentForm.timerLeakSampling.Enabled = false;
                }
            }

        }
        private void buttonLeakSamplingOnce_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string before = "", after = "";

            if (this.buttonLeakSamplingOnce.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                this.ParentForm.SystemConfig.IsLeakSamplingOnce = false;
                this.buttonLeakSampling.Mode = SmartButton.BUTTONMODE.PUSH;

                before = "Once";
                after = "Cotinue";
            }
            else
            {
                this.ParentForm.SystemConfig.IsLeakSamplingOnce = true;
                this.buttonLeakSampling.Mode = SmartButton.BUTTONMODE.NORMAL;

                before = "Cotinue";
                after = "Once";
            }

            this.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.SystemConfig);

            // Part 11
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.LK_Mode, "", before, after);
        }
        private void labelLeakSamplingTime_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "";

            before = this.labelLeakSamplingTime.Text;

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLeakSamplingTime.Text, 2, 0, false, this.ParentForm.SystemConfig.Language);

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

                    this.ParentForm.timerLeakSampling.Interval = myKeyPad.IntValue * 60000;
                    this.ParentForm.SystemConfig.LeakSamplingTime = myKeyPad.IntValue;
                    this.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.SystemConfig);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.LK_Time, "", before, after);
                }
            }
        }
        private void smartTimerLeakRunDelay_Tick(object sender, EventArgs e)
        {
            this.smartTimerLeakRunDelay.Stop();
            this.buttonLeakSampling.Enabled = true;
        }

        private void labelOverRangeLimit_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelOverRangeLimit.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelOverRangeLimit.Text, 5, this.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.SystemConfig.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.doubleValue < Helper.StringToWeight(this.ParentForm.CurrentProductItem.OverRange, this.ParentForm.SystemConfig.DecimalPlaces))
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.ParentForm.CurrentProductItem.OverRangeLimit = myKeyPad.StringValue.Replace(".", "");
                    this.labelOverRangeLimit.Text = myKeyPad.StringValue;
                    after = this.labelOverRangeLimit.Text;

                    this.ParentForm.SaveProductFile(this.ParentForm.CurrentProductItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    value = Helper.StringZeroFillDigits7(this.ParentForm.CurrentProductItem.OverRangeLimit);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2202_OverLimitRange, value);

                    // Part 11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightOverRangeLimit, number, before, after);
                }
            }
        }
        private void labelUnderRangeLimit_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "", before = "", after = "", number = "";

            before = this.labelUnderRangeLimit.Text;
            number = this.ParentForm.SystemConfig.ProductNumber.ToString();

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelUnderRangeLimit.Text, 5, this.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.SystemConfig.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.doubleValue > Helper.StringToWeight(this.ParentForm.CurrentProductItem.UnderRange, this.ParentForm.SystemConfig.DecimalPlaces))
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.ParentForm.CurrentProductItem.UnderRangeLimit = myKeyPad.StringValue.Replace(".", "");
                    this.labelUnderRangeLimit.Text = myKeyPad.StringValue;
                    after = this.labelUnderRangeLimit.Text;

                    this.ParentForm.SaveProductFile(this.ParentForm.CurrentProductItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    value = Helper.StringZeroFillDigits7(this.ParentForm.CurrentProductItem.UnderRangeLimit);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2201_UnderLimitRange, value);

                    // Part 11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightUnderRangeLimit, number, before, after);
                }
            }
        }
        private void buttonOnOff_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            string value = "";

            if (this.buttonOnOff.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                value = "0001";
                this.ParentForm.SystemConfig.IsWeightLimitEnable = true;
            }
            else
            {
                value = "0000";
                this.ParentForm.SystemConfig.IsWeightLimitEnable = false;
            }

            this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._1023_WeightLimitEnable, value);
        }

        private void smartTimerDisplayDelay_Tick(object sender, EventArgs e)
        {
            this.smartTimerDisplayDelay.Stop();

            this.buttonBarGraphForm.Enabled = true;
            this.buttonDotGraphForm.Enabled = true;
            this.buttonTableForm.Enabled = true;
        }
        private void timerServer_Tick(object sender, EventArgs e)
        {
            if (this.ParentForm.smartTCPMultiServer.IsStart == true)
            {
                if (this.ParentForm.smartTCPMultiServer.ClientInfoList == null)
                {
                    this.UpdateEthernetStatusDisplay(false);
                }
                else
                {
                    this.UpdateEthernetStatusDisplay(true);
                }
            }
        }
        #endregion
        private void smartButton1_Click(object sender, EventArgs e)
        {
            string data = "";

            if (this.ParentForm.SystemConfig.EthernetMode == 1)
                data = this.ParentForm.Protocol_STD1(this.ParentForm.SystemConfig, this.ParentForm.CollectionWeightData);
            else if (this.ParentForm.SystemConfig.EthernetMode == 2)
                data = this.ParentForm.Protocol_STD2(this.ParentForm.SystemConfig, this.ParentForm.CollectionWeightData, this.ParentForm.CurrentProductItem);
            else if (this.ParentForm.SystemConfig.EthernetMode == 3)
                data = this.ParentForm.Protocol_STD3(this.ParentForm.SystemConfig, this.ParentForm.CollectionWeightData, this.ParentForm.CurrentProductItem);

            switch (this.ParentForm.SystemConfig.EthernetOperationMode)
            {
                case 1:
                    if (this.ParentForm.smartTCPMultiServer.ClientInfoList != null)
                    {
                        foreach (SmartTCPMultiServer.CLIENTSINFOS info in this.ParentForm.smartTCPMultiServer.ClientInfoList)
                        {
                            this.ParentForm.EthernetServerSendMessage(info, data);
                        }
                    }
                    break;
                case 2:
                    //this.ParentForm.EthernetSendMessage(data);
                    this.ParentForm.EthernetWeightData(data);
                    break;
                default:
                    break;
            }
        }
    }
}