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_6CH.Controls;
using INT63DC_6CH.DialogForms;
using INT63DC_6CH.In_UserManager;

namespace INT63DC_6CH.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 ControlMainDisplayFeedback MainDisplayFeedback;
        private ControlMainDisplayEachBarGraph6 MainDisplayEachBarGraph6;
        private ControlMainDisplayEachBarGraph7 MainDisplayEachBarGraph7;
        private ControlMainDisplayEachBarGraph8 MainDisplayEachBarGraph8;
        private ControlMainDisplayEachBarGraph10 MainDisplayEachBarGraph10;
        private ControlMainDisplayEachBarGraph12 MainDisplayEachBarGraph12;
        private ControlMainDisplayDotGraph6 MainDisplayDotGraph6;
        private ControlMainDisplayDotGraph7 MainDisplayDotGraph7;
        private ControlMainDisplayDotGraph8 MainDisplayDotGraph8;
        private ControlMainDisplayDotGraph10 MainDisplayDotGraph10;
        private ControlMainDisplayDotGraph12 MainDisplayDotGraph12;
        private ControlMainDisplayTable6 MainDisplayTable6;
        private ControlMainDisplayTable7 MainDisplayTable7;
        private ControlMainDisplayTable8 MainDisplayTable8;
        private ControlMainDisplayTable10 MainDisplayTable10;
        private ControlMainDisplayTable12 MainDisplayTable12;
        #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.labelTitleScreen.Text = "Screen";
                    this.labelTitleTotalCount.Text = "Total";
                    this.labelTitleNG.Text = "NG";

                    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.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.groupBoxJudgmentSetting.Text = "Judgment settings";
                    this.labelStaticJudgmentDelayTime.Text = "J.Delay";
                    this.labelStaticJudgmentCount.Text = "J.Count";
                    this.labelStaticTurnDelayTime.Text = "Turn Delay";

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

                    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.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainOverDown));
                    this.buttonOver.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainOverUp));
                    this.buttonPass.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainPassDown));
                    this.buttonPass.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainPassUp));
                    this.buttonUnder.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainUnderDown));
                    this.buttonUnder.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainUnderUp));
                    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.groupBoxSorter.Text = "筛选设定";
                    this.labelStaticSorter1DelayTime.Text = "分类机1 延迟时间";
                    this.labelStaticSorter1RunTime.Text = "分类机1 运行时间";
                    this.labelStaticSorter2DelayTime.Text = "分类机2 延迟时间";
                    this.labelStaticSorter2RunTime.Text = "分类机2 运行时间";
                    this.labelStaticEntryGateDelayTime.Text = "料门延迟时间";
                    this.labelStaticEntryGateRunTime.Text = "料门动作时间";
                    this.labelStaticDischargeStopperDelayTime.Text = "出料限位器延迟时间";
                    this.labelStaticDischargeStopperRunTime.Text = "出料限位器动作时间";

                    this.groupBoxJudgmentSetting.Text = "判断设置";
                    this.labelStaticJudgmentDelayTime.Text = "判断延迟";
                    this.labelStaticJudgmentCount.Text = "重复延迟";
                    this.labelStaticTurnDelayTime.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.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.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.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.groupBoxJudgmentSetting.Text = "Nastavení rozhodnutí";
                    this.labelStaticJudgmentDelayTime.Text = "Zpoždění kapsy";
                    this.labelStaticJudgmentCount.Text = "Číslo kapsy";
                    this.labelStaticTurnDelayTime.Text = "Zpoždění rotace";

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

                    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.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainOverDisable));
                    this.buttonOver.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainOverDown));
                    this.buttonOver.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainOverUp));
                    this.buttonPass.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainPassDisable));
                    this.buttonPass.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainPassDown));
                    this.buttonPass.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainPassUp));
                    this.buttonUnder.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainUnderDisable));
                    this.buttonUnder.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainUnderDown));
                    this.buttonUnder.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainUnderUp));
                    this.buttonTare.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainTareDisable));
                    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));
                    this.buttonUser.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainLoginDisable));
                    this.buttonUser.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainLogOffUp));
                    this.buttonUser.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFormMainLoginUp));
                    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.labelTitleScreen.Font = new Font("새굴림", 9, FontStyle.Bold);
                    this.labelTitleScreen.Text = "Bildschirm";
                    this.labelTitleTotalCount.Font = new Font("새굴림", 9, FontStyle.Bold);
                    this.labelTitleTotalCount.Text = "Insgesamt";
                    this.labelTitleNG.Font = new Font("새굴림", 9, FontStyle.Bold);
                    this.labelTitleNG.Text = "Schlecht";

                    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.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.groupBoxJudgmentSetting.Text = "Tascheneinstellung";
                    this.labelStaticJudgmentDelayTime.Text = "Taschenverzögerung";
                    this.labelStaticJudgmentCount.Text = "Taschennummer";
                    this.labelStaticTurnDelayTime.Text = "Rotationsverzögerung";

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

                    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.groupBoxSorter.Text = "ソㅡタㅡ設定";
                    this.labelStaticSorter1DelayTime.Text = "ソㅡタㅡ1 遅延時間";
                    this.labelStaticSorter1RunTime.Text = "ソㅡタㅡ1 運転時間";
                    this.labelStaticSorter2DelayTime.Text = "ソㅡタㅡ2 遅延時間";
                    this.labelStaticSorter2RunTime.Text = "ソㅡタㅡ2 運転時間";
                    this.labelStaticEntryGateDelayTime.Text = "エントリㅡゲㅡトの遅延時間";
                    this.labelStaticEntryGateRunTime.Text = "エントリㅡゲㅡトの運転時間";

                    this.labelStaticDischargeStopperDelayTime.Font = font;
                    this.labelStaticDischargeStopperDelayTime.Text = "排出ストッパㅡの遅延時間";
                    this.labelStaticDischargeStopperRunTime.Font = font;
                    this.labelStaticDischargeStopperRunTime.Text = "排出ストッパㅡの運転時間";

                    this.groupBoxJudgmentSetting.Text = "判定設定";
                    this.labelStaticJudgmentDelayTime.Text = "判定の遅れ";
                    this.labelStaticJudgmentCount.Text = "判定番号";
                    this.labelStaticTurnDelayTime.Text = "タㅡン遅延";

                    this.labelTitleTotalCount.Text = "総カウント";
                    this.labelTitleNG.Text = "合計NG";
                    this.labelTitleBypass.Text = "バイパス";
                    this.labelTitleScreen.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.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()
        {
            int x = 0, y = 0;

            if (this.ParentForm.IsBootingComplete == false)
                this.buttonProductNo.Text = "**";
            else
                this.buttonProductNo.Text = this.ParentForm.SystemConfig.ProductNumber.ToString();

            // AlarmMessageBox1
            x = Screen.PrimaryScreen.Bounds.Width / 2 - this.panelAlarmMessageBox2.Size.Width / 2;
            y = Screen.PrimaryScreen.Bounds.Height / 2 - this.panelAlarmMessageBox2.Size.Height / 2;
            // AlarmMessageBox2
            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();
            // AlarmListBox
            this.MainDisplayAlarmList = new ControlMainDisplayAlarm(this);
            x = Screen.PrimaryScreen.Bounds.Width / 2 - this.MainDisplayAlarmList.Width / 2;
            y = Screen.PrimaryScreen.Bounds.Height / 2 - this.MainDisplayAlarmList.Height / 2;
            this.MainDisplayAlarmList.Location = new Point(x, y);
            this.Controls.Add(this.MainDisplayAlarmList);
            this.MainDisplayAlarmList.Visible = false;

            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, 115);
            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();

            // 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();

            this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

            this.MainDisplayFeedback = new ControlMainDisplayFeedback(this);
            this.Controls.Add(this.MainDisplayFeedback);
            this.MainDisplayFeedback.BringToFront();
            this.MainDisplayFeedback.Location = new Point(0, 75);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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;
                default:
                    break;
            }
            this.UpdateDisplay(this.MainDisplay);
        }
        private void DefaultSetting()
        {
            this.SubmenuIndex = 0;
            this.IsFistAlarmView = false;
            this.ChangeID = "";

            this.RescaleControl();

            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;
            }

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

            // Ethernet 
            if (this.ParentForm.SystemConfig.IsEthernetEnable == false)
            {
                this.pictureBoxEthernetConnection.Visible = false;
                this.pictureBoxEthernetDisconnection.Visible = false;
            }
            else
            {
                this.pictureBoxEthernetConnection.Visible = false;
                this.pictureBoxEthernetDisconnection.Visible = true;
            }

            // Feedback
            if (this.ParentForm.SystemConfig.IsFeedback == true)
                this.buttonFeedback.Visible = true;
            else
                this.buttonFeedback.Visible = false;
        }

        public void RescaleControl()
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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;
                default:
                    break;
            }
        }
        private void UpdateDisplay(DataStore.FormMainDisplayStore displayForm)
        {
            if (displayForm == DataStore.FormMainDisplayStore.FormMainDisplayBarGraph)
            {
                #region BarGraph
                if (this.MainDisplayFeedback != null)
                    this.MainDisplayFeedback.Visible = false;

                switch (this.ParentForm.SystemConfig.EquipmentColumns)
                {
                    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;
                    default:
                        break;
                }
                #endregion
                this.UpdateDisplayButton(SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
            }
            else if (displayForm == DataStore.FormMainDisplayStore.FormMainDisplayDotGraph)
            {
                #region DotGraph
                if (this.MainDisplayFeedback != null)
                    this.MainDisplayFeedback.Visible = false;

                switch (this.ParentForm.SystemConfig.EquipmentColumns)
                {
                    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;
                    default:
                        break;
                }
                #endregion
                this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
            }
            else if (displayForm == DataStore.FormMainDisplayStore.FormMainDisplayTable)
            {
                #region Table
                if (this.MainDisplayFeedback != null)
                    this.MainDisplayFeedback.Visible = false;

                switch (this.ParentForm.SystemConfig.EquipmentColumns)
                {
                    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;
                    default:
                        break;
                }
                #endregion
                this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP);
            }
            else if (displayForm == DataStore.FormMainDisplayStore.FormMainDisplayFeedback)
            {
                #region Feedback
                if (this.MainDisplayFeedback != null)
                {
                    this.MainDisplayFeedback.DisplayRefresh();
                    this.MainDisplayFeedback.Visible = true;
                }

                switch (this.ParentForm.SystemConfig.EquipmentColumns)
                {
                    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 = false;
                        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 = false;
                        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 = false;
                        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 = false;
                        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 = false;
                        break;
                    default:
                        break;
                }
                #endregion
                this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN);
            }

        }
        private void UpdateDisplayButton(SmartButton.BUTSTATUS btBar, SmartButton.BUTSTATUS btDot, SmartButton.BUTSTATUS btTable, SmartButton.BUTSTATUS btFeedback)
        {
            if (btBar == SmartButton.BUTSTATUS.DOWN)
                this.buttonBarGraphForm.ButtonDown();
            else
                this.buttonBarGraphForm.ButtonUp();

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

            if (btTable == SmartButton.BUTSTATUS.DOWN)
                this.buttonTableForm.ButtonDown();
            else
                this.buttonTableForm.ButtonUp();

            if (btFeedback == SmartButton.BUTSTATUS.DOWN)
                this.buttonFeedback.ButtonDown();
            else
                this.buttonFeedback.ButtonUp();
        }
        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 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);
                this.DisplayRefresh();
            }
            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.ChangeID = "";

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

            this.DisplayRefresh();
            this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
        }
        public void Part11AutomaticLogoutReset()
        {
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                UserManager.UserManager_AutoLogoutTimeoutReset();
        }

        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 if (this.ParentForm.SystemConfig.Language == DataStore.E_LanguageID.Chinese)
                        group = "行政";
                    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 if (this.ParentForm.SystemConfig.Language == DataStore.E_LanguageID.Chinese)
                        group = "开发商";
                    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.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.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.TurnDelayTime.ToString();
            if (this.labelTurnDelayTime.Text != value)
                this.labelTurnDelayTime.Text = value;

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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;
                default:
                    break;
            }

            this.RescaleControl();

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

            this.buttonMenu.Enabled = true;

            if (this.ParentForm.SystemConfig.IsLogin == true)
            {
                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 ||
                    this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Admin ||
                    this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer)
                {
                    this.buttonProductNo.Enabled = true;
                    this.buttonUnder.Enabled = true;
                    this.buttonPass.Enabled = true;
                    this.buttonOver.Enabled = true;
                    this.buttonTare.Enabled = true;
                    this.panelSubMenu2.Enabled = true;
                }
            }
            else
            {
                this.buttonProductNo.Enabled = true;
                this.buttonUnder.Enabled = true;
                this.buttonPass.Enabled = true;
                this.buttonOver.Enabled = true;
                this.buttonTare.Enabled = true;
                this.panelSubMenu2.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;

                // 공압 알람 이면 장비 정지
                //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);

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

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

                this.buttonCut.ButtonUp();
                this.timerCutSignal.Stop();
                #endregion
            }

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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;
                default:
                    break;
            }
        }
        public void UpdateStopWeightDisplay(DataStore.EquipmentStatus status, Collection<WeightData> weightDatas)
        {
            if (this.ParentForm.SystemConfig.IsFeedback == true)
                this.MainDisplayFeedback.UpdateStopWeightDisplay(status, weightDatas);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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;
                default:
                    break;
            }
        }
        public void UpdateStartWeightDisplay(DataStore.EquipmentStatus status, Collection<WeightData> weightDatas)
        {
            string value = "";

            if (this.MainDisplayFeedback != null)
                this.MainDisplayFeedback.UpdateStartWeightDisplay(status, weightDatas);

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

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateFeedbackDataDisplay(DataStore.EquipmentStatus status, Collection<FeedBackSystem> feedbackData, Collection<WeightData> weightData)
        {
            if (this.MainDisplayFeedback != null)
            {
                this.MainDisplayFeedback.UpdateFeedbackDataDisplay(status, feedbackData);
                this.MainDisplayFeedback.UpdateStartWeightDisplay(status, weightData);
            }
        }
        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.IsPinchPoint == 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");
            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 (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 UpdateDisplayPinchPointAlarm(string lane)
        {
            string message = "";
            switch (this.ParentForm.SystemConfig.Language)
            {
                case DataStore.E_LanguageID.Korean:
                    message = "제품 끼임 발생!";
                    break;
                case DataStore.E_LanguageID.English:
                    message = "Pinch point!";
                    break;
                case DataStore.E_LanguageID.Chinese:
                    message = "Pinch point!";
                    break;
                case DataStore.E_LanguageID.Czech:
                    message = "Pinch point!";
                    break;
                case DataStore.E_LanguageID.German:
                    message = "Knackpunkt!";
                    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.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");

            // 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;
            }
            else
            {
                this.panelAlarmMessageBox2.Visible = false;
                this.ParentForm.TransferData(CommunicationCommand.BuzzerOff, CommunicationID.MainBoard);
                this.ParentForm.CurrentAlarmList.IsBuzzerStatus = false;
            }
        }
        public void UpdateDisplayAlarmMessageServoOrigin()
        {
            if (this.ParentForm.IsServoOrigin == true)
            {
                this.panelAlarmMessageBox4.BringToFront();
                this.panelAlarmMessageBox4.Visible = true;
            }
        }
        public void UpdateDisplayTime()
        {
            this.labelTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        }
        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;
            }
        }

        public void ClearRefreshFeedbackDisplay()
        {
            if (this.ParentForm.SystemConfig.IsFeedback == true)
            {
                this.MainDisplayFeedback.Clear();
                this.MainDisplayFeedback.UpdateFeedbackDisplay(this.ParentForm.CurrentFeedbackItem, this.ParentForm.SystemConfig, this.ParentForm.CurrentProductItem);
                for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
                    this.ParentForm.Update30000ModbusData(i);
            }
        }

        public void ProductChange(int productNumber)
        {
            // SetTrackingHistoryData
            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.ProductNumber, "",
                this.ParentForm.SystemConfig.ProductNumber.ToString(), productNumber.ToString());

            this.buttonProductNo.Text = "**";
            this.buttonProductNo.Enabled = false;
            this.buttonMenu.Enabled = false;
            this.buttonUnder.Enabled = false;
            this.buttonPass.Enabled = false;
            this.buttonOver.Enabled = false;
            this.buttonTare.Enabled = false;
            this.panelSubMenu2.Enabled = false;

            this.ParentForm.ProductChange(productNumber);
        }
        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 Clear()
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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;
                default:
                    break;
            }
        }
        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 = "Einloggen";
                        message1 = "Sie werden nach einer Weile abgemeldet";
                        message2 = "";
                        break;
                    default:
                        break;
                }

                warningTime = this.ParentForm.FlagAutomaticLogoutWarningTime - 2;

                this.UI_Invoke(delegate
                {
                    DialogFormMessage msg = new DialogFormMessage(DataStore.MessageBoxIcon.Asterisk, code, message1, message2, warningTime);
                    if (msg.ShowDialog() == DialogResult.OK)
                    {
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.Part11AutomaticLogoutReset();
                    }
                });
            }
            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);
                    msg.ShowDialog();
                });
            }
        }
        public void TimerServer(bool value)
        {
            if (value == false)
            {
                if (this.timerServer.IsStart == true)
                    this.timerServer.Stop();
            }
            else
            {
                if (this.timerServer.IsStart == false)
                    this.timerServer.Start();
            }
        }

        public void DisplayRefresh()
        {
            this.ParentForm.TransferData(CommunicationCommand.ModeNormal, CommunicationID.MainBoard);
            if (this.ParentForm.EquipmentStatus == DataStore.EquipmentStatus.Stop)
                this.ProductChange(this.ParentForm.SystemConfig.ProductNumber);

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

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

            if (this.ParentForm.SystemConfig.IsEthernetEnable == false)
            {
                this.pictureBoxEthernetConnection.Visible = false;
                this.pictureBoxEthernetDisconnection.Visible = false;
            }
            
            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;
            }

            // Ethernet 
            if (this.ParentForm.SystemConfig.IsEthernetEnable == true)
            {
                this.pictureBoxEthernetDisconnection.Visible = true;

                if (this.ParentForm.SystemConfig.EthernetOperationMode == 1)
                {
                    this.ParentForm.EthernetClientDisconnect();

                    if (this.ParentForm.smartTCPMultiServer.IsStart == false)
                        this.ParentForm.smartTCPMultiServer.Start();
                }
            }
            else
            {
                this.pictureBoxEthernetDisconnection.Visible = false;
                this.pictureBoxEthernetConnection.Visible = false;

                if (this.ParentForm.SystemConfig.EthernetOperationMode == 2)
                    this.ParentForm.EthernetClientDisconnect();
                else
                {
                    if (this.ParentForm.smartTCPMultiServer.IsStart == true)
                        this.ParentForm.smartTCPMultiServer.Stop();
                }
            }

            // SubMenu
            this.panelSubMenu1.Visible = false;
            this.panelSubMenu2.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;

            // Bypass Display
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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;
                default:
                    break;
            }

            this.ParentForm.SystemConfig.CurrentForm = DataStore.FormStore.FormMainDisplay;
            this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;
            this.UpdateDisplay(this.MainDisplay);
            this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
        }
        #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.DisplayRefresh();
                this.MainDisplayAlarmList.BringToFront();
                this.MainDisplayAlarmList.Visible = true;
            }
        }

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

            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);
                }
            }
        }
        private void buttonUnder_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";
            int underRangeLimit = 0, underRange = 0;

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

            before = this.buttonUnder.Text;
            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
                {
                    this.ParentForm.CurrentProductItem.UnderRange = myKeyPad.StringValue.Replace(".", "");
                    this.buttonUnder.Text = myKeyPad.StringValue;
                    this.labelUnderRange.Text = myKeyPad.StringValue;
                    after = myKeyPad.StringValue;

                    this.RescaleControl();

                    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);

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

                    if (underRange < underRangeLimit)
                    {
                        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);

                        // 중량 Limit 설정 확인하세요!
                        // Low Limit Range
                        DialogFormMessage myMsg = new DialogFormMessage(11, this.ParentForm.SystemConfig.Language);
                        myMsg.ShowDialog();
                    }

                    // Modbus
                    if (this.ParentForm.SystemConfig.IsModbus == true)
                    {
                        this.ParentForm.Update30000ModbusData();
                        this.ParentForm.ModbusCommonDataSend();
                    }

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightUnderRange, "", before, after);
                }
            }
        }
        private void buttonPass_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.buttonPass.Text;
            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
                {
                    this.ParentForm.CurrentProductItem.PassRange = myKeyPad.StringValue.Replace(".", "");
                    this.buttonPass.Text = myKeyPad.StringValue;
                    this.labelPassRange.Text = myKeyPad.StringValue;
                    after = myKeyPad.StringValue;

                    this.RescaleControl();

                    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);

                    // Modbus
                    if (this.ParentForm.SystemConfig.IsModbus == true)
                    {
                        this.ParentForm.Update30000ModbusData();
                        this.ParentForm.ModbusCommonDataSend();
                    }

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightPassRange, "", before, after);
                }
            }
        }
        private void buttonOver_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";
            int overRangeLimit = 0, overRange = 0;

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

            before = this.buttonOver.Text;
            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
                {
                    this.ParentForm.CurrentProductItem.OverRange = myKeyPad.StringValue.Replace(".", "");
                    this.buttonOver.Text = myKeyPad.StringValue;
                    this.labelOverRange.Text = myKeyPad.StringValue;
                    after = myKeyPad.StringValue;

                    this.RescaleControl();

                    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);

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

                    if (overRange > overRangeLimit)
                    {
                        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);

                        // 중량 Limit 설정 확인하세요!
                        // Low Limit Range
                        DialogFormMessage myMsg = new DialogFormMessage(11, this.ParentForm.SystemConfig.Language);
                        myMsg.ShowDialog();
                    }

                    // Modbus
                    if (this.ParentForm.SystemConfig.IsModbus == true)
                    {
                        this.ParentForm.Update30000ModbusData();
                        this.ParentForm.ModbusCommonDataSend();
                    }

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightOverRange, "", before, after);
                }
            }
        }
        private void buttonTare_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.buttonTare.Text;
            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
                {
                    this.ParentForm.CurrentProductItem.TareRange = myKeyPad.StringValue.Replace(".", "");
                    this.buttonTare.Text = myKeyPad.StringValue;
                    after = myKeyPad.StringValue;

                    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);

                    // Modbus
                    if (this.ParentForm.SystemConfig.IsModbus == true)
                    {
                        this.ParentForm.Update30000ModbusData();
                        this.ParentForm.ModbusCommonDataSend();
                    }

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightTareRange, "", 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();

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

                // SetTrackingHistoryData
                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();

                this.panelSetting.BringToFront();
                this.panelSetting.Visible = true;
            }
        }
        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 if (button == this.buttonFeedback)
                this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayFeedback;
            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);

            // SetTrackingHistoryData
            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 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)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            if (this.buttonBypassDirection.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                this.ParentForm.SystemConfig.IsBypassDirectionPass = false;
            else
                this.ParentForm.SystemConfig.IsBypassDirectionPass = true;
        }
        private void buttonBypassOnce_Click(object sender, EventArgs e)
        {
            // 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;
            }
            else
            {
                this.ParentForm.SystemConfig.IsBypassOnce = true;
                this.buttonBypassRun.Mode = SmartButton.BUTTONMODE.NORMAL;
            }
        }
        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);

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.BP_PassOnce, "");
                }
                else
                {
                    this.ParentForm.TransferData(CommunicationCommand.ByNGOnce, CommunicationID.MainBoard);

                    // SetTrackingHistoryData
                    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);

                        // SetTrackingHistoryData
                        this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.BP_PassON, "");
                    }
                    else
                    {
                        this.ParentForm.TransferData(CommunicationCommand.ByNGON, CommunicationID.MainBoard);

                        // SetTrackingHistoryData
                        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);

                        // SetTrackingHistoryData
                        this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.BP_PassOFF, "");
                    }
                    else
                    {
                        this.ParentForm.TransferData(CommunicationCommand.ByNGOFF, CommunicationID.MainBoard);

                        // SetTrackingHistoryData
                        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.SubmenuIndex = 1;
            }
            else if (this.SubmenuIndex == 1)
            {
                this.panelSubMenu2.BringToFront();
                this.panelSubMenu2.Visible = true;

                this.panelSubMenu1.Visible = false;

                this.SubmenuIndex = 2;
            }
            else
            {
                this.panelSubMenu1.Visible = false;
                this.panelSubMenu2.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);

            // SetTrackingHistoryData
            this.ParentForm.SetTrackingHistoryData(DataStore.E_TrackingOperation.MainCut, "");
        }

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

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

            before = this.labelSorter1DelayTime.Text;
            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 = myKeyPad.StringValue;

                    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);

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Sorter1DelayTime, "", before, after);
                }
            }
        }
        private void labelSorter1RunTime_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.labelSorter1RunTime.Text;
            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 = myKeyPad.StringValue;

                    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);

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Sorter1RunTime, "", before, after);
                }
            }
        }
        private void labelSorter2DelayTime_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.labelSorter2DelayTime.Text;
            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 = myKeyPad.StringValue;

                    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);

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Sorter2DelayTime, "", before, after);
                }
            }
        }
        private void labelSorter2RunTime_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.labelSorter2RunTime.Text;
            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 = myKeyPad.StringValue;

                    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);

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Sorter2RunTime, "", 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 labelJudgmentDelayTime_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.labelJudgmentDelayTime.Text;
            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 = myKeyPad.StringValue;

                    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);

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.JudgmentDelayTime, "", before, after);
                }
            }
        }
        private void labelJudgmentCount_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.labelJudgmentCount.Text;
            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 > 5)
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.labelJudgmentCount.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentJudgmentSetItem.JudgmentCount = myKeyPad.IntValue;
                    after = myKeyPad.StringValue;

                    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);

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.JudgmentDelayTime, "", before, after);
                }
            }
        }
        private void labelDischargeStopperDelayTime_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.labelDischargeStopperDelayTime.Text;
            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 = myKeyPad.StringValue;

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

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.DischargeStopperDelayTime, "", before, after);
                }
            }
        }
        private void labelDischargeStopperRunTime_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.labelDischargeStopperRunTime.Text;
            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 = myKeyPad.StringValue;

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

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.DischargeStopperRunTime, "", before, after);
                }
            }
        }
        private void labelEntryGateDelayTime_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.labelEntryGateDelayTime.Text;
            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 = myKeyPad.StringValue;

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

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.EntryGateDelayTime, "", before, after);
                }
            }
        }
        private void labelEntryGateRunTime_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.labelEntryGateRunTime.Text;
            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 = myKeyPad.StringValue;

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

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.EntryGateRunTime, "", before, after);
                }
            }
        }
        private void labelTurnDelayTime_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.labelTurnDelayTime.Text;
            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 = myKeyPad.StringValue;

                    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);

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.TurnDelayTime, "", before, after);
                }
            }
        }

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

            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.Start();
            else
                this.timerCutSignal.Stop();
        }
        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 labelOverRangeLimit_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.labelOverRangeLimit.Text;
            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 = myKeyPad.StringValue;

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

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightOverRangeLimit, "", before, after);
                }
            }
        }
        private void labelUnderRangeLimit_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            before = this.labelUnderRangeLimit.Text;
            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 = myKeyPad.StringValue;

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

                    // SetTrackingHistoryData
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightUnderRangeLimit, "", before, after);
                }
            }
        }
        private void buttonOnOff_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";

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

            if (this.buttonOnOff.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                before = "OFF";
                after = "ON";

                value = "0001";
                this.ParentForm.SystemConfig.IsWeightLimitEnable = true;
            }
            else
            {
                before = "ON";
                after = "OFF";

                value = "0000";
                this.ParentForm.SystemConfig.IsWeightLimitEnable = false;
            }

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

            // SetTrackingHistoryData
            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightLimit_Activate, "", before, after);
        }

        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 buttonExit_Click(object sender, EventArgs e)
        {
            this.ParentForm.ChildFormTimeSetting.TimerEnable(false);
            this.ParentForm.CloseSmartUartLink();
            this.ParentForm.Dispose();
            this.ParentForm.Close();
        }
    }
}