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 INT69DB_2A_ImageDll;
using INT69DB_2A.Controls;
using INT69DB_2A.DialogForms;
using INT69DB_2A.Part11_UserManager;
using System.Text.RegularExpressions;

namespace INT69DB_2A.Forms
{
    public partial class FormMainDisplay : Form
    {
        #region Field
        public string ChangeID;
        private int SubmenuIndex;
        private bool IsCutOnce = true;     // SubMenu3

        private FormMain m_ParentForm;

        private Color ColorButtonAccessTrue;
        private Color ColorButtonAccessFalse;

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

        private ControlMainDisplayAlarm MainDisplayAlarmList;

        private ControlMainDisplayDotGraph2 MainDisplayDotGraph2;
        private ControlMainDisplayDotGraph3 MainDisplayDotGraph3;
        private ControlMainDisplayDotGraph4 MainDisplayDotGraph4;
        private ControlMainDisplayDotGraph5 MainDisplayDotGraph5;
        private ControlMainDisplayDotGraph6 MainDisplayDotGraph6;
        private ControlMainDisplayDotGraph7 MainDisplayDotGraph7;
        private ControlMainDisplayDotGraph8 MainDisplayDotGraph8;
        private ControlMainDisplayDotGraph10 MainDisplayDotGraph10;

        private ControlMainDisplayEachBarGraph2 MainDisplayEachBarGraph2;
        private ControlMainDisplayEachBarGraph3 MainDisplayEachBarGraph3;
        private ControlMainDisplayEachBarGraph4 MainDisplayEachBarGraph4;
        private ControlMainDisplayEachBarGraph5 MainDisplayEachBarGraph5;
        private ControlMainDisplayEachBarGraph6 MainDisplayEachBarGraph6;
        private ControlMainDisplayEachBarGraph7 MainDisplayEachBarGraph7;
        private ControlMainDisplayEachBarGraph8 MainDisplayEachBarGraph8;
        private ControlMainDisplayEachBarGraph10 MainDisplayEachBarGraph10;

        private ControlMainDisplayTable2 MainDisplayTable2;
        private ControlMainDisplayTable3 MainDisplayTable3;
        private ControlMainDisplayTable4 MainDisplayTable4;
        private ControlMainDisplayTable5 MainDisplayTable5;
        private ControlMainDisplayTable6 MainDisplayTable6;
        private ControlMainDisplayTable7 MainDisplayTable7;
        private ControlMainDisplayTable8 MainDisplayTable8;
        private ControlMainDisplayTable10 MainDisplayTable10;
        #endregion

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

            this.ParentForm = parent;

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

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

        #region Method
        /// <summary>
        /// 언어별 화면 디자인
        /// </summary>
        private void InitializeDesign()
        {
            ImageDll images = new ImageDll();

            if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Korean)
            {
                #region Korean
                if (this.ParentForm.SystemConfig.IsLogin == false)
                {
                    this.buttonMenu.Location = new Point(597, 545);

                    this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korFormMainDisplayMenuBigDisable));
                    this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korFormMainDisplayMenuBigDown));
                    this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korFormMainDisplayMenuBigUp));
                } 
                #endregion
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.English)
            {
                #region English
                this.groupBoxSorter.Text = "Sorter settings";
                this.labelStaticSorterDelayTime.Text = "Delay";
                this.labelStaticSorterRunTime.Text = "Run";

                this.groupBoxConveyor.Text = "Conveyor settings";
                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.labelStaticAlarmContinuousNG.Text = "Continuous NG";
                this.labelMessage1.Text = "Alarm - Double Entry";
                this.labelMessage3.Text = "Continuous NG Occurs!";
                this.labelMessage4.Text = "Entry sensor error";               

                this.labelStaticATPC.Text = "Pass alarm";
                this.labelStaticATPC_Count.Text = "Count";
                this.labelStaticATPC_Pass.Text = "Pass";
                this.labelStaticATPC_Lack.Text = "Lack";
                this.buttonATPC_Reset.Text = "RST";

                this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engBypassCountDown));
                this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engBypassCountUp));

                this.buttonUser.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainDisplayLoginDisable));
                this.buttonUser.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainDisplayLogoutUp));
                this.buttonUser.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainDisplayLoginUp));

                if (this.ParentForm.SystemConfig.IsLogin == false)
                {
                    this.buttonMenu.Location = new Point(597, 545);

                    this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainDisplayMenuBigDisable));
                    this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainDisplayMenuBigDown));
                    this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainDisplayMenuBigUp));
                }
                else
                {
                    this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainDisplayMenuDisable));
                    this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainDisplayMenuDown));
                    this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMainDisplayMenuUp));
                }

                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.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.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)); 
                #endregion
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
            {
                #region Chinese
                //this.labelScreen.Text = "屏幕";

                this.labelTitleTotalCount.Text = "总共";
                this.labelTitleNGCount.Text = "不良";
                this.smartLabel5.Text = "速度";
                this.labelTitleBypass.Text = "旁路";

                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.labelStaticAlarmContinuousNG.Text = "连续不好";
                this.labelMessage1.Text = "报警 - 双倍";
                this.labelMessage3.Text = "连续出现 NG!";
                this.labelMessage4.Text = "入口感應器錯誤";               

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

                this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBypassCountDown));
                this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBypassCountUp));
                this.buttonBypassDirection.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBypassOccasionDown));
                this.buttonBypassDirection.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBypassOccasionUp));

                this.buttonUser.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainDisplayLoginDisable));
                this.buttonUser.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainDisplayLogoutUp));
                this.buttonUser.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainDisplayLoginUp));

                if (this.ParentForm.SystemConfig.IsLogin == false)
                {
                    this.buttonMenu.Location = new Point(597, 545);

                    this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainDisplayMenuBigDisable));
                    this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainDisplayMenuBigDown));
                    this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainDisplayMenuBigUp));
                }
                else
                {
                    this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainDisplayMenuDisable));
                    this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainDisplayMenuDown));
                    this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMainDisplayMenuUp));
                }

                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.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.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)); 
                #endregion
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Japanese)
            {
                #region Japanese
                this.labelTitleTotalCount.Text = "計量";
                this.labelTitleNGCount.Text = "不良";
                this.smartLabel5.Text = "速度";

                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.labelStaticAlarmContinuousNG.Text = "連続NG";
                this.labelMessage1.Text = "アラㅡム - ダブル";
                this.labelMessage3.Text = "連続NG発生！";
                this.labelMessage4.Text = "エントリㅡセンサㅡエラㅡ";

                this.labelStaticATPC.Text = "定量アラㅡム";
                this.labelStaticATPC_Count.Text = "数量";
                this.labelStaticATPC_Pass.Text = "合格";
                this.labelStaticATPC_Lack.Text = "部族";
                this.buttonATPC_Reset.Text = "RST";

                this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnBypassCountDown));
                this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnBypassCountUp));

                this.buttonUser.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainDisplayLoginDisable));
                this.buttonUser.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainDisplayLogoutUp));
                this.buttonUser.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainDisplayLoginUp));

                if (this.ParentForm.SystemConfig.IsLogin == false)
                {
                    this.buttonMenu.Location = new Point(597, 545);

                    this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainDisplayMenuBigDisable));
                    this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainDisplayMenuBigDown));
                    this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainDisplayMenuBigUp));
                }
                else
                {
                    this.buttonMenu.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainDisplayMenuDisable));
                    this.buttonMenu.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainDisplayMenuDown));
                    this.buttonMenu.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFormMainDisplayMenuUp));
                }

                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.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.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));
                #endregion
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech)
            {

            }
            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";
            this.pictureBoxUSBBackOn.Visible = this.ParentForm.SystemConfig.IsDataBackup;
            this.labelIconBypassMode.Visible = this.ParentForm.SystemConfig.IsBypassMode;

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

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

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

            this.Mode_TotalCnt = DataStore.E_TotalCnt.f0_Total;
            this.Mode_TotalCntNG = DataStore.E_TotalCntNG.f0_NG;

            // SubMenu3
            this.labelCutInterval.Text = "1200";
            this.smartTimerCut.Interval = 1200;

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

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    this.MainDisplayEachBarGraph2 = new ControlMainDisplayEachBarGraph2(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph2);
                    this.MainDisplayEachBarGraph2.BringToFront();
                    this.MainDisplayEachBarGraph2.Location = new Point(0, 63);
                    this.MainDisplay = DataStore.MainDisplayStore.BarGraph;

                    this.MainDisplayDotGraph2 = new ControlMainDisplayDotGraph2(this);
                    this.Controls.Add(this.MainDisplayDotGraph2);
                    this.MainDisplayDotGraph2.BringToFront();
                    this.MainDisplayDotGraph2.Location = new Point(0, 63);

                    this.MainDisplayTable2 = new ControlMainDisplayTable2(this);
                    this.Controls.Add(this.MainDisplayTable2);
                    this.MainDisplayTable2.BringToFront();
                    this.MainDisplayTable2.Location = new Point(0, 63);
                    break;
                case 3:
                    this.MainDisplayEachBarGraph3 = new ControlMainDisplayEachBarGraph3(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph3);
                    this.MainDisplayEachBarGraph3.BringToFront();
                    this.MainDisplayEachBarGraph3.Location = new Point(0, 63);
                    this.MainDisplay = DataStore.MainDisplayStore.BarGraph;

                    this.MainDisplayDotGraph3 = new ControlMainDisplayDotGraph3(this);
                    this.Controls.Add(this.MainDisplayDotGraph3);
                    this.MainDisplayDotGraph3.BringToFront();
                    this.MainDisplayDotGraph3.Location = new Point(0, 63);

                    this.MainDisplayTable3 = new ControlMainDisplayTable3(this);
                    this.Controls.Add(this.MainDisplayTable3);
                    this.MainDisplayTable3.BringToFront();
                    this.MainDisplayTable3.Location = new Point(0, 63);
                    break;
                case 4:
                    this.MainDisplayEachBarGraph4 = new ControlMainDisplayEachBarGraph4(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph4);
                    this.MainDisplayEachBarGraph4.BringToFront();
                    this.MainDisplayEachBarGraph4.Location = new Point(0, 63);
                    this.MainDisplay = DataStore.MainDisplayStore.BarGraph;

                    this.MainDisplayDotGraph4 = new ControlMainDisplayDotGraph4(this);
                    this.Controls.Add(this.MainDisplayDotGraph4);
                    this.MainDisplayDotGraph4.BringToFront();
                    this.MainDisplayDotGraph4.Location = new Point(0, 63);

                    this.MainDisplayTable4 = new ControlMainDisplayTable4(this);
                    this.Controls.Add(this.MainDisplayTable4);
                    this.MainDisplayTable4.BringToFront();
                    this.MainDisplayTable4.Location = new Point(0, 63);
                    break;
                case 5:
                    this.MainDisplayEachBarGraph5 = new ControlMainDisplayEachBarGraph5(this);
                    this.Controls.Add(this.MainDisplayEachBarGraph5);
                    this.MainDisplayEachBarGraph5.BringToFront();
                    this.MainDisplayEachBarGraph5.Location = new Point(0, 63);
                    this.MainDisplay = DataStore.MainDisplayStore.BarGraph;

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

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

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

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

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

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

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

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

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

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

            this.SubmenuIndex = 0;

            this.RescaleControl();
            this.ChangeID = "";

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

            // Panel Setting
            this.panelSetting.Location = new Point(60, 91);
            this.panelSetting.Visible = false;

            // Panel SubMenu1
            this.panelSubMenu1.Location = new Point(10, 489);
            this.panelSubMenu1.Visible = false;
            this.panelSubMenu1.BringToFront();

            // Panel SubMenu2
            this.panelSubMenu2.Location = new Point(10, 489);
            this.panelSubMenu2.Visible = false;
            this.panelSubMenu2.BringToFront();

            // Panel SubMenu3
            this.panelSubMenu3.Location = new Point(10, 489);
            this.panelSubMenu3.Visible = false;
            this.panelSubMenu3.BringToFront();

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

            this.panelAlarmMessageBox3.Location = new Point(x, y);
            this.panelAlarmMessageBox3.Visible = false;
            this.panelAlarmMessageBox3.BringToFront();

            this.panelAlarmMessageBox4.Location = new Point(x, y);
            this.panelAlarmMessageBox4.Visible = false;
            this.panelAlarmMessageBox4.BringToFront();

            this.groupBoxSorter.Visible = false;

            this.groupBoxConveyor.Location = new Point(this.groupBoxSorter.Location.X, this.groupBoxSorter.Location.Y);
            this.groupBoxConveyor.Visible = true;

            if (this.ParentForm.SystemConfig.IsDischargeConveyor == false)
            {
                this.labelDischargeConveyorDelayTime.Enabled = false;
                this.labelDischargeConveyorOperatingTime.Enabled = false;
                this.labelStaticRejectConveyorDelayTime.ForeColor = Color.Gray;
                this.labelStaticRejectConveyorRunTime.ForeColor = Color.Gray;
                this.labelDischargeConveyorDelayTime.ForeColor = Color.Gray;
                this.labelDischargeConveyorOperatingTime.ForeColor = Color.Gray;
            }

            if (this.ParentForm.SystemConfig.IsFeedingConveyor == false)
            {
                this.labelFeedingConveyorDelayTime.Enabled = false;
                this.labelFeedingConveyorOperatingTime.Enabled = false;
                this.labelStaticFeedingDelayTime.ForeColor = Color.Gray;
                this.labelStaticFeedingRunTime.ForeColor = Color.Gray;
                this.labelFeedingConveyorDelayTime.ForeColor = Color.Gray;
                this.labelFeedingConveyorOperatingTime.ForeColor = Color.Gray;
            }

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

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

                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.password_expire_date.GetDateTime(), "yyyyMMddHHmmss", null);
                this.ParentForm.SystemConfig.CurrentUser.DatePasswordExpire = time;
                time = DateTime.ParseExact(userInfo.id_expire_date.GetDateTime(), "yyyyMMddHHmmss", null);
                this.ParentForm.SystemConfig.CurrentUser.DateIdExpire = time;

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

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

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

                this.UI_Invoke(delegate
                {
                    this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
                });
            }
        }
        private void Login()
        {
            DialogResult result;

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

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

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

            // Part 11
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.Logout, "");
        }
        public void Part11AutomaticLogoutReset()
        {
            UserManager.UserManager_AutoLogoutTimeoutReset();
        }
        public string DisplayExpireOfPassword(DataStore.UserGroup group)
        {
            string ret = "";

            if (group == DataStore.UserGroup.Admin || group == DataStore.UserGroup.Developer)
                ret = "-";
            else
            {
                //TimeSpan resultTime = DateTime.Now - this.ParentForm.CurrentSystemStatus.CurrentUser.DateExpireRegister;
                TimeSpan dayDiff = DateTime.Now.Date - this.ParentForm.SystemConfig.CurrentUser.DatePasswordExpire.Date;
                ret = dayDiff.Days.ToString();
            }

            return ret;
        }

        private void ClearAlarmTotalPassCount()
        {
            this.ParentForm.CurrentAlarmTotalPassCnt.Clear();
            this.UpdateAlarmTotalPassCountDisplay(this.ParentForm.CurrentAlarmTotalPassCnt);
        }
        private void UpdateDisplay(DataStore.MainDisplayStore displayForm)
        {
            if (displayForm == DataStore.MainDisplayStore.BarGraph)
            {
                #region BarGraph
                switch (this.ParentForm.SystemConfig.EquipmentColumns)
                {
                    case 2:
                        if (this.MainDisplayEachBarGraph2 != null)
                            this.MainDisplayEachBarGraph2.Visible = true;
                        if (this.MainDisplayDotGraph2 != null)
                            this.MainDisplayDotGraph2.Visible = false;
                        if (this.MainDisplayTable2 != null)
                            this.MainDisplayTable2.Visible = false;
                        break;
                    case 3:
                        if (this.MainDisplayEachBarGraph3 != null)
                            this.MainDisplayEachBarGraph3.Visible = true;
                        if (this.MainDisplayDotGraph3 != null)
                            this.MainDisplayDotGraph3.Visible = false;
                        if (this.MainDisplayTable3 != null)
                            this.MainDisplayTable3.Visible = false;
                        break;
                    case 4:
                        if (this.MainDisplayEachBarGraph4 != null)
                            this.MainDisplayEachBarGraph4.Visible = true;
                        if (this.MainDisplayDotGraph4 != null)
                            this.MainDisplayDotGraph4.Visible = false;
                        if (this.MainDisplayTable4 != null)
                            this.MainDisplayTable4.Visible = false;
                        break;
                    case 5:
                        if (this.MainDisplayEachBarGraph5 != null)
                            this.MainDisplayEachBarGraph5.Visible = true;
                        if (this.MainDisplayDotGraph5 != null)
                            this.MainDisplayDotGraph5.Visible = false;
                        if (this.MainDisplayTable5 != null)
                            this.MainDisplayTable5.Visible = false;
                        break;
                    case 6:
                        if (this.MainDisplayEachBarGraph6 != null)
                            this.MainDisplayEachBarGraph6.Visible = true;
                        if (this.MainDisplayDotGraph6 != null)
                            this.MainDisplayDotGraph6.Visible = false;
                        if (this.MainDisplayTable6 != null)
                            this.MainDisplayTable6.Visible = false;
                        break;
                    case 7:
                        if (this.MainDisplayEachBarGraph7 != null)
                            this.MainDisplayEachBarGraph7.Visible = true;
                        if (this.MainDisplayDotGraph7 != null)
                            this.MainDisplayDotGraph7.Visible = false;
                        if (this.MainDisplayTable7 != null)
                            this.MainDisplayTable7.Visible = false;
                        break;
                    case 8:
                        if (this.MainDisplayEachBarGraph8 != null)
                            this.MainDisplayEachBarGraph8.Visible = true;
                        if (this.MainDisplayDotGraph8 != null)
                            this.MainDisplayDotGraph8.Visible = false;
                        if (this.MainDisplayTable8 != null)
                            this.MainDisplayTable8.Visible = false;
                        break;
                    case 10:
                        if (this.MainDisplayEachBarGraph10 != null)
                            this.MainDisplayEachBarGraph10.Visible = true;
                        if (this.MainDisplayDotGraph10 != null)
                            this.MainDisplayDotGraph10.Visible = false;
                        if (this.MainDisplayTable10 != null)
                            this.MainDisplayTable10.Visible = false;
                        break;
                    default:
                        break;
                }
                this.UpdateDisplayButton(SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP);
                #endregion
            }
            else if (displayForm == DataStore.MainDisplayStore.DotGraph)
            {
                #region DotGraph
                switch (this.ParentForm.SystemConfig.EquipmentColumns)
                {
                    case 2:
                        if (this.MainDisplayEachBarGraph2 != null)
                            this.MainDisplayEachBarGraph2.Visible = false;
                        if (this.MainDisplayDotGraph2 != null)
                            this.MainDisplayDotGraph2.Visible = true;
                        if (this.MainDisplayTable2 != null)
                            this.MainDisplayTable2.Visible = false;
                        break;
                    case 3:
                        if (this.MainDisplayEachBarGraph3 != null)
                            this.MainDisplayEachBarGraph3.Visible = false;
                        if (this.MainDisplayDotGraph3 != null)
                            this.MainDisplayDotGraph3.Visible = true;
                        if (this.MainDisplayTable3 != null)
                            this.MainDisplayTable3.Visible = false;
                        break;
                    case 4:
                        if (this.MainDisplayEachBarGraph4 != null)
                            this.MainDisplayEachBarGraph4.Visible = false;
                        if (this.MainDisplayDotGraph4 != null)
                            this.MainDisplayDotGraph4.Visible = true;
                        if (this.MainDisplayTable4 != null)
                            this.MainDisplayTable4.Visible = false;
                        break;
                    case 5:
                        if (this.MainDisplayEachBarGraph5 != null)
                            this.MainDisplayEachBarGraph5.Visible = false;
                        if (this.MainDisplayDotGraph5 != null)
                            this.MainDisplayDotGraph5.Visible = true;
                        if (this.MainDisplayTable5 != null)
                            this.MainDisplayTable5.Visible = false;
                        break;
                    case 6:
                        if (this.MainDisplayEachBarGraph6 != null)
                            this.MainDisplayEachBarGraph6.Visible = false;
                        if (this.MainDisplayDotGraph6 != null)
                            this.MainDisplayDotGraph6.Visible = true;
                        if (this.MainDisplayTable6 != null)
                            this.MainDisplayTable6.Visible = false;
                        break;
                    case 7:
                        if (this.MainDisplayEachBarGraph7 != null)
                            this.MainDisplayEachBarGraph7.Visible = false;
                        if (this.MainDisplayDotGraph7 != null)
                            this.MainDisplayDotGraph7.Visible = true;
                        if (this.MainDisplayTable7 != null)
                            this.MainDisplayTable7.Visible = false;
                        break;
                    case 8:
                        if (this.MainDisplayEachBarGraph8 != null)
                            this.MainDisplayEachBarGraph8.Visible = false;
                        if (this.MainDisplayDotGraph8 != null)
                            this.MainDisplayDotGraph8.Visible = true;
                        if (this.MainDisplayTable8 != null)
                            this.MainDisplayTable8.Visible = false;
                        break;
                    case 10:
                        if (this.MainDisplayEachBarGraph10 != null)
                            this.MainDisplayEachBarGraph10.Visible = false;
                        if (this.MainDisplayDotGraph10 != null)
                            this.MainDisplayDotGraph10.Visible = true;
                        if (this.MainDisplayTable10 != null)
                            this.MainDisplayTable10.Visible = false;
                        break;
                    default:
                        break;
                }
                this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN, SmartButton.BUTSTATUS.UP);
                #endregion
            }
            else if (displayForm == DataStore.MainDisplayStore.Table)
            {
                #region Table
                switch (this.ParentForm.SystemConfig.EquipmentColumns)
                {
                    case 2:
                        if (this.MainDisplayEachBarGraph2 != null)
                            this.MainDisplayEachBarGraph2.Visible = false;
                        if (this.MainDisplayDotGraph2 != null)
                            this.MainDisplayDotGraph2.Visible = false;
                        if (this.MainDisplayTable2 != null)
                            this.MainDisplayTable2.Visible = true;
                        break;
                    case 3:
                        if (this.MainDisplayEachBarGraph3 != null)
                            this.MainDisplayEachBarGraph3.Visible = false;
                        if (this.MainDisplayDotGraph3 != null)
                            this.MainDisplayDotGraph3.Visible = false;
                        if (this.MainDisplayTable3 != null)
                            this.MainDisplayTable3.Visible = true;
                        break;
                    case 4:
                        if (this.MainDisplayEachBarGraph4 != null)
                            this.MainDisplayEachBarGraph4.Visible = false;
                        if (this.MainDisplayDotGraph4 != null)
                            this.MainDisplayDotGraph4.Visible = false;
                        if (this.MainDisplayTable4 != null)
                            this.MainDisplayTable4.Visible = true;
                        break;
                    case 5:
                        if (this.MainDisplayEachBarGraph5 != null)
                            this.MainDisplayEachBarGraph5.Visible = false;
                        if (this.MainDisplayDotGraph5 != null)
                            this.MainDisplayDotGraph5.Visible = false;
                        if (this.MainDisplayTable5 != null)
                            this.MainDisplayTable5.Visible = true;
                        break;
                    case 6:
                        if (this.MainDisplayEachBarGraph6 != null)
                            this.MainDisplayEachBarGraph6.Visible = false;
                        if (this.MainDisplayDotGraph6 != null)
                            this.MainDisplayDotGraph6.Visible = false;
                        if (this.MainDisplayTable6 != null)
                            this.MainDisplayTable6.Visible = true;
                        break;
                    case 7:
                        if (this.MainDisplayEachBarGraph7 != null)
                            this.MainDisplayEachBarGraph7.Visible = false;
                        if (this.MainDisplayDotGraph7 != null)
                            this.MainDisplayDotGraph7.Visible = false;
                        if (this.MainDisplayTable7 != null)
                            this.MainDisplayTable7.Visible = true;
                        break;
                    case 8:
                        if (this.MainDisplayEachBarGraph8 != null)
                            this.MainDisplayEachBarGraph8.Visible = false;
                        if (this.MainDisplayDotGraph8 != null)
                            this.MainDisplayDotGraph8.Visible = false;
                        if (this.MainDisplayTable8 != null)
                            this.MainDisplayTable8.Visible = true;
                        break;
                    case 10:
                        if (this.MainDisplayEachBarGraph10 != null)
                            this.MainDisplayEachBarGraph10.Visible = false;
                        if (this.MainDisplayDotGraph10 != null)
                            this.MainDisplayDotGraph10.Visible = false;
                        if (this.MainDisplayTable10 != null)
                            this.MainDisplayTable10.Visible = true;
                        break;
                    default:
                        break;
                }
                this.UpdateDisplayButton(SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.UP, SmartButton.BUTSTATUS.DOWN);
                #endregion
            }
        }
        private void UpdateDisplayButton(SmartButton.BUTSTATUS buttonBar, SmartButton.BUTSTATUS buttonDot, SmartButton.BUTSTATUS buttonTable)
        {
            if (buttonBar == SmartButton.BUTSTATUS.DOWN)
                this.buttonBarGraphForm.ButtonDown();
            else
                this.buttonBarGraphForm.ButtonUp();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    this.buttonMenu.Enabled = true;
                    break;
                case DataStore.UserGroup.Admin:
                    id = user.ID;
                    if (this.ParentForm.SystemConfig.Language == DataStore.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 if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Russian)
                        group = "Администратор";
                    else
                        group = "Administrator";

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

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

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

                    this.buttonMenu.Enabled = true;
                    break;
                case DataStore.UserGroup.Developer:
                    id = user.ID;
                    if (this.ParentForm.SystemConfig.Language == DataStore.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 if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Russian)
                        group = "Разработчик";
                    else
                        group = "Developer";

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

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

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

                    this.buttonMenu.Enabled = true;
                    break;
                case DataStore.UserGroup.NotLogin:
                    id = "";
                    group = "";
                    
                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
                        this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;

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

                    this.buttonMenu.Enabled = true;
                    break;
                case DataStore.UserGroup.LogOut:
                    id = "";
                    if (this.ParentForm.SystemConfig.Language == DataStore.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 if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Russian)
                        group = "Выйти.";
                    else
                        group = "Log out";

                    this.labelExpireOfPassword.Visible = false;

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

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

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

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

            if (this.labelUserLevel.Text != group)
                this.labelUserLevel.Text = group;
            if (this.labelUserID.Text != id)
                this.labelUserID.Text = id;
            if (this.labelExpireOfPassword.ForeColor != colorExpirePW)
                this.labelExpireOfPassword.ForeColor = colorExpirePW;
            if (this.labelExpireOfPassword.Text != expirePW)
                this.labelExpireOfPassword.Text = expirePW;
        }
        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;
            }

        }
        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()
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplayEachBarGraph2 != null)
                        this.MainDisplayEachBarGraph2.Clear();
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.Clear();
                    if (this.MainDisplayTable2 != null)
                        this.MainDisplayTable2.Clear();
                    break;
                case 3:
                    if (this.MainDisplayEachBarGraph3 != null)
                        this.MainDisplayEachBarGraph3.Clear();
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.Clear();
                    if (this.MainDisplayTable3 != null)
                        this.MainDisplayTable3.Clear();
                    break;
                case 4:
                    if (this.MainDisplayEachBarGraph4 != null)
                        this.MainDisplayEachBarGraph4.Clear();
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.Clear();
                    if (this.MainDisplayTable4 != null)
                        this.MainDisplayTable4.Clear();
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.Clear();
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.Clear();
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.Clear();
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.Clear();
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.Clear();
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.Clear();
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.Clear();
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.Clear();
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.Clear();
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.Clear();
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.Clear();
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.Clear();
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.Clear();
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.Clear();
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.Clear();
                    break;
                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 RescaleControl()
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplayEachBarGraph2 != null)
                        this.MainDisplayEachBarGraph2.RescaleControl();

                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.RescaleControl();
                    break;
                case 3:
                    if (this.MainDisplayEachBarGraph3 != null)
                        this.MainDisplayEachBarGraph3.RescaleControl();

                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.RescaleControl();
                    break;
                case 4:
                    if (this.MainDisplayEachBarGraph4 != null)
                        this.MainDisplayEachBarGraph4.RescaleControl();

                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.RescaleControl();
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.RescaleControl();

                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.RescaleControl();
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.RescaleControl();

                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.RescaleControl();
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.RescaleControl();

                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.RescaleControl();
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.RescaleControl();

                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.RescaleControl();
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.RescaleControl();

                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.RescaleControl();
                    break;
                default:
                    break;
            }
        }
        public void ProductChange(int productNumber)
        {
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.ProductNumber, "",
                this.ParentForm.SystemConfig.ProductNumber.ToString(), productNumber.ToString());

            this.buttonProductNo.Text = "**";

            this.ParentForm.TransferProductParameter(productNumber);
        }
        public void IconEthernetVisible(bool enable)
        {
            this.pictureBoxEthernetConnection.Visible = enable;
            this.pictureBoxEthernetDisconnection.Visible = enable;
        }
        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 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.Japanese:
                        code = "ログイン";
                        message1 = "しばらくするとログアウトします。";
                        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;
                    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.Japanese:
                        code = "ログイン";
                        message1 = "自動ログアウトしました。";
                        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;
                    default:
                        break;
                }

                // User Logout
                UserManager.UserManager_UserLogout();

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

                this.UI_Invoke(delegate
                {
                    DialogFormMessage msg = new DialogFormMessage(DataStore.MessageBoxIcon.Asterisk, code, message1, message2, 0);
                    msg.ShowDialog();
                });
            }
        }
        public void CallBackUserListModifyInfoDataEvent(UserManager.UserMgr_user_info_t userInfo)
        {
            //Console.WriteLine("status : " + userInfo.status.ToString());
            //Console.WriteLine("ID : " + userInfo.user_id);
            //Console.WriteLine("pass : " + userInfo.user_pw);
            if (userInfo.status == 0)
            {
                //Console.WriteLine("Group : " + this.ParentForm.SystemConfig.CurrentUser.Group.ToString());
                if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.LogOut)
                {
                    //Console.WriteLine("DirectLogin");
                    this.DirectLogin(userInfo.user_id, userInfo.user_pw);
                }
                else
                {
                    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;

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

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

            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.labelDischargeConveyorDelayTime.Text != value)
                this.labelDischargeConveyorDelayTime.Text = value;

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

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

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

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

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplayEachBarGraph2 != null)
                        this.MainDisplayEachBarGraph2.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable2 != null)
                        this.MainDisplayTable2.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 3:
                    if (this.MainDisplayEachBarGraph3 != null)
                        this.MainDisplayEachBarGraph3.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable3 != null)
                        this.MainDisplayTable3.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 4:
                    if (this.MainDisplayEachBarGraph4 != null)
                        this.MainDisplayEachBarGraph4.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable4 != null)
                        this.MainDisplayTable4.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateCurrentProductDisplay(status, weightDatas);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateCurrentProductDisplay(status, weightDatas);
                    break;
                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;
                #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;

                this.smartTimerCut.Stop();
                this.buttonCutRun.ButtonUp();
                #endregion
            }

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplayEachBarGraph2 != null)
                        this.MainDisplayEachBarGraph2.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable2 != null)
                        this.MainDisplayTable2.UpdateEquipmentStatusDisplay(status);
                    break;
                case 3:
                    if (this.MainDisplayEachBarGraph3 != null)
                        this.MainDisplayEachBarGraph3.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable3 != null)
                        this.MainDisplayTable3.UpdateEquipmentStatusDisplay(status);
                    break;
                case 4:
                    if (this.MainDisplayEachBarGraph4 != null)
                        this.MainDisplayEachBarGraph4.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable4 != null)
                        this.MainDisplayTable4.UpdateEquipmentStatusDisplay(status);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateEquipmentStatusDisplay(status);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateEquipmentStatusDisplay(status);
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateEquipmentStatusDisplay(status);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateEquipmentStatusDisplay(status);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateEquipmentStatusDisplay(status);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateEquipmentStatusDisplay(status);
                    break;
                default:
                    break;
            }
        }
        public void UpdateStopWeightDisplay(DataStore.EquipmentStatus status, Collection<WeightData> weightDatas)
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplayEachBarGraph2 != null)
                        this.MainDisplayEachBarGraph2.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable2 != null)
                        this.MainDisplayTable2.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 3:
                    if (this.MainDisplayEachBarGraph3 != null)
                        this.MainDisplayEachBarGraph3.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable3 != null)
                        this.MainDisplayTable3.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 4:
                    if (this.MainDisplayEachBarGraph4 != null)
                        this.MainDisplayEachBarGraph4.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable4 != null)
                        this.MainDisplayTable4.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStopWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStopWeightDisplay(status, weightDatas);
                    break;
                default:
                    break;
            }
        }
        public void UpdateStartWeightDisplay(DataStore.EquipmentStatus status, Collection<WeightData> weightDatas)
        {
            string value = "";

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

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplayEachBarGraph2 != null)
                        this.MainDisplayEachBarGraph2.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable2 != null)
                        this.MainDisplayTable2.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 3:
                    if (this.MainDisplayEachBarGraph3 != null)
                        this.MainDisplayEachBarGraph3.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable3 != null)
                        this.MainDisplayTable3.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 4:
                    if (this.MainDisplayEachBarGraph4 != null)
                        this.MainDisplayEachBarGraph4.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable4 != null)
                        this.MainDisplayTable4.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 7:
                    if (this.MainDisplayEachBarGraph7 != null)
                        this.MainDisplayEachBarGraph7.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph7 != null)
                        this.MainDisplayDotGraph7.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable7 != null)
                        this.MainDisplayTable7.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 8:
                    if (this.MainDisplayEachBarGraph8 != null)
                        this.MainDisplayEachBarGraph8.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph8 != null)
                        this.MainDisplayDotGraph8.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable8 != null)
                        this.MainDisplayTable8.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                case 10:
                    if (this.MainDisplayEachBarGraph10 != null)
                        this.MainDisplayEachBarGraph10.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayDotGraph10 != null)
                        this.MainDisplayDotGraph10.UpdateStartWeightDisplay(status, weightDatas);
                    if (this.MainDisplayTable10 != null)
                        this.MainDisplayTable10.UpdateStartWeightDisplay(status, weightDatas);
                    break;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay1(DataStore.EquipmentStatus status, WeightData weightData)
        {
            string value = "";

            if (this.ParentForm.SystemConfig.EquipmentMode == 2)
            {
                value = weightData.ProductionSpeed.ToString();
                if (this.labelProductionSpeed.Text != value)
                    this.labelProductionSpeed.Text = value;
            }

            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplayEachBarGraph2 != null)
                        this.MainDisplayEachBarGraph2.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayTable2 != null)
                        this.MainDisplayTable2.UpdateStartWeightDisplay1(status, weightData);
                    break;
                case 3:
                    if (this.MainDisplayEachBarGraph3 != null)
                        this.MainDisplayEachBarGraph3.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayTable3 != null)
                        this.MainDisplayTable3.UpdateStartWeightDisplay1(status, weightData);
                    break;
                case 4:
                    if (this.MainDisplayEachBarGraph4 != null)
                        this.MainDisplayEachBarGraph4.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayTable4 != null)
                        this.MainDisplayTable4.UpdateStartWeightDisplay1(status, weightData);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateStartWeightDisplay1(status, weightData);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateStartWeightDisplay1(status, weightData);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateStartWeightDisplay1(status, weightData);
                    break;
                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;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay2(DataStore.EquipmentStatus status, WeightData weightData)
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    if (this.MainDisplayEachBarGraph2 != null)
                        this.MainDisplayEachBarGraph2.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayDotGraph2 != null)
                        this.MainDisplayDotGraph2.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayTable2 != null)
                        this.MainDisplayTable2.UpdateStartWeightDisplay2(status, weightData);
                    break;
                case 3:
                    if (this.MainDisplayEachBarGraph3 != null)
                        this.MainDisplayEachBarGraph3.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayTable3 != null)
                        this.MainDisplayTable3.UpdateStartWeightDisplay2(status, weightData);
                    break;
                case 4:
                    if (this.MainDisplayEachBarGraph4 != null)
                        this.MainDisplayEachBarGraph4.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayTable4 != null)
                        this.MainDisplayTable4.UpdateStartWeightDisplay2(status, weightData);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateStartWeightDisplay2(status, weightData);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateStartWeightDisplay2(status, weightData);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateStartWeightDisplay2(status, weightData);
                    break;
                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;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay3(DataStore.EquipmentStatus status, WeightData weightData)
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    break;
                case 3:
                    if (this.MainDisplayEachBarGraph3 != null)
                        this.MainDisplayEachBarGraph3.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayDotGraph3 != null)
                        this.MainDisplayDotGraph3.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayTable3 != null)
                        this.MainDisplayTable3.UpdateStartWeightDisplay3(status, weightData);
                    break;
                case 4:
                    if (this.MainDisplayEachBarGraph4 != null)
                        this.MainDisplayEachBarGraph4.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayTable4 != null)
                        this.MainDisplayTable4.UpdateStartWeightDisplay3(status, weightData);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateStartWeightDisplay3(status, weightData);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateStartWeightDisplay3(status, weightData);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateStartWeightDisplay3(status, weightData);
                    break;
                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;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay4(DataStore.EquipmentStatus status, WeightData weightData)
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    if (this.MainDisplayEachBarGraph4 != null)
                        this.MainDisplayEachBarGraph4.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayDotGraph4 != null)
                        this.MainDisplayDotGraph4.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayTable4 != null)
                        this.MainDisplayTable4.UpdateStartWeightDisplay4(status, weightData);
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateStartWeightDisplay4(status, weightData);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateStartWeightDisplay4(status, weightData);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateStartWeightDisplay4(status, weightData);
                    break;
                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;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay5(DataStore.EquipmentStatus status, WeightData weightData)
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;
                case 5:
                    if (this.MainDisplayEachBarGraph5 != null)
                        this.MainDisplayEachBarGraph5.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayDotGraph5 != null)
                        this.MainDisplayDotGraph5.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayTable5 != null)
                        this.MainDisplayTable5.UpdateStartWeightDisplay5(status, weightData);
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateStartWeightDisplay5(status, weightData);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateStartWeightDisplay5(status, weightData);
                    break;
                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;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay6(DataStore.EquipmentStatus status, WeightData weightData)
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;
                case 5:
                    break;
                case 6:
                    if (this.MainDisplayEachBarGraph6 != null)
                        this.MainDisplayEachBarGraph6.UpdateStartWeightDisplay6(status, weightData);
                    if (this.MainDisplayDotGraph6 != null)
                        this.MainDisplayDotGraph6.UpdateStartWeightDisplay6(status, weightData);
                    if (this.MainDisplayTable6 != null)
                        this.MainDisplayTable6.UpdateStartWeightDisplay6(status, weightData);
                    break;
                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;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay7(DataStore.EquipmentStatus status, WeightData weightData)
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;
                case 5:
                    break;
                case 6:
                    break;
                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;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay8(DataStore.EquipmentStatus status, WeightData weightData)
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;
                case 5:
                    break;
                case 6:
                    break;
                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;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay9(DataStore.EquipmentStatus status, WeightData weightData)
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;
                case 5:
                    break;
                case 6:
                    break;
                case 7:
                    break;
                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;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateStartWeightDisplay10(DataStore.EquipmentStatus status, WeightData weightData)
        {
            switch (this.ParentForm.SystemConfig.EquipmentColumns)
            {
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;
                case 5:
                    break;
                case 6:
                    break;
                case 7:
                    break;
                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;
                default:
                    break;
            }

            this.SetTotalCount();
        }
        public void UpdateAlarmMessage1Display()
        {
            if (this.panelAlarmMessageBox1.Visible == false)
                this.panelAlarmMessageBox1.Visible = true;
        }
        public void UpdateAlarmMessage3Display(bool status)
        {
            this.panelAlarmMessageBox3.Visible = status;
        }
        public void UpdateAlarmMessage4Display(bool status)
        {
            this.panelAlarmMessageBox4.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;

                if (this.ParentForm.SystemConfig.EthernetOperationMode == 1) // 중량선별기 : Server
                    this.ParentForm.TimerPingEnabled(2000, true);

                //// 로그
                //if (this.ParentForm.IsCommunicationLogOpen == true)
                //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("Connection icon ({0:yyyy-MM-dd HH:mm:ss})", DateTime.Now));
            }
            else
            {
                this.pictureBoxEthernetConnection.Visible = false;
                this.pictureBoxEthernetDisconnection.Visible = true;

                if (this.ParentForm.SystemConfig.EthernetOperationMode == 1) // 중량선별기 : Server
                    this.ParentForm.TimerPingEnabled(false);

                //// 로그
                //if (this.ParentForm.IsCommunicationLogOpen == true)
                //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("Disconnection icon ({0:yyyy-MM-dd HH:mm:ss})", DateTime.Now));
            }
        }
        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;
        }
        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.Japanese:
                    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;
                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.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;
                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;
                default:
                    break;
            }

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

        public void DisplayRefresh()
        {
            this.ParentForm.SystemConfig.CurrentForm = DataStore.FormStore.FormMainDisplay;

            if (this.ParentForm.EquipmentStatus == DataStore.EquipmentStatus.Stop)
            {
                this.buttonProductNo.Text = "**";
                // 전체 파라미터 메인보드 Write
                this.ParentForm.TransferProductParameter(this.ParentForm.SystemConfig.ProductNumber); 
            }

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

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

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

            this.IconEthernetVisible(this.ParentForm.SystemConfig.IsEthernetEnable);

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

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

            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();
            
            this.labelIconBypassMode.Visible = this.ParentForm.SystemConfig.IsBypassMode;
            this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
            this.buttonSubMenu.ButtonUp();
            this.panelSubMenu1.Visible = false;
        }
        #endregion

        #region Event Handler
        private void pictureBoxStart_Click(object sender, EventArgs e)
        {

        }
        private void pictureBoxStop_Click(object sender, EventArgs e)
        {

        }

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

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

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 1000)
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.ProductChange(myKeyPad.IntValue);
                }
            }
        }
        private void buttonUnder_Click(object sender, EventArgs e)
        {
            string before = "", after = "";
            string value = "";
            
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            before = this.buttonUnder.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonUnder.Text, 5, this.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.SystemConfig.Language);
            myKeyPad.Location = new Point(270, 70);

            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(".", "");
                    after = this.buttonUnder.Text = myKeyPad.StringValue;

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

                    // FeedBack Range Setting
                    this.ParentForm.CurrentFeedBackRangeItem.SetRange(int.Parse(this.ParentForm.CurrentProductItem.OverRange),
                        int.Parse(this.ParentForm.CurrentProductItem.PassRange), int.Parse(this.ParentForm.CurrentProductItem.UnderRange));

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

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

            before = this.buttonPass.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonPass.Text, 5, this.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.SystemConfig.Language);
            myKeyPad.Location = new Point(270, 70);

            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(".", "");
                    after = this.buttonPass.Text = myKeyPad.StringValue;

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

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

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

            before = this.buttonOver.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonOver.Text, 5, this.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.SystemConfig.Language);
            myKeyPad.Location = new Point(270, 70);

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

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

                    // FeedBack Range Setting
                    this.ParentForm.CurrentFeedBackRangeItem.SetRange(int.Parse(this.ParentForm.CurrentProductItem.OverRange),
                        int.Parse(this.ParentForm.CurrentProductItem.PassRange), int.Parse(this.ParentForm.CurrentProductItem.UnderRange));

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

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

            before = this.buttonTare.Text;
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonTare.Text, 5, this.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.SystemConfig.Language);
            myKeyPad.Location = new Point(270, 70);

            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(".", "");
                    after = this.buttonTare.Text = myKeyPad.StringValue;

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

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

            this.ParentForm.TransferData(CommunicationCommand.Zero, CommunicationID.SubBoardAll);
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.Zero, "");
        }
        private void buttonClear_Click(object sender, EventArgs e)
        { 
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            DialogFormYesNo myDlg = new DialogFormYesNo(this.ParentForm.SystemConfig.Language, 8);
            if (myDlg.ShowDialog() == DialogResult.Yes)
            {
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.Clear, "");
                this.Clear();
            }
        }
        private void buttonMenu_Click(object sender, EventArgs e)
        {
            if (this.ParentForm.EquipmentStatus == DataStore.EquipmentStatus.Stop)
            {
                // Automatic Logout Pause
                if (this.ParentForm.SystemConfig.IsPart11 == true)
                    UserManager.UserManager_AutoLogoutTimeoutPause();

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

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

            SmartButton button = sender as SmartButton;

            if (button == null)
                return;

            if (button == this.buttonBarGraphForm)
                this.MainDisplay = DataStore.MainDisplayStore.BarGraph;
            else if (button == this.buttonDotGraphForm)
                this.MainDisplay = DataStore.MainDisplayStore.DotGraph;
            else if (button == this.buttonTableForm)
                this.MainDisplay = DataStore.MainDisplayStore.Table;
            else
                this.MainDisplay = DataStore.MainDisplayStore.BarGraph;

            this.UpdateDisplay(this.MainDisplay);
        }
        private void buttonUser_Click(object sender, EventArgs e)
        {
            // 인테크 : Intech / I20090810!
            // 관리자 : admin00 / admin12!

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

            if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.LogOut)
            {
                this.Login();
            }
            else
            {
                DialogFormYesNo msg = new DialogFormYesNo(this.ParentForm.SystemConfig.Language, 12);
                if (msg.ShowDialog() == DialogResult.Yes)
                {
                    this.Logout();
                }
            }
        }

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

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

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

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

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

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

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

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

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

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

                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.SorterRunTime, "", before, after);
                }
            }
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.FeedingCVRunTime, "", before, after);
                }
            }
        }
        private void labelTotalCount_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == 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 labelNGCount_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == 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 buttonClose_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            this.panelSetting.Visible = false;
        }

        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 buttonSubMenu_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

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

                this.panelSubMenu2.Visible = false;
                this.panelSubMenu3.Visible = false;
                this.SubmenuIndex = 1;
            }
            else if (this.SubmenuIndex == 1)
            {
                this.panelSubMenu1.Visible = false;
                this.panelSubMenu3.Visible = false;

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

                if (this.ParentForm.SystemConfig.IsCutView == true)
                    this.SubmenuIndex = 2;
                else
                    this.SubmenuIndex = 3;
            }
            else if (this.SubmenuIndex == 2)
            {
                this.panelSubMenu1.Visible = false;
                this.panelSubMenu2.Visible = false;

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

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

                this.SubmenuIndex = 0;
            }
        }

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

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

            if (this.buttonBypassOnce.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                this.ParentForm.SystemConfig.IsBypassOnce = false;
                this.buttonBypassRun.Mode = SmartButton.BUTTONMODE.PUSH;
            }
            else
            {
                this.ParentForm.SystemConfig.IsBypassOnce = true;
                this.buttonBypassRun.Mode = SmartButton.BUTTONMODE.NORMAL;
            }
        }
        private void buttonBypassRun_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            if (this.ParentForm.SystemConfig.IsBypassOnce == true)
            {
                if (this.ParentForm.SystemConfig.IsBypassDirectionPass == true)
                {
                    this.ParentForm.TransferData(CommunicationCommand.BypassOnce, CommunicationID.MainBoard);
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.BP_PassOnce, "");
                }
                else
                {
                    this.ParentForm.TransferData(CommunicationCommand.ByNGOnce, CommunicationID.MainBoard);
                    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);
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.BP_PassON, "");
                    }
                    else
                    {
                        this.ParentForm.TransferData(CommunicationCommand.ByNGON, CommunicationID.MainBoard);
                        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);
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.BP_PassOFF, "");
                    }
                    else
                    {
                        this.ParentForm.TransferData(CommunicationCommand.ByNGOFF, CommunicationID.MainBoard);
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.BP_NgOFF, "");
                    }
                }
            }
        }

        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.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.ACNC_Activate, "", 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.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.ACNC_Count, "", before, after);
                }
            }
        }

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

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

                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.Print, "ON");
            }
            else
            {
                this.ParentForm.SystemConfig.IsPrintPerProductEnable = false;
                this.ParentForm.smartSerialPortCom3.WriteNoneFrame("\n\n\n\n", SmartSerialPort.CODETYPES.ASCIICODE);

                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.Print, "OFF");
            }
        }
        #endregion

        #region SubMenu2
        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.IsPart11 == 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.IsPart11 == 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.IsPart11 == 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.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.ATPC_Reset, "");
        } 
        #endregion

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

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

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.doubleValue < 500 || myKeyPad.doubleValue > 9999)
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.labelCutInterval.Text = myKeyPad.StringValue;
                    this.smartTimerCut.Interval = myKeyPad.IntValue;
                }
            }
        }
        private void buttonCutOnce_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            if (this.buttonCutOnce.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                this.IsCutOnce = false;
                this.buttonCutRun.Mode = SmartButton.BUTTONMODE.PUSH;
            }
            else
            {
                this.IsCutOnce = true;
                this.buttonCutRun.Mode = SmartButton.BUTTONMODE.NORMAL;
            }
        }
        private void buttonCutRun_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.Part11AutomaticLogoutReset();

            if (this.IsCutOnce == true)
            {
                this.ParentForm.TransferData(CommunicationCommand.CutInput, CommunicationID.MainBoard);

                if (this.ParentForm.SystemConfig.IsPart11 == true)
                    this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.MainCut, "");
            }
            else
            {
                if (this.buttonCutRun.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    this.labelCutInterval.Enabled = false;
                    this.buttonCutOnce.Enabled = false;
                    this.smartTimerCut.Start();
                }
                else
                {
                    this.labelCutInterval.Enabled = true;
                    this.buttonCutOnce.Enabled = true;
                    this.smartTimerCut.Stop();
                }
            }
        }
        private void smartTimerCut_Tick(object sender, EventArgs e)
        {
            this.ParentForm.TransferData(CommunicationCommand.CutInput, CommunicationID.MainBoard);

            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.MainCut, "");
        }
        #endregion

        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 buttonAlarm1Ok_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsLogin == true)
                this.Part11AutomaticLogoutReset();

            this.panelAlarmMessageBox1.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 buttonAlarm4OK_Click(object sender, EventArgs e)
        {
            // Automatic Logout Reset
            if (this.ParentForm.SystemConfig.IsLogin == true)
                this.Part11AutomaticLogoutReset();

            this.panelAlarmMessageBox4.Visible = false;
        }
        #endregion
    }
}