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 INT69DC_7C.Controls;
using INT69DC_7C.DialogForms;
using INT69DC_ImageDll;
using InModbus;
using INT69DC_7C.Part11_UserManager;

namespace INT69DC_7C.Forms
{
    public partial class FormMainDisplay : Form
    {
        #region Field
        private int FlagTimeoutCount;
        private int SubmenuIndex;
        public string ChangeID;

        private FormMain m_ParentForm;

        private Color ColorButtonAccessTrue;
        private Color ColorButtonAccessFalse;

        private DataStore.FormMainDisplayStore MainDisplay;
        private DataStore.E_TotalCnt Mode_TotalCnt;
        private DataStore.E_TotalCntNG Mode_TotalCntNG;

        private ControlMainDisplayAlarm MainDisplayAlarmList;

        private ControlMainDisplayFeedbacak MainDisplayFeedbaack;
        private ControlMainDisplayEachBarGraph7 MainDisplayEachBarGraph7;
        private ControlMainDisplayEachBarGraph8 MainDisplayEachBarGraph8;
        private ControlMainDisplayEachBarGraph10 MainDisplayEachBarGraph10;
        private ControlMainDisplayEachBarGraph11 MainDisplayEachBarGraph11;
        private ControlMainDisplayEachBarGraph12 MainDisplayEachBarGraph12;
        private ControlMainDisplayDotGraph7 MainDisplayDotGraph7;
        private ControlMainDisplayDotGraph8 MainDisplayDotGraph8;
        private ControlMainDisplayDotGraph10 MainDisplayDotGraph10;
        private ControlMainDisplayDotGraph11 MainDisplayDotGraph11;
        private ControlMainDisplayDotGraph12 MainDisplayDotGraph12;
        private ControlMainDisplayTable7 MainDisplayTable7;
        private ControlMainDisplayTable8 MainDisplayTable8;
        private ControlMainDisplayTable10 MainDisplayTable10;
        private ControlMainDisplayTable11 MainDisplayTable11;
        private ControlMainDisplayTable12 MainDisplayTable12;
        #endregion

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

            this.ParentForm = parent;
        }
        #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();

            if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Korean)
            {
                #region Korean
                if (this.ParentForm.SystemConfig.IsLogin == true)
                {
                    this.buttonMenu.Location = new Point(929, 663);

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

                    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
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.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));
                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));
                if (this.ParentForm.SystemConfig.IsLogin == true)
                {
                    this.buttonMenu.Location = new Point(929, 663);

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

                    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.groupBoxSorter.Text = "Setting Sorter";
                this.labelStaticSorterDelayTime.Text = "Delay";
                this.labelStaticSorterRunTime.Text = "Run";

                this.groupBoxConveyor.Text = "Setting Conveyor";
                this.labelStaticRejectConveyor.Text = "Reject conveyor";
                this.labelStaticRejectConveyorDelayTime.Text = "Delay";
                this.labelStaticRejectConveyorRunTime.Text = "Run";
                this.labelStaticFeedingConveyor.Text = "Feeding conveyor";
                this.labelStaticFeedingDelayTime.Text = "Delay";
                this.labelStaticFeedingRunTime.Text = "Run";

                this.labelMessage1.Text = "Alarm - Double Entry";

                this.groupBoxJudgment.Text = "Setting judgment";
                this.labelStaticFilter.Text = "Filter";
                this.labelStaticJudgmentDelayTime.Text = "J.Delay";
                this.labelStaticDoubleDelayTime.Text = "Overlap";
                this.labelStaticJudgmentCount.Text = "J.Count";

                this.labelStaticAlarmContinuousNG.Text = "Continuous NG";
                this.labelMessage3.Text = "Continuous NG Occurs!";

                this.labelStaticATPC.Text = "Pass alarm";
                this.labelStaticATPC_Count.Text = "Count";
                this.labelStaticATPC_Pass.Text = "Pass";
                this.labelStaticATPC_Lack.Text = "Lack";
                this.buttonATPC_Reset.Text = "Reset";
                #endregion
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
            {
                #region Chinese
                this.buttonOver.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainOverDisable));
                this.buttonOver.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainOverDown));
                this.buttonOver.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainOverUp));
                this.buttonPass.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainPassDisable));
                this.buttonPass.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainPassDown));
                this.buttonPass.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainPassUp));
                this.buttonUnder.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainUnderDisable));
                this.buttonUnder.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainUnderDown));
                this.buttonUnder.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainUnderUp));
                this.buttonTare.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainTareDisable));
                this.buttonTare.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainTareDown));
                this.buttonTare.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainTareUp));

                this.buttonScaleZero.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainZeroDown));
                this.buttonScaleZero.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainZeroUp));
                this.buttonClear.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainClearDisable));
                this.buttonClear.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainClearDown));
                this.buttonClear.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainClearUp));
                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.buttonAlarmContinuousNG.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnEnable));
                this.buttonAlarmContinuousNG.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnDisable));
                if (this.ParentForm.SystemConfig.IsLogin == true)
                {
                    this.buttonMenu.Location = new Point(929, 663);

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

                    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.groupBoxSorter.Text = "选别机设置";
                this.labelStaticSorterDelayTime.Text = "延迟时间";
                this.labelStaticSorterRunTime.Text = "运行时间";

                this.groupBoxConveyor.Text = "输送机设置";
                this.labelStaticRejectConveyor.Text = "选别输送机";
                this.labelStaticRejectConveyorDelayTime.Text = "延迟时间";
                this.labelStaticRejectConveyorRunTime.Text = "运行时间";
                this.labelStaticFeedingConveyor.Text = "进料输送机";
                this.labelStaticFeedingDelayTime.Text = "延迟时间";
                this.labelStaticFeedingRunTime.Text = "运行时间";

                this.labelMessage1.Text = "报警 - 双倍";

                this.labelTitleTotalCount.Text = "计数";
                this.labelTitleNGCount.Text = "不良";
                this.labelTitleBypass.Text = "旁路";
                this.labelTitleScreen.Text = "屏幕";

                this.groupBoxJudgment.Text = "判断设置";
                this.labelStaticFilter.Text = "滤波器";
                this.labelStaticJudgmentDelayTime.Text = "判断延迟";
                this.labelStaticDoubleDelayTime.Text = "重复";
                this.labelStaticJudgmentCount.Text = "重复延迟";

                this.labelStaticAlarmContinuousNG.Text = "连续不好";
                this.labelMessage3.Text = "连续出现 NG!";

                this.labelStaticATPC.Text = "通过报警";
                this.labelStaticATPC_Count.Text = "当前";
                this.labelStaticATPC_Pass.Text = "排放";
                this.labelStaticATPC_Lack.Text = "缺少";
                this.buttonATPC_Reset.Text = "重置";

                // Font & Location & Size
                this.labelTitleTotalCount.Font = new Font("새굴림", 14, FontStyle.Bold);
                this.labelTitleTotalCount.Location = new Point(34, 696);
                this.labelTitleTotalCount.Size = new Size(200, 27);

                this.labelTotalCount.Location = new Point(34, 720);
                this.labelTotalCount.Size = new Size(200, 27);
                
                this.labelTitleNGCount.Font = new Font("새굴림", 14, FontStyle.Bold);
                this.labelTitleNGCount.Location = new Point(285, 696);
                this.labelTitleNGCount.Size = new Size(200, 27);
                
                this.labelNGCount.Location = new Point(285, 720);
                this.labelNGCount.Size = new Size(200, 27);
                #endregion
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech)
            {
                #region Czech
                this.buttonOver.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainOverDisable));
                this.buttonOver.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainOverDown));
                this.buttonOver.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainOverUp));
                this.buttonPass.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainPassDisable));
                this.buttonPass.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainPassDown));
                this.buttonPass.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainPassUp));
                this.buttonUnder.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainUnderDisable));
                this.buttonUnder.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainUnderDown));
                this.buttonUnder.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainUnderUp));
                this.buttonTare.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFormMainTareDisable));
                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));
                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.buttonAlarmContinuousNG.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeEnable));
                this.buttonAlarmContinuousNG.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeDisable));
                if (this.ParentForm.SystemConfig.IsLogin == true)
                {
                    this.buttonMenu.Location = new Point(929, 663);

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

                    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.groupBoxSorter.Text = "Nastavení třídiče";
                this.labelStaticSorterDelayTime.Text = "Doba zpoždění";
                this.labelStaticSorterRunTime.Text = "Doba chodu";

                this.groupBoxConveyor.Text = "Nastavení dopravníku";
                this.labelStaticRejectConveyor.Text = "Vyřazení dopravníku";
                this.labelStaticRejectConveyorDelayTime.Text = "Doba zpoždění";
                this.labelStaticRejectConveyorRunTime.Text = "Doba chodu";
                this.labelStaticFeedingConveyor.Text = "Podávací dopravník";
                this.labelStaticFeedingDelayTime.Text = "Doba zpoždění";
                this.labelStaticFeedingRunTime.Text = "Doba chodu";

                this.labelMessage1.Text = "poplach - Zdvojení";

                this.labelTitleTotalCount.Text = "Celkem";
                this.labelTitleNGCount.Text = "Vadný";
                this.labelTitleBypass.Text = "Bypass";
                this.labelTitleScreen.Text = "Zobrazení";

                this.groupBoxJudgment.Text = "Nastavení rozhodnutí";
                this.labelStaticFilter.Text = "Filtrovat";
                this.labelStaticJudgmentDelayTime.Text = "Zpoždění rozhodnutí";
                this.labelStaticDoubleDelayTime.Text = "Přesah";
                this.labelStaticJudgmentCount.Text = "Počet rozhodnutí";

                this.labelStaticAlarmContinuousNG.Text = "Trvalá chyba";
                this.labelMessage3.Text = "Vyskytuje se kontinuální NG!";

                this.labelStaticATPC.Text = "Přeposlání alarmu";
                this.labelStaticATPC_Count.Text = "Počítat";
                this.labelStaticATPC_Pass.Text = "Váha";
                this.labelStaticATPC_Lack.Text = "nedostatek";
                this.buttonATPC_Reset.Text = "RST";

                // Font & Location & Size
                this.labelTitleScreen.Font = new Font("새굴림", 10F, FontStyle.Bold);
                this.labelStaticJudgmentDelayTime.Font = new Font("새굴림", 9, FontStyle.Bold);

                this.labelTitleTotalCount.Font = new Font("새굴림", 14, FontStyle.Bold);
                this.labelTitleTotalCount.Location = new Point(34, 696);
                this.labelTitleTotalCount.Size = new Size(200, 27);

                this.labelTotalCount.Location = new Point(34, 720);
                this.labelTotalCount.Size = new Size(200, 27);

                this.labelTitleNGCount.Font = new Font("새굴림", 14, FontStyle.Bold);
                this.labelTitleNGCount.Location = new Point(285, 696);
                this.labelTitleNGCount.Size = new Size(200, 27);

                this.labelNGCount.Location = new Point(285, 720);
                this.labelNGCount.Size = new Size(200, 27);
                #endregion
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.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.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.buttonAlarmContinuousNG.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerEnable));
                this.buttonAlarmContinuousNG.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerDisable));
                if (this.ParentForm.SystemConfig.IsLogin == true)
                {
                    this.buttonMenu.Location = new Point(929, 663);

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

                    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.groupBoxSorter.Text = "Sortierereinstellung";
                this.labelStaticSorterDelayTime.Text = "Vezögerung";
                this.labelStaticSorterRunTime.Text = "Laufzeit";

                this.groupBoxConveyor.Text = "Förderereinstellung";
                this.labelStaticRejectConveyor.Text = "Aussortierförderer";
                this.labelStaticRejectConveyorDelayTime.Text = "Vezögerung";
                this.labelStaticRejectConveyorRunTime.Text = "Laufzeit";
                this.labelStaticFeedingConveyor.Text = "Zuführfördererr";
                this.labelStaticFeedingDelayTime.Text = "Vezögerung";
                this.labelStaticFeedingRunTime.Text = "Laufzeit";
                this.buttonClose.Text = "Schließen";

                this.labelMessage1.Text = "Alarm - doppelte Eingabe";

                this.labelTitleTotalCount.Text = "Insgesamt";
                this.labelTitleNGCount.Text = "Schlecht";
                this.labelTitleBypass.Text = "Bypass";
                this.labelTitleScreen.Text = "Bildschirm";

                this.groupBoxJudgment.Text = "Tascheneinstellung";
                this.labelStaticFilter.Text = "Filter";
                this.labelStaticJudgmentDelayTime.Text = "Taschenverzögerung";
                this.labelStaticDoubleDelayTime.Text = "Überlappung";
                this.labelStaticJudgmentCount.Text = "Taschennummer";

                this.labelStaticAlarmContinuousNG.Text = "Dauerhafter Fehler";
                this.labelMessage3.Text = "Kontinuierliches NG tritt auf!";

                this.labelStaticATPC.Text = "Alarm übergeben";
                this.labelStaticATPC_Count.Text = "Zählen";
                this.labelStaticATPC_Pass.Text = "Bestehen";
                this.labelStaticATPC_Lack.Text = "Mangel";
                this.buttonATPC_Reset.Text = "RST";

                // Font & Location & Size
                this.labelTitleScreen.Font = new Font("새굴림", 10F, FontStyle.Bold);

                this.labelTitleTotalCount.Font = new Font("새굴림", 14, FontStyle.Bold);
                this.labelTitleTotalCount.Location = new Point(34, 696);
                this.labelTitleTotalCount.Size = new Size(200, 27);

                this.labelTotalCount.Location = new Point(34, 720);
                this.labelTotalCount.Size = new Size(200, 27);

                this.labelTitleNGCount.Font = new Font("새굴림", 14, FontStyle.Bold);
                this.labelTitleNGCount.Location = new Point(285, 696);
                this.labelTitleNGCount.Size = new Size(200, 27);

                this.labelNGCount.Location = new Point(285, 720);
                this.labelNGCount.Size = new Size(200, 27);
                #endregion
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Japanese)
            {
                #region Japanese
                this.buttonOver.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainOverDisable));
                this.buttonOver.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainOverDown));
                this.buttonOver.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainOverUp));
                this.buttonPass.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainPassDisable));
                this.buttonPass.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainPassDown));
                this.buttonPass.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainPassUp));
                this.buttonUnder.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainUnderDisable));
                this.buttonUnder.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainUnderDown));
                this.buttonUnder.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainUnderUp));
                this.buttonTare.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainTareDisable));
                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));
                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));

                if (this.ParentForm.SystemConfig.IsLogin == true)
                {
                    this.buttonMenu.Location = new Point(929, 663);

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

                    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.groupBoxSorter.Text = "選別機設定";
                this.labelStaticSorterDelayTime.Text = "遅延時間";
                this.labelStaticSorterRunTime.Text = "運転時間";

                this.groupBoxConveyor.Text = "コンベアの設定";
                this.labelStaticRejectConveyor.Text = "排出コンベア";
                this.labelStaticRejectConveyorDelayTime.Text = "遅延時間";
                this.labelStaticRejectConveyorRunTime.Text = "運転時間";
                this.labelStaticFeedingConveyor.Text = "供給コンベア";
                this.labelStaticFeedingDelayTime.Text = "遅延時間";
                this.labelStaticFeedingRunTime.Text = "運転時間";

                this.labelMessage1.Text = "アラㅡム - 二重進入";

                this.groupBoxJudgment.Text = "判定設定";
                this.labelStaticFilter.Text = "フィルタㅡ";
                this.labelStaticJudgmentDelayTime.Text = "判定遅延";
                this.labelStaticDoubleDelayTime.Text = "二重遅延";
                this.labelStaticJudgmentCount.Text = "判定数";

                this.labelStaticAlarmContinuousNG.Text = "連続不良";
                this.labelMessage3.Text = "連続NGを検出してください。";

                this.labelStaticATPC.Text = "定量アラㅡム";
                this.labelStaticATPC_Count.Text = "数量";
                this.labelStaticATPC_Pass.Text = "基準";
                this.labelStaticATPC_Lack.Text = "不足";
                this.buttonATPC_Reset.Text = "リセット";

                this.labelTitleTotalCount.Font = new Font("새굴림", 15, FontStyle.Bold);
                this.labelTitleTotalCount.Text = "総数";
                this.labelTitleNGCount.Font = new Font("새굴림", 15, FontStyle.Bold);
                this.labelTitleNGCount.Text = "不良";
                this.labelTitleBypass.Text = "バイパス";
                this.labelTitleScreen.Text = "画面";
                
                // Font & Location & Size
                //this.labelTitleTotalCount.Font = new Font("새굴림", 14, FontStyle.Bold);
                //this.labelTitleTotalCount.Location = new Point(34, 696);
                //this.labelTitleTotalCount.Size = new Size(200, 27);

                //this.labelTotalCount.Location = new Point(34, 720);
                //this.labelTotalCount.Size = new Size(200, 27);

                //this.labelTitleNGCount.Font = new Font("새굴림", 14, FontStyle.Bold);
                //this.labelTitleNGCount.Location = new Point(285, 696);
                //this.labelTitleNGCount.Size = new Size(200, 27);

                //this.labelNGCount.Location = new Point(285, 720);
                //this.labelNGCount.Size = new Size(200, 27);
                #endregion
            }
            else
            {

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

            this.buttonUnder.Text = Helper.StringToDecimalPlaces(this.ParentForm.CurrentProductItem.UnderRange, this.ParentForm.SystemConfig.DecimalPlaces);
            this.buttonPass.Text = Helper.StringToDecimalPlaces(this.ParentForm.CurrentProductItem.PassRange, this.ParentForm.SystemConfig.DecimalPlaces);
            this.buttonOver.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.labelProductName.Text = this.ParentForm.CurrentProductItem.Name;
            this.labelLotNo.Text = this.ParentForm.CurrentProductItem.LotNo;
            this.labelProductionSpeed.Text = "0";
            
            // Alarm ContinuousNG CNT
            this.labelAlarmContinuousNG.Text = this.ParentForm.SystemConfig.AlarmContinuousNG.ToString();
            // Alarm ContinuousNG Enable
            if (this.ParentForm.SystemConfig.IsAlarmContinuousNGEnable == true)
                this.buttonAlarmContinuousNG.ButtonDown();
            else
                this.buttonAlarmContinuousNG.ButtonUp();

            // Alarm TotalCount 
            this.labelATPC_SetCNT.Text = this.ParentForm.SystemConfig.AlarmTotalPassCnt.ToString();
            // Alarm TotalCount Enable
            if (this.ParentForm.SystemConfig.IsAlarmTotalPassCntEnable == true)
                this.buttonATPC_Enable.ButtonDown();
            else
                this.buttonATPC_Enable.ButtonUp();
            // Alarm Totalcount Display
            this.UpdateAlarmTotalPassCountDisplay(this.ParentForm.CurrentAlarmTotalPassCnt);

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

            // AlarmMessageBox1
            x = Screen.PrimaryScreen.Bounds.Width / 2 - this.panelAlarmMessageBox1.Size.Width / 2;
            y = Screen.PrimaryScreen.Bounds.Height / 2 - this.panelAlarmMessageBox1.Size.Height / 2;
            this.panelAlarmMessageBox1.Location = new Point(x, y);
            this.panelAlarmMessageBox1.Visible = false;
            this.panelAlarmMessageBox1.BringToFront();
            // AlarmMessageBox3
            this.panelAlarmMessageBox3.Location = new Point(x, y);
            this.panelAlarmMessageBox3.Visible = false;
            this.panelAlarmMessageBox3.BringToFront();
            // Panel Setting
            this.panelSetting.Location = new Point(429, 115);
            this.panelSetting.Visible = false;
            this.panelSetting.BringToFront();
            // Panel SubMenu1
            this.panelSubMenu1.Location = new Point(4, 573);
            this.panelSubMenu1.Visible = false;
            this.panelSubMenu1.BringToFront();
            // Panel SubMenu2
            this.panelSubMenu2.Location = new Point(4, 573);
            this.panelSubMenu2.Visible = false;
            this.panelSubMenu2.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;

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

            // Feedback
            this.buttonFeedback.Visible = this.ParentForm.SystemConfig.IsOptFeedbackBoardUse;

            if (this.ParentForm.SystemConfig.Serial3Mode == 5)
                this.buttonPrint.Visible = true;
            else
                this.buttonPrint.Visible = false;

            this.buttonBarGraphForm.ButtonDown();

            this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;
            this.Mode_TotalCnt = DataStore.E_TotalCnt.f0_Total;
            this.Mode_TotalCntNG = DataStore.E_TotalCntNG.f0_NG;

            if (this.ParentForm.SystemConfig.IsOptFeedbackBoardUse == true)
            {
                this.MainDisplayFeedbaack = new ControlMainDisplayFeedbacak(this);
                this.Controls.Add(this.MainDisplayFeedbaack);
                this.MainDisplayFeedbaack.BringToFront();
                this.MainDisplayFeedbaack.Location = new Point(0, 75);
            }

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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 11:
                    this.MainDisplayEachBarGraph11 = new ControlMainDisplayEachBarGraph11(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph11);
                    this.MainDisplayEachBarGraph11.BringToFront();
                    this.MainDisplayEachBarGraph11.Location = new Point(0, 75);
                    this.MainDisplay = DataStore.FormMainDisplayStore.FormMainDisplayBarGraph;

                    this.MainDisplayDotGraph11 = new ControlMainDisplayDotGraph11(this);
                    this.Controls.Add(this.MainDisplayDotGraph11);
                    this.MainDisplayDotGraph11.BringToFront();
                    this.MainDisplayDotGraph11.Location = new Point(0, 75);

                    this.MainDisplayTable11 = new ControlMainDisplayTable11(this);
                    this.Controls.Add(this.MainDisplayTable11);
                    this.MainDisplayTable11.BringToFront();
                    this.MainDisplayTable11.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.FlagTimeoutCount = 0;
            this.SubmenuIndex = 0;
            this.ChangeID = "";

            this.ColorButtonAccessTrue = Color.Black;
            this.ColorButtonAccessFalse = Color.DimGray;

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

            // Feedback
            this.buttonFeedback.Visible = this.ParentForm.SystemConfig.IsOptFeedbackBoardUse;

            // Ethernet 
            if (this.ParentForm.SystemConfig.EthernetMode == 0)
            {
                this.pictureBoxEthernetConnection.Visible = false;
                this.pictureBoxEthernetDisconnection.Visible = false;
            }
            else
            {
                this.pictureBoxEthernetConnection.Visible = false;
                this.pictureBoxEthernetDisconnection.Visible = true;
            }
        }
       
        private void ClearAlarmTotalPassCount()
        {
            this.ParentForm.CurrentAlarmTotalPassCnt.Clear();
            this.UpdateAlarmTotalPassCountDisplay(this.ParentForm.CurrentAlarmTotalPassCnt);
        }
        private void UpdateDisplay(DataStore.FormMainDisplayStore displayForm)
        {
            if (displayForm == DataStore.FormMainDisplayStore.FormMainDisplayBarGraph)
            {
                #region BarGraph
                if (this.MainDisplayFeedbaack != null)
                    this.MainDisplayFeedbaack.Visible = false;

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

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
                        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;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
                        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;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
                        break;
                    case 11:
                        if (this.MainDisplayEachBarGraph11 != null)
                            this.MainDisplayEachBarGraph11.Visible = true;
                        if (this.MainDisplayDotGraph11 != null)
                            this.MainDisplayDotGraph11.Visible = false;
                        if (this.MainDisplayTable11 != null)
                            this.MainDisplayTable11.Visible = false;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
                        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;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
                        break;
                    default:
                        break;
                }
                #endregion
            }
            else if (displayForm == DataStore.FormMainDisplayStore.FormMainDisplayDotGraph)
            {
                #region DotGraph
                if (this.MainDisplayFeedbaack != null)
                    this.MainDisplayFeedbaack.Visible = false;

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

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
                        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;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
                        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;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
                        break;
                    case 11:
                        if (this.MainDisplayEachBarGraph11 != null)
                            this.MainDisplayEachBarGraph11.Visible = false;
                        if (this.MainDisplayDotGraph11 != null)
                            this.MainDisplayDotGraph11.Visible = true;
                        if (this.MainDisplayTable11 != null)
                            this.MainDisplayTable11.Visible = false;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
                        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;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
                        break;
                    default:
                        break;
                }
                #endregion
            }
            else if (displayForm == DataStore.FormMainDisplayStore.FormMainDisplayTable)
            {
                #region Table
                if (this.MainDisplayFeedbaack != null)
                    this.MainDisplayFeedbaack.Visible = false;

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

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP);
                        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;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP);
                        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;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP);
                        break;
                    case 11:
                        if (this.MainDisplayEachBarGraph11 != null)
                            this.MainDisplayEachBarGraph11.Visible = false;
                        if (this.MainDisplayDotGraph11 != null)
                            this.MainDisplayDotGraph11.Visible = false;
                        if (this.MainDisplayTable11 != null)
                            this.MainDisplayTable11.Visible = true;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP);
                        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;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP);
                        break;
                    default:
                        break;
                }
                #endregion
            }
            else if (displayForm == DataStore.FormMainDisplayStore.FormMainDisplayFeedback)
            {
                #region Feedback
                if (this.MainDisplayFeedbaack != null)
                {
                    this.MainDisplayFeedbaack.DisplayRefresh();
                    this.MainDisplayFeedbaack.Visible = true;
                }

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

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN);
                        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;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN);
                        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;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN);
                        break;
                    case 11:
                        if (this.MainDisplayEachBarGraph11 != null)
                            this.MainDisplayEachBarGraph11.Visible = false;
                        if (this.MainDisplayDotGraph11 != null)
                            this.MainDisplayDotGraph11.Visible = false;
                        if (this.MainDisplayTable11 != null)
                            this.MainDisplayTable11.Visible = false;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN);
                        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;

                        this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN);
                        break;
                    default:
                        break;
                }
                #endregion
            }
        }
        private void UpdateDisplayButton(SmartButton.BUTSTATUS buttonBar, SmartButton.BUTSTATUS buttonDot, SmartButton.BUTSTATUS buttonTable, SmartButton.BUTSTATUS buttonFeedback)
        {
            if(buttonBar == SmartButton.BUTSTATUS.DOWN)
                this.buttonBarGraphForm.ButtonDown();
            else
                this.buttonBarGraphForm.ButtonUp();

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

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

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

            // Part 11
            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.Logout, "");
        }
        public void Part11AutomaticLogoutReset()
        {
            if (this.ParentForm.SystemConfig.IsOptPart11 == 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.IsOptPart11 == 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.IsOptPart11 == 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.IsOptPart11 == 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.LanguageID.German)
                        group = "Administrator";
                    else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
                        group = "行政";
                    else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Japanese)
                        group = "管理者";
                    else
                        group = "Administrator";

                    if (this.ParentForm.SystemConfig.IsOptPart11 == 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.LanguageID.German)
                        group = "Entwickler";
                    else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
                        group = "开发商";
                    else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Japanese)
                        group = "開発者";
                    else
                        group = "Developer";

                    if (this.ParentForm.SystemConfig.IsOptPart11 == 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.LanguageID.German)
                        group = "Ausloggen";
                    else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
                        group = "登出";
                    else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Japanese)
                        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.IsOptPart11 == 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.timerTimeout.Enabled = false;
            this.labelTimeroutCount.Visible = false;

            this.ParentForm.timerTimeOutTransmission.Enabled = false;
            this.ParentForm.timerTimeOutTransmission.Interval = jItem.JudgmentDelayTime - 100;

            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(this.ParentForm.CurrentProductItem.UnderRange, this.ParentForm.SystemConfig.DecimalPlaces);
            if (this.buttonUnder.Text != value)
                this.buttonUnder.Text = value;

            value = Helper.StringToDecimalPlaces(this.ParentForm.CurrentProductItem.PassRange, this.ParentForm.SystemConfig.DecimalPlaces);
            if (this.buttonPass.Text != value)
                this.buttonPass.Text = value;

            value = Helper.StringToDecimalPlaces(this.ParentForm.CurrentProductItem.OverRange, this.ParentForm.SystemConfig.DecimalPlaces);
            if (this.buttonOver.Text != value)
                this.buttonOver.Text = value;

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

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

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

            value = jItem.RejectConveyorDelayTime.ToString();
            if (this.labelRejectConveyorDelayTime.Text != value)
                this.labelRejectConveyorDelayTime.Text = value;

            value = jItem.RejectConveyorRunTime.ToString();
            if (this.labelRejectConveyorRunTime.Text != value)
                this.labelRejectConveyorRunTime.Text = value;

            value = jItem.FeedingConveyorDelayTime.ToString();
            if (this.labelFeedingConveyorDelayTime.Text != value)
                this.labelFeedingConveyorDelayTime.Text = value;

            value = jItem.FeedingConveyorRunTime.ToString();
            if (this.labelFeedingConveyorRunTime.Text != value)
                this.labelFeedingConveyorRunTime.Text = value;

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

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

            value = jItem.DoubleDelayTime.ToString();
            if (this.labelDoubleDelayTime.Text != value)
                this.labelDoubleDelayTime.Text = value;

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

            if (this.ParentForm.SystemConfig.IsOptFeedbackBoardUse == true)
            {
                if (this.MainDisplayFeedbaack != null)
                    this.MainDisplayFeedbaack.UpdateFeedbackDisplay(this.ParentForm.CurrentFeedbackItem, this.ParentForm.SystemConfig, pItem);
            }

            // timerTimeOutTransmission 
            this.ParentForm.timerTimeOutTransmission.Interval = jItem.JudgmentDelayTime - 100;

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.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();
        }
        public void UpdateEquipmentStatusDisplay(DataStore.EquipmentStatus status)
        {
            if (status == DataStore.EquipmentStatus.Start)
            {
                #region Start
                this.pictureBoxStart.Visible = true;
                this.pictureBoxStop.Visible = false;
                this.buttonProductNo.Enabled = false;
                this.labelProductName.Enabled = false;

                // Alarm Total Pass Count
                this.ClearAlarmTotalPassCount();
                #endregion
            }
            else
            {
                #region Stop
                this.ParentForm.SaveCounterFile(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;
                #endregion
            }

            if (this.ParentForm.SystemConfig.IsOptFeedbackBoardUse == true)
            {
                if (this.MainDisplayFeedbaack != null)
                    this.MainDisplayFeedbaack.UpdateEquipmentStatusDisplay(status);
            }

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.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.IsOptFeedbackBoardUse == true)
            {
                if (this.MainDisplayFeedbaack != null)
                    this.MainDisplayFeedbaack.UpdateStopWeightDisplay(status, weightDatas);
            }

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.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 = "";

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

            if (this.ParentForm.SystemConfig.IsOptFeedbackBoardUse == true)
            {
                if (this.MainDisplayFeedbaack != null)
                    this.MainDisplayFeedbaack.UpdateStartWeightDisplay(status, weightDatas);
            }

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.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 UpdateStartWeightDisplay1(DataStore.EquipmentStatus status, WeightData weightData)
        {
            string value = "";

            value = weightData.ProductionSpeed.ToString();
            if (labelProductionSpeed.Text != value)
                this.labelProductionSpeed.Text = value;

            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateStartWeightDisplay1(status, weightData);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateStartWeightDisplay1(status, weightData);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateStartWeightDisplay1(status, weightData);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStartWeightDisplay1(status, weightData);
                    break;
                case 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.UpdateStartWeightDisplay1(status, weightData);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay1(status, weightData);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay2(DataStore.EquipmentStatus status, WeightData weightData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateStartWeightDisplay2(status, weightData);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateStartWeightDisplay2(status, weightData);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateStartWeightDisplay2(status, weightData);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStartWeightDisplay2(status, weightData);
                    break;
                case 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.UpdateStartWeightDisplay2(status, weightData);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay2(status, weightData);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay3(DataStore.EquipmentStatus status, WeightData weightData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateStartWeightDisplay3(status, weightData);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateStartWeightDisplay3(status, weightData);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateStartWeightDisplay3(status, weightData);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStartWeightDisplay3(status, weightData);
                    break;
                case 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.UpdateStartWeightDisplay3(status, weightData);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay3(status, weightData);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay4(DataStore.EquipmentStatus status, WeightData weightData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateStartWeightDisplay4(status, weightData);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateStartWeightDisplay4(status, weightData);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateStartWeightDisplay4(status, weightData);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStartWeightDisplay4(status, weightData);
                    break;
                case 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.UpdateStartWeightDisplay4(status, weightData);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay4(status, weightData);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay5(DataStore.EquipmentStatus status, WeightData weightData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateStartWeightDisplay5(status, weightData);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateStartWeightDisplay5(status, weightData);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateStartWeightDisplay5(status, weightData);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStartWeightDisplay5(status, weightData);
                    break;
                case 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.UpdateStartWeightDisplay5(status, weightData);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay5(status, weightData);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay6(DataStore.EquipmentStatus status, WeightData weightData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateStartWeightDisplay6(status, weightData);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateStartWeightDisplay6(status, weightData);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateStartWeightDisplay6(status, weightData);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateStartWeightDisplay6(status, weightData);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateStartWeightDisplay6(status, weightData);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateStartWeightDisplay6(status, weightData);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateStartWeightDisplay6(status, weightData);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStartWeightDisplay6(status, weightData);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStartWeightDisplay6(status, weightData);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStartWeightDisplay6(status, weightData);
                    break;
                case 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStartWeightDisplay6(status, weightData);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStartWeightDisplay6(status, weightData);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.UpdateStartWeightDisplay6(status, weightData);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay6(status, weightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay6(status, weightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay6(status, weightData);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay7(DataStore.EquipmentStatus status, WeightData weightData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateStartWeightDisplay7(status, weightData);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateStartWeightDisplay7(status, weightData);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateStartWeightDisplay7(status, weightData);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateStartWeightDisplay7(status, weightData);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateStartWeightDisplay7(status, weightData);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateStartWeightDisplay7(status, weightData);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateStartWeightDisplay7(status, weightData);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStartWeightDisplay7(status, weightData);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStartWeightDisplay7(status, weightData);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStartWeightDisplay7(status, weightData);
                    break;
                case 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStartWeightDisplay7(status, weightData);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStartWeightDisplay7(status, weightData);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.UpdateStartWeightDisplay7(status, weightData);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay7(status, weightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay7(status, weightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay7(status, weightData);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay8(DataStore.EquipmentStatus status, WeightData weightData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateStartWeightDisplay8(status, weightData);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 7:
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateStartWeightDisplay8(status, weightData);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateStartWeightDisplay8(status, weightData);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateStartWeightDisplay8(status, weightData);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStartWeightDisplay8(status, weightData);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStartWeightDisplay8(status, weightData);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStartWeightDisplay8(status, weightData);
                    break;
                case 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStartWeightDisplay8(status, weightData);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStartWeightDisplay8(status, weightData);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.UpdateStartWeightDisplay8(status, weightData);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay8(status, weightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay8(status, weightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay8(status, weightData);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay9(DataStore.EquipmentStatus status, WeightData weightData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateStartWeightDisplay9(status, weightData);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 8:
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStartWeightDisplay9(status, weightData);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStartWeightDisplay9(status, weightData);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStartWeightDisplay9(status, weightData);
                    break;
                case 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStartWeightDisplay9(status, weightData);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStartWeightDisplay9(status, weightData);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.UpdateStartWeightDisplay9(status, weightData);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay9(status, weightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay9(status, weightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay9(status, weightData);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay10(DataStore.EquipmentStatus status, WeightData weightData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateStartWeightDisplay10(status, weightData);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 8:
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStartWeightDisplay10(status, weightData);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStartWeightDisplay10(status, weightData);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStartWeightDisplay10(status, weightData);
                    break;
                case 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStartWeightDisplay10(status, weightData);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStartWeightDisplay10(status, weightData);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.UpdateStartWeightDisplay10(status, weightData);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay10(status, weightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay10(status, weightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay10(status, weightData);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay11(DataStore.EquipmentStatus status, WeightData weightData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateStartWeightDisplay11(status, weightData);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 8:
                    break;
                case 10:
                    break;
                case 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateStartWeightDisplay11(status, weightData);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateStartWeightDisplay11(status, weightData);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.UpdateStartWeightDisplay11(status, weightData);
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay11(status, weightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay11(status, weightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay11(status, weightData);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay12(DataStore.EquipmentStatus status, WeightData weightData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateStartWeightDisplay12(status, weightData);

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 8:
                    break;
                case 10:
                    break;
                case 11:
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.UpdateStartWeightDisplay12(status, weightData);
                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.UpdateStartWeightDisplay12(status, weightData);
                    if (this.MainDisplayTable12 != null)
                        this.MainDisplayTable12.UpdateStartWeightDisplay12(status, weightData);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateFeedbackDataDisplay1(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDataDisplay1(status, feedbackData);
        }
        public void UpdateFeedbackDataDisplay2(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDataDisplay2(status, feedbackData);
        }
        public void UpdateFeedbackDataDisplay3(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDataDisplay3(status, feedbackData);
        }
        public void UpdateFeedbackDataDisplay4(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDataDisplay4(status, feedbackData);
        }
        public void UpdateFeedbackDataDisplay5(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDataDisplay5(status, feedbackData);
        }
        public void UpdateFeedbackDataDisplay6(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDataDisplay6(status, feedbackData);
        }
        public void UpdateFeedbackDataDisplay7(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDataDisplay7(status, feedbackData);
        }
        public void UpdateFeedbackDataDisplay8(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDataDisplay8(status, feedbackData);
        }
        public void UpdateFeedbackDataDisplay9(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDataDisplay9(status, feedbackData);
        }
        public void UpdateFeedbackDataDisplay10(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDataDisplay10(status, feedbackData);
        }
        public void UpdateFeedbackDataDisplay11(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDataDisplay11(status, feedbackData);
        }
        public void UpdateFeedbackDataDisplay12(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDataDisplay12(status, feedbackData);
        }
        public void UpdateFeedbackBoardStatusDisplay(bool booting)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateBoardStatusDisplay(booting);
        }
        public void UpdateFeedbackDisplay(FeedbackConfiguration feedback, SystemConfigurationItem system, ProductItem product)
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.UpdateFeedbackDisplay(feedback, system, product);
        }
        public void UpdateAlarmMessage1Display()
        {
            if (this.panelAlarmMessageBox1.Visible == false)
                this.panelAlarmMessageBox1.Visible = true;
        }
        public void UpdateAlarmMessage3Display(bool status)
        {
            this.panelAlarmMessageBox3.Visible = status;
        }
        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 UpdateAlarmTotalPassCountDisplay(Counter cnt)
        {
            string value = "";

            value = cnt.CurrentTotalPass.ToString();
            if (this.labelATPC_counting.Text != value)
                this.labelATPC_counting.Text = value;

            value = cnt.BeforeTotalPass.ToString();
            if (this.labelATPC_Pass.Text != value)
                this.labelATPC_Pass.Text = value;

            value = cnt.BeforeLackCNT.ToString();
            if (this.labelATPC_Lack.Text != value)
                this.labelATPC_Lack.Text = value;
        }
        public void UpdateDisplayAlarmView(AlarmList alarm)
        {
            if (alarm.IsEntrySensorError == true || alarm.IsLoadcellError == true || alarm.IsEmergencyStop == true)
                this.pictureBoxAlarm.Visible = true;
            else
            {
                this.pictureBoxAlarm.Visible = false;
                this.MainDisplayAlarmList.Visible = false;
            }

            this.MainDisplayAlarmList.listBoxMessage.Items.Clear();

            if (alarm.IsEntrySensorError == true)
                this.MainDisplayAlarmList.listBoxMessage.AddItem("Entry Sensor Error");
            if (alarm.IsLoadcellError == true)
                this.MainDisplayAlarmList.listBoxMessage.AddItem("LoadCell Error");
            if (alarm.IsEmergencyStop == true)
                this.MainDisplayAlarmList.listBoxMessage.AddItem("Emergency Stop");
        }

        public void Clear()
        {
            if (this.MainDisplayFeedbaack != null)
                this.MainDisplayFeedbaack.Clear();

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.Clear();
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.Clear();
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.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;
            }

            // 연속 NG 수량 Clear
            for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
            {
                this.ParentForm.CollectionWeightData[i].ContinuousNG = 0;
                this.ParentForm.CollectionWeightData[i].IsContinuousNG = false;
            }

            // Alarm Total Pass Count
            this.ClearAlarmTotalPassCount();
        }
        public void UpdateUnderRangeChange(string weight)
        {
            string value = "";

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

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

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

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

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

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

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

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

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

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

            value = Helper.StringZeroFillDigits7(this.ParentForm.CurrentProductItem.TareRange);
            this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2005_TareRange, value);
        }

        public void RescaleControl()
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.RescaleControl();

                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.RescaleControl();
                    break;
                case 12:
                    if (this.MainDisplayEachBarGraph12 != null)
                        this.MainDisplayEachBarGraph12.RescaleControl();

                    if (this.MainDisplayDotGraph12 != null)
                        this.MainDisplayDotGraph12.RescaleControl();
                    break;
                default:
                    break;
            }
        }
        public void TimerServer(bool value)
        {
            if (value == false)
            {
                if (this.timerServer.Enabled == true)
                    this.timerServer.Enabled = false;
            }
            else
            {
                if (this.timerServer.Enabled == false)
                    this.timerServer.Enabled = true;
            }
        }
        public void SetTotalCount()
        {
            string totalCNT = "", ngCNT = "";
            int totalAll = 0, totalPass = 0, totalNG = 0, totalUnder = 0, totalOver = 0, totalExNG = 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;
                totalUnder += this.ParentForm.CollectionWeightData[i].UnderCount;
                totalOver += this.ParentForm.CollectionWeightData[i].OverCount;
                totalExNG += this.ParentForm.CollectionWeightData[i].ExNGCount;
            }

            // Total All Count
            switch (this.Mode_TotalCnt)
            {
                case DataStore.E_TotalCnt.f0_Total:
                    totalCNT = totalAll.ToString();
                    break;
                case DataStore.E_TotalCnt.f1_Pass:
                    totalCNT = totalPass.ToString();
                    break;
                default:
                    break;
            }

            if (this.labelTotalCount.Text != totalCNT)
                this.labelTotalCount.Text = totalCNT;

            // Total NG Count
            switch (this.Mode_TotalCntNG)
            {
                case DataStore.E_TotalCntNG.f0_NG:
                    ngCNT = totalNG.ToString();
                    break;
                case DataStore.E_TotalCntNG.f1_Under:
                    ngCNT = totalUnder.ToString();
                    break;
                case DataStore.E_TotalCntNG.f2_Over:
                    ngCNT = totalOver.ToString();
                    break;
                case DataStore.E_TotalCntNG.f3_ExNG:
                    ngCNT = totalExNG.ToString();
                    break;
                default:
                    break;
            }

            if (this.labelNGCount.Text != ngCNT)
                this.labelNGCount.Text = ngCNT;
        }
        public void ProductChange(int productNumber)
        {
            this.buttonProductNo.Text = "**";

            this.ParentForm.TransferProductParameter(productNumber);

            this.FlagTimeoutCount = 0;
            this.timerTimeout.Enabled = true;
        }
        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.LanguageID.Korean:
                        code = "로그인";
                        message1 = "잠시 후에 로그아웃 됩니다";
                        message2 = "";
                        break;
                    case DataStore.LanguageID.English:
                        code = "Login";
                        message1 = "You will be logged out after a while";
                        message2 = "";
                        break;
                    case DataStore.LanguageID.Chinese:
                        code = "Login";
                        message1 = "You will be logged out after a while";
                        message2 = "";
                        break;
                    case DataStore.LanguageID.Czech:
                        code = "Login";
                        message1 = "You will be logged out after a while";
                        message2 = "";
                        break;
                    case DataStore.LanguageID.German:
                        code = "Login";
                        message1 = "You will be logged out after a while";
                        message2 = "";
                        break;
                    case DataStore.LanguageID.Japanese:
                        code = "ログイン";
                        message1 = "しばらくするとログアウトします。";
                        message2 = "";
                        break;
                    default:
                        break;
                }

                warningTime = this.ParentForm.FlagAutomaticLogoutWarningTime - 2;

                this.UI_Invoke(delegate
                {
                    DialogFormMessage msg = new DialogFormMessage(DataStore.MessageBoxIcon.Asterisk, code, message1, message2, warningTime);
                    msg.ShowDialog();
                });
            }
            else
            {
                switch (this.ParentForm.SystemConfig.Language)
                {
                    case DataStore.LanguageID.Korean:
                        code = "Login";
                        message1 = "자동 로그아웃 되었습니다";
                        message2 = "";
                        break;
                    case DataStore.LanguageID.English:
                        code = "Login";
                        message1 = "Automatically logged out";
                        message2 = "";
                        break;
                    case DataStore.LanguageID.Chinese:
                        code = "Login";
                        message1 = "automatically logged out";
                        message2 = "";
                        break;
                    case DataStore.LanguageID.Czech:
                        code = "Login";
                        message1 = "automatically logged out";
                        message2 = "";
                        break;
                    case DataStore.LanguageID.German:
                        code = "Login";
                        message1 = "automatically logged out";
                        message2 = "";
                        break;
                    case DataStore.LanguageID.Japanese:
                        code = "ログイン";
                        message1 = "自動ログアウトしました。";
                        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();
                });
            }
        }
        private void SetText_TotalCount(DataStore.E_TotalCnt mode)
        {
            string txt = "";

            switch (this.ParentForm.SystemConfig.Language)
            {
                case DataStore.LanguageID.Korean:
                case DataStore.LanguageID.English:
                    switch (mode)
                    {
                        case DataStore.E_TotalCnt.f0_Total:
                            txt = "Total";
                            break;
                        case DataStore.E_TotalCnt.f1_Pass:
                            txt = "Pass";
                            break;
                        default:
                            break;
                    }
                    break;
                case DataStore.LanguageID.Chinese:
                    switch (mode)
                    {
                        case DataStore.E_TotalCnt.f0_Total:
                            txt = "总共";
                            break;
                        case DataStore.E_TotalCnt.f1_Pass:
                            txt = "排放";
                            break;
                        default:
                            break;
                    }
                    break;
                case DataStore.LanguageID.Czech:
                    switch (mode)
                    {
                        case DataStore.E_TotalCnt.f0_Total:
                            txt = "Celkem";
                            break;
                        case DataStore.E_TotalCnt.f1_Pass:
                            txt = "Váha";
                            break;
                        default:
                            break;
                    }
                    break;
                case DataStore.LanguageID.German:
                    switch (mode)
                    {
                        case DataStore.E_TotalCnt.f0_Total:
                            txt = "Insgesamt";
                            break;
                        case DataStore.E_TotalCnt.f1_Pass:
                            txt = "Bestehen";
                            break;
                        default:
                            break;
                    }
                    break;
                case DataStore.LanguageID.Japanese:
                    switch (mode)
                    {
                        case DataStore.E_TotalCnt.f0_Total:
                            txt = "総数";
                            break;
                        case DataStore.E_TotalCnt.f1_Pass:
                            txt = "基準";
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    break;
            }

            if (this.labelTitleTotalCount.Text != txt)
                this.labelTitleTotalCount.Text = txt;
        }
        private void SetText_NgCount(DataStore.E_TotalCntNG mode)
        {
            string txt = "";

            switch (this.ParentForm.SystemConfig.Language)
            {
                case DataStore.LanguageID.Korean:
                case DataStore.LanguageID.English:
                    switch (mode)
                    {
                        case DataStore.E_TotalCntNG.f0_NG:
                            txt = "NG";
                            break;
                        case DataStore.E_TotalCntNG.f1_Under:
                            txt = "Under";
                            break;
                        case DataStore.E_TotalCntNG.f2_Over:
                            txt = "Over";
                            break;
                        case DataStore.E_TotalCntNG.f3_ExNG:
                            txt = "ExNG";
                            break;
                        default:
                            break;
                    }
                    break;
                case DataStore.LanguageID.Chinese:
                    switch (mode)
                    {
                        case DataStore.E_TotalCntNG.f0_NG:
                            txt = "不良";
                            break;
                        case DataStore.E_TotalCntNG.f1_Under:
                            txt = "低于";
                            break;
                        case DataStore.E_TotalCntNG.f2_Over:
                            txt = "超过";
                            break;
                        case DataStore.E_TotalCntNG.f3_ExNG:
                            txt = "其他不良";
                            break;
                        default:
                            break;
                    }
                    break;
                case DataStore.LanguageID.Czech:
                    switch (mode)
                    {
                        case DataStore.E_TotalCntNG.f0_NG:
                            txt = "Vadný";
                            break;
                        case DataStore.E_TotalCntNG.f1_Under:
                            txt = "Min.";
                            break;
                        case DataStore.E_TotalCntNG.f2_Over:
                            txt = "Max.";
                            break;
                        case DataStore.E_TotalCntNG.f3_ExNG:
                            txt = "Jiné vadné";
                            break;
                        default:
                            break;
                    }
                    break;
                case DataStore.LanguageID.German:
                    switch (mode)
                    {
                        case DataStore.E_TotalCntNG.f0_NG:
                            txt = "Schlecht";
                            break;
                        case DataStore.E_TotalCntNG.f1_Under:
                            txt = "Min.";
                            break;
                        case DataStore.E_TotalCntNG.f2_Over:
                            txt = "Max.";
                            break;
                        case DataStore.E_TotalCntNG.f3_ExNG:
                            txt = "Andere Schlecht";
                            break;
                        default:
                            break;
                    }
                    break;
                case DataStore.LanguageID.Japanese:
                    switch (mode)
                    {
                        case DataStore.E_TotalCntNG.f0_NG:
                            txt = "不良";
                            break;
                        case DataStore.E_TotalCntNG.f1_Under:
                            txt = "下限";
                            break;
                        case DataStore.E_TotalCntNG.f2_Over:
                            txt = "上限";
                            break;
                        case DataStore.E_TotalCntNG.f3_ExNG:
                            txt = "他の不良";
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    break;
            }

            if (this.labelTitleNGCount.Text != txt)
                this.labelTitleNGCount.Text = txt;
        }

        public void DisplayRefresh()
        {
            if (this.ParentForm.EquipmentStatus == DataStore.EquipmentStatus.Stop)
            {
                this.ProductChange(this.ParentForm.SystemConfig.ProductNumber);
            }

            this.pictureBoxUSBBackOn.Visible = this.ParentForm.SystemConfig.IsDataBackup;
            this.pictureBoxBypass.Visible = this.ParentForm.SystemConfig.IsBypassMode;
            this.buttonCut.Visible = this.ParentForm.SystemConfig.IsCutView;
            this.pictureBoxEthernetConnection.Visible = this.ParentForm.SystemConfig.IsEthernetEnable;
            this.pictureBoxEthernetDisconnection.Visible = this.ParentForm.SystemConfig.IsEthernetEnable;
      
            // Alarm ContinuousNG CNT
            this.labelAlarmContinuousNG.Text = this.ParentForm.SystemConfig.AlarmContinuousNG.ToString();
            // Alarm ContinuousNG Enable
            if (this.ParentForm.SystemConfig.IsAlarmContinuousNGEnable == true)
                this.buttonAlarmContinuousNG.ButtonDown();
            else
                this.buttonAlarmContinuousNG.ButtonUp();

            // Alarm TotalCount 
            this.labelATPC_SetCNT.Text = this.ParentForm.SystemConfig.AlarmTotalPassCnt.ToString();
            // Alarm TotalCount Enable
            if (this.ParentForm.SystemConfig.IsAlarmTotalPassCntEnable == true)
                this.buttonATPC_Enable.ButtonDown();
            else
                this.buttonATPC_Enable.ButtonUp();

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

            // Sampling
            if (this.ParentForm.SystemConfig.IsSamplingView == true)
            {
                this.smartLabel3.Visible = true;
                this.buttonSampling.Visible = true;
            }
            else
            {
                this.smartLabel3.Visible = false;
                this.buttonSampling.Visible = false;
            }

            // Feedback
            this.buttonFeedback.Visible = this.ParentForm.SystemConfig.IsOptFeedbackBoardUse;

            if (this.ParentForm.SystemConfig.Serial3Mode == 5)
                this.buttonPrint.Visible = true;
            else
                this.buttonPrint.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)
            {
                if (this.ParentForm.SystemConfig.EthernetOperationMode == 2)
                    this.ParentForm.EthernetClientDisconnect();
                else
                {
                    if (this.ParentForm.smartTCPMultiServer.IsStart == false)
                        this.ParentForm.smartTCPMultiServer.Start();
                }
            }
            else
            {
                if (this.ParentForm.SystemConfig.EthernetOperationMode == 2)
                    this.ParentForm.EthernetClientDisconnect();
                else
                {
                    if (this.ParentForm.smartTCPMultiServer.IsStart == true)
                        this.ParentForm.smartTCPMultiServer.Stop();
                }
            }

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

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

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                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 11:
                    if (this.MainDisplayEachBarGraph11 != null)
                        this.MainDisplayEachBarGraph11.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayDotGraph11 != null)
                        this.MainDisplayDotGraph11.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
                    if (this.MainDisplayTable11 != null)
                        this.MainDisplayTable11.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 Override Member
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

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

        #region Event Handler
        private void pictureBoxStart_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsLogin == true)
                this.Part11AutomaticLogoutReset();

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

            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)
        {
            string before = "", after = "";

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

            before = this.buttonProductNo.Text;

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

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

                    after = myKeyPad.StringValue;

                    // Part 11
                    if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.ProductNumber, "", before, after);
                }
            }
        }
        private void buttonUnder_Click(object sender, EventArgs e)
        {
            int underRange = 0, passRange = 0, lowLimit = 0, deadZone = 0, deadZoneLow = 0;
            string value = "", before = "", after = "", number = "";

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

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

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

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

                    this.RescaleControl();

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

                    this.ParentForm.Update30000ModbusData();
                    this.ParentForm.ModbusCommonDataSend();

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

                    // Part 11
                    if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightUnderRange, number, before, after);

                    // Feedback Setting
                    underRange = int.Parse(this.ParentForm.CurrentProductItem.UnderRange);
                    passRange = int.Parse(this.ParentForm.CurrentProductItem.PassRange);
                    lowLimit = int.Parse(this.ParentForm.CurrentFeedbackItem.LowLimit);
                    deadZone = int.Parse(this.ParentForm.CurrentFeedbackItem.DeadZone);
                    deadZoneLow = passRange - deadZone;

                    if (underRange > lowLimit)
                    {
                        //this.ParentForm.CurrentFeedbackItem.LowLimit = this.ParentForm.CurrentProductItem.UnderRange;
                        if (this.ParentForm.SystemConfig.Serial3Mode == 4)
                        {
                            // 피드백 설정 확인하세요!
                            // Low Limit Range
                            DialogFormMessage myMsg = new DialogFormMessage(15, this.ParentForm.SystemConfig.Language);
                            myMsg.ShowDialog();
                        }
                    }

                    if (underRange > deadZoneLow)
                    {
                        before = Helper.StringToDecimalPlaces(this.ParentForm.CurrentFeedbackItem.DeadZone, this.ParentForm.SystemConfig.DecimalPlaces);

                        this.ParentForm.CurrentFeedbackItem.DeadZone = "0";
                        this.ParentForm.SaveFeedbackItemFile(this.ParentForm.CurrentFeedbackItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                        after = Helper.StringToDecimalPlaces(this.ParentForm.CurrentFeedbackItem.DeadZone, this.ParentForm.SystemConfig.DecimalPlaces);

                        if (this.ParentForm.SystemConfig.Serial3Mode == 4)
                        {
                            // Part 11
                            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.FB_DeadZone, number, before, after);

                            // 피드백 설정 확인하세요!
                            // DeadZone Range
                            DialogFormMessage myMsg = new DialogFormMessage(12, this.ParentForm.SystemConfig.Language);
                            myMsg.ShowDialog();
                        }
                    }

                    if (this.ParentForm.SystemConfig.Serial3Mode == 4)
                    {
                        if (this.MainDisplayFeedbaack != null)
                            this.MainDisplayFeedbaack.UpdateFeedbackDisplay(this.ParentForm.CurrentFeedbackItem, this.ParentForm.SystemConfig, this.ParentForm.CurrentProductItem);
                    }
                }
            }
        }
        private void buttonPass_Click(object sender, EventArgs e)
        {
            int passRange = 0, lowLimit = 0, highLimit = 0, deadZone = 0, deadZoneLow = 0, deadZoneHigh = 0;
            string value = "", before = "", after = "", number = "";

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

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

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

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

                    this.RescaleControl();

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

                    this.ParentForm.Update30000ModbusData();
                    this.ParentForm.ModbusCommonDataSend();

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

                    // Part 11
                    if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightPassRange, number, before, after);

                    // Feedback Setting
                    passRange = int.Parse(this.ParentForm.CurrentProductItem.PassRange);
                    lowLimit = int.Parse(this.ParentForm.CurrentFeedbackItem.LowLimit);
                    highLimit = int.Parse(this.ParentForm.CurrentFeedbackItem.HighLimit);
                    deadZone = int.Parse(this.ParentForm.CurrentFeedbackItem.DeadZone);
                    deadZoneLow = passRange - deadZone;
                    deadZoneHigh = passRange + deadZone;

                    if (deadZoneLow < lowLimit)
                    {
                        before = Helper.StringToDecimalPlaces(this.ParentForm.CurrentFeedbackItem.DeadZone, this.ParentForm.SystemConfig.DecimalPlaces);
                        
                        this.ParentForm.CurrentFeedbackItem.DeadZone = "0";
                        this.ParentForm.SaveFeedbackItemFile(this.ParentForm.CurrentFeedbackItem, this.ParentForm.SystemConfig.ProductNumber - 1);
                        
                        after = Helper.StringToDecimalPlaces(this.ParentForm.CurrentFeedbackItem.DeadZone, this.ParentForm.SystemConfig.DecimalPlaces);

                        if (this.ParentForm.SystemConfig.Serial3Mode == 4)
                        {
                            // Part 11
                            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.FB_DeadZone, number, before, after);

                            // 피드백 설정 확인하세요!
                            // DeadZone Range
                            DialogFormMessage myMsg = new DialogFormMessage(12, this.ParentForm.SystemConfig.Language);
                            myMsg.ShowDialog();
                        }
                    }

                    if (passRange < lowLimit)
                    {
                        before = Helper.StringToDecimalPlaces(this.ParentForm.CurrentFeedbackItem.LowLimit, this.ParentForm.SystemConfig.DecimalPlaces);

                        this.ParentForm.CurrentFeedbackItem.LowLimit = this.ParentForm.CurrentProductItem.UnderRange;
                        this.ParentForm.SaveFeedbackItemFile(this.ParentForm.CurrentFeedbackItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                        after = Helper.StringToDecimalPlaces(this.ParentForm.CurrentFeedbackItem.LowLimit, this.ParentForm.SystemConfig.DecimalPlaces);

                        if (this.ParentForm.SystemConfig.Serial3Mode == 4)
                        {
                            // Part 11
                            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.FB_LowLimit, number, before, after);

                            // 피드백 설정 확인하세요!
                            // Low Limit Range
                            DialogFormMessage myMsg = new DialogFormMessage(15, this.ParentForm.SystemConfig.Language);
                            myMsg.ShowDialog();
                        }
                    }

                    if (deadZoneHigh > highLimit)
                    {
                        before = Helper.StringToDecimalPlaces(this.ParentForm.CurrentFeedbackItem.DeadZone, this.ParentForm.SystemConfig.DecimalPlaces);

                        this.ParentForm.CurrentFeedbackItem.DeadZone = "0";
                        this.ParentForm.SaveFeedbackItemFile(this.ParentForm.CurrentFeedbackItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                        after = Helper.StringToDecimalPlaces(this.ParentForm.CurrentFeedbackItem.DeadZone, this.ParentForm.SystemConfig.DecimalPlaces);

                        if (this.ParentForm.SystemConfig.Serial3Mode == 4)
                        {
                            // Part 11
                            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.FB_DeadZone, number, before, after);

                            // 피드백 설정 확인하세요!
                            // DeadZone Range
                            DialogFormMessage myMsg = new DialogFormMessage(12, this.ParentForm.SystemConfig.Language);
                            myMsg.ShowDialog();
                        }
                    }

                    if (passRange > highLimit)
                    {
                        before = Helper.StringToDecimalPlaces(this.ParentForm.CurrentFeedbackItem.HighLimit, this.ParentForm.SystemConfig.DecimalPlaces);

                        this.ParentForm.CurrentFeedbackItem.HighLimit = this.ParentForm.CurrentProductItem.OverRange;
                        this.ParentForm.SaveFeedbackItemFile(this.ParentForm.CurrentFeedbackItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                        after = Helper.StringToDecimalPlaces(this.ParentForm.CurrentFeedbackItem.HighLimit, this.ParentForm.SystemConfig.DecimalPlaces);

                        if (this.ParentForm.SystemConfig.Serial3Mode == 4)
                        {
                            // Part 11
                            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.FB_HightLimit, number, before, after);

                            // 피드백 설정 확인하세요!
                            // High Limit Range
                            DialogFormMessage myMsg = new DialogFormMessage(14, this.ParentForm.SystemConfig.Language);
                            myMsg.ShowDialog();
                        }
                    }

                    if (this.ParentForm.SystemConfig.Serial3Mode == 4)
                    {
                        if (this.MainDisplayFeedbaack != null)
                            this.MainDisplayFeedbaack.UpdateFeedbackDisplay(this.ParentForm.CurrentFeedbackItem, this.ParentForm.SystemConfig, this.ParentForm.CurrentProductItem);
                    }
                }
            }
        }
        private void buttonOver_Click(object sender, EventArgs e)
        {
            int overRange = 0, passRange = 0, highLimit = 0, deadZone = 0, deadZoneHigh = 0;
            string value = "", before = "", after = "", number = "";

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

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

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

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

                    this.RescaleControl();

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

                    this.ParentForm.Update30000ModbusData();
                    this.ParentForm.ModbusCommonDataSend();

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

                    // Part 11
                    if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightOverRange, number, before, after);

                    // Feedback Setting
                    overRange = int.Parse(this.ParentForm.CurrentProductItem.OverRange);
                    passRange = int.Parse(this.ParentForm.CurrentProductItem.PassRange);
                    highLimit = int.Parse(this.ParentForm.CurrentFeedbackItem.HighLimit);
                    deadZone = int.Parse(this.ParentForm.CurrentFeedbackItem.DeadZone);
                    deadZoneHigh = passRange + deadZone;

                    if (overRange < highLimit)
                    {
                        //this.ParentForm.CurrentFeedbackItem.HighLimit = this.ParentForm.CurrentProductItem.OverRange;

                        if (this.ParentForm.SystemConfig.Serial3Mode == 4)
                        {
                            // 피드백 설정 확인하세요!
                            // High Limit Range
                            DialogFormMessage myMsg = new DialogFormMessage(14, this.ParentForm.SystemConfig.Language);
                            myMsg.ShowDialog();
                        }
                    }

                    if (overRange < deadZoneHigh)
                    {
                        before = Helper.StringToDecimalPlaces(this.ParentForm.CurrentFeedbackItem.DeadZone, this.ParentForm.SystemConfig.DecimalPlaces);

                        this.ParentForm.CurrentFeedbackItem.DeadZone = "0";
                        this.ParentForm.SaveFeedbackItemFile(this.ParentForm.CurrentFeedbackItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                        after = Helper.StringToDecimalPlaces(this.ParentForm.CurrentFeedbackItem.DeadZone, this.ParentForm.SystemConfig.DecimalPlaces);

                        if (this.ParentForm.SystemConfig.Serial3Mode == 4)
                        {
                            // Part 11
                            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.FB_DeadZone, number, before, after);

                            // 피드백 설정 확인하세요!
                            // DeadZone Range
                            DialogFormMessage myMsg = new DialogFormMessage(12, this.ParentForm.SystemConfig.Language);
                            myMsg.ShowDialog();
                        }
                    }

                    if (this.ParentForm.SystemConfig.Serial3Mode == 4)
                    {
                        if (this.MainDisplayFeedbaack != null)
                            this.MainDisplayFeedbaack.UpdateFeedbackDisplay(this.ParentForm.CurrentFeedbackItem, this.ParentForm.SystemConfig, this.ParentForm.CurrentProductItem);
                    }
                }
            }
        }
        private void buttonTare_Click(object sender, EventArgs e)
        {
            string value = "", before = "", after = "", number = "";

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

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

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

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

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

                    this.ParentForm.Update30000ModbusData();
                    this.ParentForm.ModbusCommonDataSend();

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

                    // Part 11
                    if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.WeightTareRange, number, before, after);

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

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

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

                this.ParentForm.ChildFormMenu.DisplayRefresh();
                ((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMenu);
            }
            else
            {
                // Automatic Logout Reset
                if (this.ParentForm.SystemConfig.IsLogin == 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.IsLogin == 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.IsLogin == true)
                this.Part11AutomaticLogoutReset();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        // Part11
                        if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.BP_NgOFF, "");
                    }
                }
            }
        }
        private void buttonSubMenu_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsLogin == 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.panelSubMenu1.Visible = false;

                this.panelSubMenu2.BringToFront();
                this.panelSubMenu2.Visible = true;

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

                this.SubmenuIndex = 0;
            }
        }

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

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

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

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorterDelayTime.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.labelSorterDelayTime.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentJudgmentSetItem.Sorter1DelayTime = myKeyPad.IntValue;
                    after = this.labelSorterDelayTime.Text;

                    value = Helper.StringZeroFillDigits4(this.labelSorterDelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5102_Sorter1DelayTime, value);
                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if(this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.SorterDelayTime, number, before, after);
                }
            }
        }
        private void labelSorterRunTime_Click(object sender, EventArgs e)
        {
            string value = "", before = "", after = "", number = "";

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

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

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorterRunTime.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.labelSorterRunTime.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentJudgmentSetItem.Sorter1RunTime = myKeyPad.IntValue;
                    after = this.labelSorterRunTime.Text;

                    value = Helper.StringZeroFillDigits4(this.labelSorterRunTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5103_Sorter1RunTime, value);
                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

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

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

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

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

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelRejectConveyorDelayTime.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.labelRejectConveyorDelayTime.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentJudgmentSetItem.RejectConveyorDelayTime = myKeyPad.IntValue;
                    after = this.labelRejectConveyorDelayTime.Text;

                    value = Helper.StringZeroFillDigits4(this.labelRejectConveyorDelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5009_DischargeConveyorDelayTime, value);
                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.RejectCVDelayTime, number, before, after);
                }
            }
        }
        private void labelRejectConveyorRunTime_Click(object sender, EventArgs e)
        {
            string value = "", before = "", after = "", number = "";

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

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

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelRejectConveyorRunTime.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.labelRejectConveyorRunTime.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentJudgmentSetItem.RejectConveyorRunTime = myKeyPad.IntValue;
                    after = this.labelRejectConveyorRunTime.Text;

                    value = Helper.StringZeroFillDigits4(this.labelRejectConveyorRunTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5010_DischargeConveyorRunTime, value);
                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.RejectCVRunTime, number, before, after);
                }
            }
        }
        private void labelFeedingConveyorDelayTime_Click(object sender, EventArgs e)
        {
            string value = "", before = "", after = "", number = "";

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

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

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelFeedingConveyorDelayTime.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.labelFeedingConveyorDelayTime.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentJudgmentSetItem.FeedingConveyorDelayTime = myKeyPad.IntValue;
                    after = this.labelFeedingConveyorDelayTime.Text;

                    value = Helper.StringZeroFillDigits4(this.labelFeedingConveyorDelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5007_FeedingConveyorDelayTime, value);
                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.FeedingCVDelayTime, number, before, after);
                }
            }
        }
        private void labelFeedingConveyorRunTime_Click(object sender, EventArgs e)
        {
            string value = "", before = "", after = "", number = "";

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

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

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelFeedingConveyorRunTime.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.labelFeedingConveyorRunTime.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentJudgmentSetItem.FeedingConveyorRunTime = myKeyPad.IntValue;
                    after = this.labelFeedingConveyorRunTime.Text;

                    value = Helper.StringZeroFillDigits4(this.labelFeedingConveyorRunTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5008_FeedingConveyorRunTime, value);
                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

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

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

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

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

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

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

                    value = Helper.StringZeroFillDigits4(this.labelFilter.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5001_Filter, value);
                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.JudgmentFilter, number, before, after);
                }
            }
        }
        private void labelJudgmentDelayTime_Click(object sender, EventArgs e)
        {
            string value = "", before = "", after = "", number = "";

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

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

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelJudgmentDelayTime.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.labelJudgmentDelayTime.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime = myKeyPad.IntValue;
                    after = this.labelJudgmentDelayTime.Text;

                    value = Helper.StringZeroFillDigits4(this.labelJudgmentDelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5002_JudgmentDelayTime, value);
                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.JudgmentDelayTime, number, before, after);
                }
            }
        }
        private void labelDoubleDelayTime_Click(object sender, EventArgs e)
        {
            string value = "", before = "", after = "", number = "";

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

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

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelDoubleDelayTime.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.labelDoubleDelayTime.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentJudgmentSetItem.DoubleDelayTime = myKeyPad.IntValue;
                    after = this.labelDoubleDelayTime.Text;

                    value = Helper.StringZeroFillDigits4(this.labelDoubleDelayTime.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5003_DoubleDelayTime, value);
                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

                    // Part11
                    if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.JudgmentDoubleDelayTime, number, before, after);
                }
            }
        }
        private void labelJudgmentCount_Click(object sender, EventArgs e)
        {
            string value = "", before = "", after = "", number = "";

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

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

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

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

                    value = Helper.StringZeroFillDigits4(this.labelJudgmentCount.Text);
                    this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress._5004_JudgmentCount, value);
                    this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CurrentJudgmentSetItem, this.ParentForm.SystemConfig.ProductNumber - 1);

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

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

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

            before = this.labelAlarmContinuousNG.Text;

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelAlarmContinuousNG.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.labelAlarmContinuousNG.Text = myKeyPad.StringValue;
                    after = this.labelAlarmContinuousNG.Text;

                    // 연속 NG 수량 Clear
                    for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
                    {
                        this.ParentForm.CollectionWeightData[i].ContinuousNG = 0;
                        this.ParentForm.CollectionWeightData[i].IsContinuousNG = false;
                    }

                    this.ParentForm.SystemConfig.AlarmContinuousNG = myKeyPad.IntValue;
                    this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig);

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

            switch (this.Mode_TotalCnt)
            {
                case DataStore.E_TotalCnt.f0_Total:
                    this.Mode_TotalCnt = DataStore.E_TotalCnt.f1_Pass;
                    break;
                case DataStore.E_TotalCnt.f1_Pass:
                    this.Mode_TotalCnt = DataStore.E_TotalCnt.f0_Total;
                    break;
                default:
                    this.Mode_TotalCnt = DataStore.E_TotalCnt.f0_Total;
                    break;
            }

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

            switch (this.Mode_TotalCntNG)
            {
                case DataStore.E_TotalCntNG.f0_NG:
                    this.Mode_TotalCntNG = DataStore.E_TotalCntNG.f1_Under;
                    break;
                case DataStore.E_TotalCntNG.f1_Under:
                    this.Mode_TotalCntNG = DataStore.E_TotalCntNG.f2_Over;
                    break;
                case DataStore.E_TotalCntNG.f2_Over:
                    this.Mode_TotalCntNG = DataStore.E_TotalCntNG.f3_ExNG;
                    break;
                case DataStore.E_TotalCntNG.f3_ExNG:
                    this.Mode_TotalCntNG = DataStore.E_TotalCntNG.f0_NG;
                    break;
                default:
                    this.Mode_TotalCntNG = DataStore.E_TotalCntNG.f0_NG;
                    break;
            }

            this.SetText_NgCount(this.Mode_TotalCntNG);
            this.SetTotalCount();
        }

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

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

            before = this.labelATPC_SetCNT.Text;

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

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

                    this.ParentForm.SystemConfig.AlarmTotalPassCnt = myKeyPad.IntValue;
                    this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig);
                    this.ClearAlarmTotalPassCount();

                    // Part11
                    if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.ATPC_Count, "", before, after);
                }
            }
        }
        private void buttonAlarmTotalCount_Click(object sender, EventArgs e)
        {
            string before = "", after = "";

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

            if (this.buttonATPC_Enable.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                this.ParentForm.SystemConfig.IsAlarmTotalPassCntEnable = true;
                
                before = "OFF";
                after = "ON";
            }
            else
            {
                this.ParentForm.SystemConfig.IsAlarmTotalPassCntEnable = false;

                before = "ON";
                after = "OFF";
            }

            this.ClearAlarmTotalPassCount();
            this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig);

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

            // Clear Alarm Total Pass Count
            this.ClearAlarmTotalPassCount();

            // Part11
            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.ATPC_Reset, "");
        }
        private void buttonATPC_Reset_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsLogin == true)
                this.Part11AutomaticLogoutReset();

            // Clear Alarm Total Pass Count
            this.ClearAlarmTotalPassCount();

            // Part11
            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.ATPC_Reset, "");
        }

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

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

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

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

            this.panelAlarmMessageBox3.Visible = false;
        }
        private void buttonUp_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsLogin == true)
                this.Part11AutomaticLogoutReset();
        }
        private void buttonDown_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsLogin == true)
                this.Part11AutomaticLogoutReset();
        }
        private void buttonCut_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsLogin == true)
                this.Part11AutomaticLogoutReset();

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

            // Part11
            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.MainCut, "");
        }
        private void buttonPrint_Click(object sender, EventArgs e)
        {
            string before = "", after = "";

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

            if (this.buttonPrint.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                this.ParentForm.SystemConfig.IsPrintPerProductEnable = true;
                this.ParentForm.SerialCH3PrinterHeadLine();

                before = "OFF";
                after = "ON";
            }
            else
            {
                this.ParentForm.SystemConfig.IsPrintPerProductEnable = false;
                this.ParentForm.smartSerialPortCom3.WriteNoneFrame("\n\n\n\n", SmartSerialPort.CODETYPES.ASCIICODE);

                before = "OFF";
                after = "ON";
            }

            // Part11
            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.PrintActivate, "", before, after);
        }
        private void buttonAlarmContinuousNG_Click(object sender, EventArgs e)
        {
            string before = "", after = "";

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

            if (this.buttonAlarmContinuousNG.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                this.ParentForm.SystemConfig.IsAlarmContinuousNGEnable = true;
                before = "OFF";
                after = "ON";
            }
            else
            {
                this.ParentForm.SystemConfig.IsAlarmContinuousNGEnable = false;
                before = "ON";
                after = "OFF";
            }

            this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig);

            // Part11
            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.ACNC_Activate, "", before, after);
        }

        private void timerTimeout_Tick(object sender, EventArgs e)
        {
            this.labelTimeroutCount.Visible = true;
            this.labelTimeroutCount.Text = this.FlagTimeoutCount.ToString();
            this.ParentForm.TransferProductParameter(this.ParentForm.SystemConfig.ProductNumber);

            this.FlagTimeoutCount++;
        }
        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);
                }
            }
        }

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

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

            // Part11
            if (this.ParentForm.SystemConfig.IsOptPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.Sampling, "");
        }
        #endregion

        private void buttonExit_Click(object sender, EventArgs e)
        {
            this.ParentForm.Dispose();
            this.ParentForm.Close();
        }

        private void smartForm1_Click(object sender, EventArgs e)
        {

        }
    }
}