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.Windows.Forms;

using SmartX;
using INT99DC_7C.DialogForms;
using INT99DC_ImageDll;

namespace INT99DC_7C.Forms
{
    public partial class FormConfiguration : Form
    {
        #region Field
        private FormMain m_ParentForm;

        private Collection<SmartLabel> CollectionTitleZERO;
        private Collection<SmartLabel> CollectionTitleCAL;
        private Collection<SmartLabel> CollectionTitleJUDG;
        private Collection<SmartLabel> CollectionZeroParameterRangeLabel;
        private Collection<SmartLabel> CollectionZeroParameterTimeLabel;
        private Collection<SmartLabel> CollectionZeroParameterVariateLabel;
        private Collection<SmartLabel> CollectionMaxWeightLabel;
        private Collection<SmartLabel> CollectionBalanceWeightLabel;
        private Collection<SmartLabel> CollectionDigitLabel;
        private Collection<SmartLabel> CollectionFilterLabel;
        private Collection<SmartLabel> CollectionBypassLabel;
        private Collection<SmartButton> CollectionBypassButton;
        #endregion

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

            this.ParentForm = parent;

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

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

        #region Method
        private void InitializeDesign()
        {
            ImageDll images = new ImageDll();

            if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Korean)
            {

            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.English)
            {
                #region English
                this.labelTitle.Text = "Configuration";

                this.groupBoxAutoZero.Text = "Auto zero";
                this.labelStaticTime.Text = "Time";
                this.labelStaticRange.Text = "Range";
                this.labelStaticVariable.Text = "Variable";
                this.labelStaticMode.Text = "Mode";

                this.groupBoxOption.Text = "Option";
                this.labelStaticDoubleEntry.Text = "Double entry";
                this.labelStaticChattering.Text = "Chattering";
                this.labelStaticDecimalPoint.Text = "Decimal point";

                this.labelStaticBuzzerOnTime.Text = "Buzzer ON time";
                this.labelStaticRelayOnTime.Text = "Relay ON time";
                this.labelStaticBypass.Text = "Bypass";

                this.groupBoxCount.Text = "counter";
                this.labelStaticATPC.Text = "Pass alarm";
                this.labelStaticAlarmContinuousNG.Text = "Continuous NG";

                this.buttonScreen.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engScreenDisable));
                this.buttonScreen.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engScreenDown));
                this.buttonScreen.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engScreenUp));
                this.buttonBack.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engBackDisable));
                this.buttonBack.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engBackDown));
                this.buttonBack.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engBackUp)); 
                #endregion
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
            {
                #region Chinese
                this.labelTitle.Text = "选项";

                this.groupBoxAutoZero.Text = "自动零点跟踪";
                this.labelStaticTime.Text = "时间";
                this.labelStaticRange.Text = "范围";
                this.labelStaticVariable.Text = "变化";
                this.labelStaticMode.Text = "模式";

                this.groupBoxOption.Text = "等等";
                this.labelStaticDoubleEntry.Text = "重复进入";
                this.labelStaticChattering.Text = "颤振";
                this.labelStaticBuzzerOnTime.Text = "蜂鸣器开启时间";
                this.labelStaticRelayOnTime.Text = "继电器接通时间";
                this.labelStaticDecimalPoint.Text = "小数点";
                this.labelStaticBypass.Text = "旁路";

                this.groupBoxBypass.Text = "旁路";
                this.labelTitleLane1.Text = "列1";
                this.labelTitleLane2.Text = "列2";
                this.labelTitleLane3.Text = "列3";
                this.labelTitleLane4.Text = "列4";
                this.labelTitleLane5.Text = "列5";
                this.labelTitleLane6.Text = "列6";
                this.labelTitleLane7.Text = "列7";
                this.labelTitleLane8.Text = "列8";
                this.labelTitleLane9.Text = "列9";
                this.labelTitleLane10.Text = "列10";
                this.labelTitleLane11.Text = "列11";
                this.labelTitleLane12.Text = "列12";
                this.buttonSaveBypass.Text = "节省";

                this.groupBoxCount.Text = "柜台";
                this.labelStaticATPC.Text = "通过警报";
                this.labelStaticAlarmContinuousNG.Text = "连续不好";

                this.buttonBypassLane1.DownImage = this.buttonBypassLane2.DownImage = this.buttonBypassLane3.DownImage =
                this.buttonBypassLane4.DownImage = this.buttonBypassLane5.DownImage = this.buttonBypassLane6.DownImage =
                this.buttonBypassLane7.DownImage = this.buttonBypassLane8.DownImage = this.buttonBypassLane9.DownImage =
                this.buttonBypassLane10.DownImage = this.buttonBypassLane11.DownImage = this.buttonBypassLane12.DownImage =
                this.buttonBypassMode.DownImage = this.buttonDoubleEnter.DownImage = this.buttonAlarmContinuousNG.DownImage =
                this.buttonAlarmTotalPassCount.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnEnable));

                this.buttonBypassLane1.UpImage = this.buttonBypassLane2.UpImage = this.buttonBypassLane3.UpImage =
                this.buttonBypassLane4.UpImage = this.buttonBypassLane5.UpImage = this.buttonBypassLane6.UpImage =
                this.buttonBypassLane7.UpImage = this.buttonBypassLane8.UpImage = this.buttonBypassLane9.UpImage =
                this.buttonBypassLane10.UpImage = this.buttonBypassLane11.UpImage = this.buttonBypassLane12.UpImage =
                this.buttonBypassMode.UpImage = this.buttonDoubleEnter.UpImage = this.buttonAlarmContinuousNG.UpImage =
                this.buttonAlarmTotalPassCount.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnDisable));

                this.buttonScreen.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnScreenDisable));
                this.buttonScreen.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnScreenDown));
                this.buttonScreen.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnScreenUp));
                this.buttonBack.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBackDisable));
                this.buttonBack.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBackDown));
                this.buttonBack.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBackUp)); 
                #endregion
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech)
            {
                #region Czech
                this.labelTitle.Text = "Předvolby";

                this.groupBoxAutoZero.Text = "Automatické nulování";
                this.labelStaticTime.Text = "Čas";
                this.labelStaticRange.Text = "Rozsah";
                this.labelStaticVariable.Text = "Rozdíl";
                this.labelStaticMode.Text = "Režim";

                this.groupBoxOption.Text = "Možnosti";
                this.labelStaticDoubleEntry.Text = "Dvojitý vstup";
                this.labelStaticChattering.Text = "Uklidnění tenzometru";
                this.labelStaticDecimalPoint.Text = "Počet desettiných míst";

                this.labelStaticBuzzerOnTime.Text = "Zvukový signál - čas";
                this.labelStaticRelayOnTime.Text = "Relé - čas";
                this.labelStaticBypass.Text = "Vše";

                this.labelTitleLane1.Text = "Řada 1";
                this.labelTitleLane2.Text = "Řada 2";
                this.labelTitleLane3.Text = "Řada 3";
                this.labelTitleLane4.Text = "Řada 4";
                this.labelTitleLane5.Text = "Řada 5";
                this.labelTitleLane6.Text = "Řada 6";
                this.labelTitleLane7.Text = "Řada 7";
                this.labelTitleLane8.Text = "Řada 8";
                this.labelTitleLane9.Text = "Řada 9";
                this.labelTitleLane10.Text = "Řada 10";
                this.labelTitleLane11.Text = "Řada 11";
                this.labelTitleLane12.Text = "Řada 12";

                this.labelStaticBypass.Text = "Bypass vše";

                this.buttonSaveBypass.Text = "Uložit";

                this.groupBoxCount.Text = "čelit";
                this.labelStaticATPC.Text = "Předání alarmu";
                this.labelStaticAlarmContinuousNG.Text = "Trvalá chyba";

                this.buttonScreen.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeScreenDisable));
                this.buttonScreen.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeScreenDown));
                this.buttonScreen.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeScreenUp));
                this.buttonBack.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeBackDisable));
                this.buttonBack.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeBackDown));
                this.buttonBack.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeBackUp));

                this.buttonBypassLane1.DownImage = this.buttonBypassLane2.DownImage = this.buttonBypassLane3.DownImage =
                this.buttonBypassLane4.DownImage = this.buttonBypassLane5.DownImage = this.buttonBypassLane6.DownImage =
                this.buttonBypassLane7.DownImage = this.buttonBypassLane8.DownImage = this.buttonBypassLane9.DownImage =
                this.buttonBypassLane10.DownImage = this.buttonBypassLane11.DownImage = this.buttonBypassLane12.DownImage =
                this.buttonBypassMode.DownImage = this.buttonDoubleEnter.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeEnable));

                this.buttonBypassLane1.UpImage = this.buttonBypassLane2.UpImage = this.buttonBypassLane3.UpImage =
                this.buttonBypassLane4.UpImage = this.buttonBypassLane5.UpImage = this.buttonBypassLane6.UpImage =
                this.buttonBypassLane7.UpImage = this.buttonBypassLane8.UpImage = this.buttonBypassLane9.UpImage =
                this.buttonBypassLane10.UpImage = this.buttonBypassLane11.UpImage = this.buttonBypassLane12.UpImage =
                this.buttonBypassMode.UpImage = this.buttonDoubleEnter.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeDisable)); 
                #endregion
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.German)
            {
                #region German
                this.labelTitle.Text = "Konfiguration";

                this.groupBoxAutoZero.Text = "automatische Nullung";
                this.labelStaticTime.Text = "Zeit";
                this.labelStaticRange.Text = "Bereich";
                this.labelStaticVariable.Text = "Unterschied";
                this.labelStaticMode.Text = "Modus";

                this.groupBoxOption.Text = "Möglichkeit";
                this.labelStaticDoubleEntry.Text = "doppelte Eingabe";
                this.labelStaticChattering.Text = "Beruhigung des Dehnungsmessers";
                this.labelStaticDecimalPoint.Text = "Dezimalpunkt";
                //this.labelStaticAlarmContinuousNG.Text = "Dauerhafter Fehler";

                this.labelStaticBuzzerOnTime.Text = "Summer-Einschaltzeit";
                this.labelStaticRelayOnTime.Text = "Relais-Einschaltzeit";
                this.labelStaticBypass.Text = "Bypass-Modus";

                this.labelTitleLane1.Text = "Reihe 1";
                this.labelTitleLane2.Text = "Reihe 2";
                this.labelTitleLane3.Text = "Reihe 3";
                this.labelTitleLane4.Text = "Reihe 4";
                this.labelTitleLane5.Text = "Reihe 5";
                this.labelTitleLane6.Text = "Reihe 6";
                this.labelTitleLane7.Text = "Reihe 7";
                this.labelTitleLane8.Text = "Reihe 8";
                this.labelTitleLane9.Text = "Reihe 9";
                this.labelTitleLane10.Text = "Reihe 10";
                this.labelTitleLane11.Text = "Reihe 11";
                this.labelTitleLane12.Text = "Reihe 12";

                this.labelStaticBypass.Text = "Bypass Alles";
                this.tabPage1.Text = "Automatische Nullung";
                this.tabPage2.Text = "Kalibrierung";
                this.tabPage3.Text = "Tascheneinstellung";
                this.buttonZeroRange.Text = "Bereich Z";
                this.buttonZeroTime.Text = "Zeit Z";
                this.buttonZeroVariate.Text = "Unterschied Z";
                this.buttonBalanceWeight.Text = "Waage G.";
                this.buttonMaxWeight.Text = "Maximalgewicht";
                this.buttonDigit.Text = "Ziffer";

                this.buttonSaveBypass.Text = "Speichern";

                this.groupBoxCount.Text = "Schalter";
                this.labelStaticATPC.Text = "Alarm übergeben";
                this.labelStaticAlarmContinuousNG.Text = "Dauerhafter Fehler";

                this.buttonScreen.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerScreenDisable));
                this.buttonScreen.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerScreenDown));
                this.buttonScreen.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerScreenUp));
                this.buttonBack.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerBackDisable));
                this.buttonBack.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerBackDown));
                this.buttonBack.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerBackUp));

                this.buttonBypassLane1.DownImage = this.buttonBypassLane2.DownImage = this.buttonBypassLane3.DownImage =
                this.buttonBypassLane4.DownImage = this.buttonBypassLane5.DownImage = this.buttonBypassLane6.DownImage =
                this.buttonBypassLane7.DownImage = this.buttonBypassLane8.DownImage = this.buttonBypassLane9.DownImage =
                this.buttonBypassLane10.DownImage = this.buttonBypassLane11.DownImage = this.buttonBypassLane12.DownImage =
                this.buttonBypassMode.DownImage = this.buttonDoubleEnter.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerEnable));

                this.buttonBypassLane1.UpImage = this.buttonBypassLane2.UpImage = this.buttonBypassLane3.UpImage =
                this.buttonBypassLane4.UpImage = this.buttonBypassLane5.UpImage = this.buttonBypassLane6.UpImage =
                this.buttonBypassLane7.UpImage = this.buttonBypassLane8.UpImage = this.buttonBypassLane9.UpImage =
                this.buttonBypassLane10.UpImage = this.buttonBypassLane11.UpImage = this.buttonBypassLane12.UpImage =
                this.buttonBypassMode.UpImage = this.buttonDoubleEnter.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerDisable)); 
                #endregion
            }
            else
            {

            }
        }
        private void InitializeControl()
        {
            this.panelSpecialMenu.Location = new Point(0, 80);
            this.panelSpecialMenu.Visible = false;

            this.labelZeroParameterTime.Text = "-";
            this.labelZeroParameterRange.Text = "-";
            this.labelChattering.Text = "-";
            this.labelBuzzerOnTime.Text = "-";
            this.labelRelayOnTime.Text = "-";

            this.comboBoxZeroParameterVariate.Items.Clear();
            this.comboBoxZeroParameterVariate.SelectedIndexChanged -= new EventHandler(this.comboBoxZeroParameterVariate_SelectedIndexChanged);
            this.comboBoxZeroParameterVariate.Items.Add("0.05");
            this.comboBoxZeroParameterVariate.Items.Add("0.1");
            this.comboBoxZeroParameterVariate.Items.Add("0.2");
            this.comboBoxZeroParameterVariate.Items.Add("0.5");
            this.comboBoxZeroParameterVariate.Items.Add("1.0");
            this.comboBoxZeroParameterVariate.Items.Add("1.2");
            this.comboBoxZeroParameterVariate.SelectedIndex = 0;
            this.comboBoxZeroParameterVariate.SelectedIndexChanged += new EventHandler(this.comboBoxZeroParameterVariate_SelectedIndexChanged);

            this.comboBoxZeroParameterMode.Items.Clear();
            this.comboBoxZeroParameterMode.SelectedIndexChanged -= new EventHandler(this.comboBoxZeroParameterMode_SelectedIndexChanged);
            if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
            {
                this.comboBoxZeroParameterMode.Items.Add("模式1");
                this.comboBoxZeroParameterMode.Items.Add("模式2");
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech)
            {
                this.comboBoxZeroParameterMode.Items.Add("Režim1");
                this.comboBoxZeroParameterMode.Items.Add("Režim2");
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.German)
            {
                this.comboBoxZeroParameterMode.Items.Add("Modus");
                this.comboBoxZeroParameterMode.Items.Add("Modus");
            }
            else
            {
                this.comboBoxZeroParameterMode.Items.Add("Mode1");
                this.comboBoxZeroParameterMode.Items.Add("Mode2");
            }
            this.comboBoxZeroParameterMode.SelectedIndex = 0;
            this.comboBoxZeroParameterMode.SelectedIndexChanged += new EventHandler(this.comboBoxZeroParameterMode_SelectedIndexChanged);

            this.comboBoxDecimalPlaces.Items.Clear();
            this.comboBoxDecimalPlaces.SelectedIndexChanged -= new EventHandler(this.comboBoxDecimalPlaces_SelectedIndexChanged);
            this.comboBoxDecimalPlaces.Items.Add("0");
            this.comboBoxDecimalPlaces.Items.Add("0.0");
            this.comboBoxDecimalPlaces.Items.Add("0.00");
            this.comboBoxDecimalPlaces.SelectedIndex = 0;
            this.comboBoxDecimalPlaces.SelectedIndexChanged += new EventHandler(this.comboBoxDecimalPlaces_SelectedIndexChanged);
        }
        private void DefaultSetting()
        {
            this.CollectionTitleZERO = new Collection<SmartLabel>();
            this.CollectionTitleZERO.Clear();
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ1);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ2);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ3);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ4);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ5);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ6);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ7);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ8);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ9);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ10);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ11);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ12);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ13);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ14);
            this.CollectionTitleZERO.Add(this.labelTitleSB_AZ15);

            this.CollectionTitleCAL = new Collection<SmartLabel>();
            this.CollectionTitleCAL.Clear();
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL1);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL2);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL3);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL4);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL5);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL6);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL7);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL8);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL9);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL10);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL11);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL12);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL13);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL14);
            this.CollectionTitleCAL.Add(this.labelTitleSB_CAL15);

            this.CollectionTitleJUDG = new Collection<SmartLabel>();
            this.CollectionTitleJUDG.Clear();
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG1);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG2);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG3);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG4);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG5);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG6);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG7);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG8);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG9);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG10);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG11);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG12);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG13);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG14);
            this.CollectionTitleJUDG.Add(this.labelTitleSB_JUDG15);

            this.CollectionZeroParameterRangeLabel = new Collection<SmartLabel>();
            this.CollectionZeroParameterRangeLabel.Clear();
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange1);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange2);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange3);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange4);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange5);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange6);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange7);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange8);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange9);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange10);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange11);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange12);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange13);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange14);
            this.CollectionZeroParameterRangeLabel.Add(this.labelZeroRange15);

            this.CollectionZeroParameterTimeLabel = new Collection<SmartLabel>();
            this.CollectionZeroParameterTimeLabel.Clear();
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime1);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime2);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime3);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime4);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime5);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime6);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime7);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime8);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime9);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime10);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime11);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime12);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime13);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime14);
            this.CollectionZeroParameterTimeLabel.Add(this.labelZeroTime15);

            this.CollectionZeroParameterVariateLabel = new Collection<SmartLabel>();
            this.CollectionZeroParameterVariateLabel.Clear();
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate1);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate2);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate3);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate4);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate5);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate6);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate7);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate8);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate9);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate10);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate11);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate12);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate13);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate14);
            this.CollectionZeroParameterVariateLabel.Add(this.labelZeroVariate15);

            this.CollectionMaxWeightLabel = new Collection<SmartLabel>();
            this.CollectionMaxWeightLabel.Clear();
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight1);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight2);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight3);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight4);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight5);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight6);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight7);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight8);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight9);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight10);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight11);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight12);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight13);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight14);
            this.CollectionMaxWeightLabel.Add(this.labelMaxWeight15);

            this.CollectionBalanceWeightLabel = new Collection<SmartLabel>();
            this.CollectionBalanceWeightLabel.Clear();
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight1);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight2);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight3);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight4);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight5);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight6);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight7);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight8);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight9);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight10);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight11);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight12);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight13);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight14);
            this.CollectionBalanceWeightLabel.Add(this.labelBalanceWeight15);

            this.CollectionDigitLabel = new Collection<SmartLabel>();
            this.CollectionDigitLabel.Clear();
            this.CollectionDigitLabel.Add(this.labelDigit1);
            this.CollectionDigitLabel.Add(this.labelDigit2);
            this.CollectionDigitLabel.Add(this.labelDigit3);
            this.CollectionDigitLabel.Add(this.labelDigit4);
            this.CollectionDigitLabel.Add(this.labelDigit5);
            this.CollectionDigitLabel.Add(this.labelDigit6);
            this.CollectionDigitLabel.Add(this.labelDigit7);
            this.CollectionDigitLabel.Add(this.labelDigit8);
            this.CollectionDigitLabel.Add(this.labelDigit9);
            this.CollectionDigitLabel.Add(this.labelDigit10);
            this.CollectionDigitLabel.Add(this.labelDigit11);
            this.CollectionDigitLabel.Add(this.labelDigit12);
            this.CollectionDigitLabel.Add(this.labelDigit13);
            this.CollectionDigitLabel.Add(this.labelDigit14);
            this.CollectionDigitLabel.Add(this.labelDigit15);

            this.CollectionFilterLabel = new Collection<SmartLabel>();
            this.CollectionFilterLabel.Clear();
            this.CollectionFilterLabel.Add(this.labelFilter1);
            this.CollectionFilterLabel.Add(this.labelFilter2);
            this.CollectionFilterLabel.Add(this.labelFilter3);
            this.CollectionFilterLabel.Add(this.labelFilter4);
            this.CollectionFilterLabel.Add(this.labelFilter5);
            this.CollectionFilterLabel.Add(this.labelFilter6);
            this.CollectionFilterLabel.Add(this.labelFilter7);
            this.CollectionFilterLabel.Add(this.labelFilter8);
            this.CollectionFilterLabel.Add(this.labelFilter9);
            this.CollectionFilterLabel.Add(this.labelFilter10);
            this.CollectionFilterLabel.Add(this.labelFilter11);
            this.CollectionFilterLabel.Add(this.labelFilter12);
            this.CollectionFilterLabel.Add(this.labelFilter13);
            this.CollectionFilterLabel.Add(this.labelFilter14);
            this.CollectionFilterLabel.Add(this.labelFilter15);

            this.CollectionBypassLabel = new Collection<SmartLabel>();
            this.CollectionBypassLabel.Clear();
            this.CollectionBypassLabel.Add(this.labelTitleLane1);
            this.CollectionBypassLabel.Add(this.labelTitleLane2);
            this.CollectionBypassLabel.Add(this.labelTitleLane3);
            this.CollectionBypassLabel.Add(this.labelTitleLane4);
            this.CollectionBypassLabel.Add(this.labelTitleLane5);
            this.CollectionBypassLabel.Add(this.labelTitleLane6);
            this.CollectionBypassLabel.Add(this.labelTitleLane7);
            this.CollectionBypassLabel.Add(this.labelTitleLane8);
            this.CollectionBypassLabel.Add(this.labelTitleLane9);
            this.CollectionBypassLabel.Add(this.labelTitleLane10);
            this.CollectionBypassLabel.Add(this.labelTitleLane11);
            this.CollectionBypassLabel.Add(this.labelTitleLane12);
            this.CollectionBypassLabel.Add(this.labelTitleLane13);
            this.CollectionBypassLabel.Add(this.labelTitleLane14);
            this.CollectionBypassLabel.Add(this.labelTitleLane15);

            this.CollectionBypassButton = new Collection<SmartButton>();
            this.CollectionBypassButton.Clear();
            this.CollectionBypassButton.Add(this.buttonBypassLane1);
            this.CollectionBypassButton.Add(this.buttonBypassLane2);
            this.CollectionBypassButton.Add(this.buttonBypassLane3);
            this.CollectionBypassButton.Add(this.buttonBypassLane4);
            this.CollectionBypassButton.Add(this.buttonBypassLane5);
            this.CollectionBypassButton.Add(this.buttonBypassLane6);
            this.CollectionBypassButton.Add(this.buttonBypassLane7);
            this.CollectionBypassButton.Add(this.buttonBypassLane8);
            this.CollectionBypassButton.Add(this.buttonBypassLane9);
            this.CollectionBypassButton.Add(this.buttonBypassLane10);
            this.CollectionBypassButton.Add(this.buttonBypassLane11);
            this.CollectionBypassButton.Add(this.buttonBypassLane12);
            this.CollectionBypassButton.Add(this.buttonBypassLane13);
            this.CollectionBypassButton.Add(this.buttonBypassLane14);
            this.CollectionBypassButton.Add(this.buttonBypassLane15);

            for (int i = 0; i < 15; i++)
            {
                this.CollectionZeroParameterRangeLabel[i].Text = "";
                this.CollectionZeroParameterTimeLabel[i].Text = "";
                this.CollectionZeroParameterVariateLabel[i].Text = "";
                this.CollectionMaxWeightLabel[i].Text = "";
                this.CollectionBalanceWeightLabel[i].Text = "";
                this.CollectionDigitLabel[i].Text = "";
                this.CollectionFilterLabel[i].Text = "";
            }

            for (int i = this.ParentForm.SystemConfig.EquipmentColumns; i < 15; i++)
            {
                this.CollectionTitleZERO[i].Visible = false;
                this.CollectionTitleCAL[i].Visible = false;
                this.CollectionTitleJUDG[i].Visible = false;
                this.CollectionZeroParameterRangeLabel[i].Visible = false;
                this.CollectionZeroParameterTimeLabel[i].Visible = false;
                this.CollectionZeroParameterVariateLabel[i].Visible = false;
                this.CollectionMaxWeightLabel[i].Visible = false;
                this.CollectionBalanceWeightLabel[i].Visible = false;
                this.CollectionDigitLabel[i].Visible = false;
                this.CollectionFilterLabel[i].Visible = false;
                this.CollectionBypassLabel[i].Visible = false;
                this.CollectionBypassButton[i].Visible = false;
            }

            this.comboBoxDecimalPlaces.SelectedIndexChanged -= new EventHandler(this.comboBoxDecimalPlaces_SelectedIndexChanged);
            this.comboBoxDecimalPlaces.SelectedIndex = this.ParentForm.SystemConfig.DecimalPlaces;
            this.comboBoxDecimalPlaces.SelectedIndexChanged += new EventHandler(this.comboBoxDecimalPlaces_SelectedIndexChanged);
        }

        public void UpdateZeroParameterRangeDisplay(DataStore.EquipmentStatus status, Collection<string> values)
        {
            if (values == null || values.Count == 0)
                return;

            for (int i = 0; i < values.Count; i++)
                this.CollectionZeroParameterRangeLabel[i].Text = values[i];
        }
        public void UpdateZeroParameterTimeDisplay(DataStore.EquipmentStatus status, Collection<string> values)
        {
            if (values == null || values.Count == 0)
                return;

            for (int i = 0; i < values.Count; i++)
                this.CollectionZeroParameterTimeLabel[i].Text = values[i];
        }
        public void UpdateZeroParameterVariateDisplay(DataStore.EquipmentStatus status, Collection<string> values)
        {
            if (values == null || values.Count == 0)
                return;

            for (int i = 0; i < values.Count; i++)
            {
                if (values[i].Trim() == "0")
                    this.CollectionZeroParameterVariateLabel[i].Text = "0.05";
                else if (values[i].Trim() == "1")
                    this.CollectionZeroParameterVariateLabel[i].Text = "0.1";
                else if (values[i].Trim() == "2")
                    this.CollectionZeroParameterVariateLabel[i].Text = "0.2";
                else if (values[i].Trim() == "3")
                    this.CollectionZeroParameterVariateLabel[i].Text = "0.5";
                else if (values[i].Trim() == "4")
                    this.CollectionZeroParameterVariateLabel[i].Text = "1";
                else if (values[i].Trim() == "5")
                    this.CollectionZeroParameterVariateLabel[i].Text = "1.2";
                else
                    this.CollectionZeroParameterVariateLabel[i].Text = "0.05";
            }
        }
        public void UpdateZeroParameterDisplay(DataStore.EquipmentStatus status, ZeroParameterItem item)
        {
            int iValue = 0;
            string sValue = "";

            sValue = item.Time.Trim();
            if (this.labelZeroParameterTime.Text != sValue)
                this.labelZeroParameterTime.Text = sValue;

            sValue = item.Range.Trim();
            if (this.labelZeroParameterRange.Text != sValue)
                this.labelZeroParameterRange.Text = sValue;

            iValue = int.Parse(item.Variate.Trim());
            this.comboBoxZeroParameterVariate.SelectedIndexChanged -= new EventHandler(this.comboBoxZeroParameterVariate_SelectedIndexChanged);
            this.comboBoxZeroParameterVariate.SelectedIndex = iValue;
            this.comboBoxZeroParameterVariate.SelectedIndexChanged += new EventHandler(this.comboBoxZeroParameterVariate_SelectedIndexChanged);
        }
        public void UpdateOptionParameterDisplay(DataStore.EquipmentStatus status, OptionParameterItem item)
        {
            string value = "";

            value = item.Chattering.Trim();
            if (this.labelChattering.Text != value)
                this.labelChattering.Text = value;

            value = item.BuzzerOnTime.Trim();
            if (this.labelBuzzerOnTime.Text != value)
                this.labelBuzzerOnTime.Text = value;

            value = item.RelayOnTime.Trim();
            if (this.labelRelayOnTime.Text != value)
                this.labelRelayOnTime.Text = value;

            if (item.DoubleEnter == "1")
                this.buttonDoubleEnter.ButtonDown();
            else
                this.buttonDoubleEnter.ButtonUp();
        }
        public void UpdateBalanceWeightDisplay(DataStore.EquipmentStatus status, Collection<string> values)
        {
            if (values == null || values.Count == 0)
                return;

            for (int i = 0; i < values.Count; i++)
                this.CollectionBalanceWeightLabel[i].Text = values[i];
        }
        public void UpdateMaxWeightDisplay(DataStore.EquipmentStatus status, Collection<string> values)
        {
            if (values == null || values.Count == 0)
                return;

            for (int i = 0; i < values.Count; i++)
                this.CollectionMaxWeightLabel[i].Text = values[i];
        }
        public void UpdateDigitDisplay(DataStore.EquipmentStatus status, Collection<string> values)
        {
            if (values == null || values.Count == 0)
                return;

            for (int i = 0; i < values.Count; i++)
                this.CollectionDigitLabel[i].Text = values[i];
        }
        public void UpdateFilterDisplay(DataStore.EquipmentStatus status, Collection<string> values)
        {
            if (values == null || values.Count == 0)
                return;

            for (int i = 0; i < values.Count; i++)
                this.CollectionFilterLabel[i].Text = values[i];
        }

        public void DisplayRefresh()
        {
            string value = "";
            
            if (this.ParentForm.SystemConfig.IsLogin == true && this.ParentForm.SystemConfig.CurrentUser.ID == "Intech")
                this.buttonScreen.Visible = true;
            else
                this.buttonScreen.Visible = false;

            this.ParentForm.SystemConfig.CurrentForm = DataStore.FormStore.FormConfiguration;
            this.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.SubBoard1, CommunicationAddress.ParameterRead4901, "");
            this.timerInterval.Enabled = true;
            this.buttonSaveBypass.Enabled = false;

            // DecimalPlaces
            this.comboBoxDecimalPlaces.SelectedIndexChanged -= new EventHandler(this.comboBoxDecimalPlaces_SelectedIndexChanged);
            this.comboBoxDecimalPlaces.SelectedIndex = this.ParentForm.SystemConfig.DecimalPlaces;
            this.comboBoxDecimalPlaces.SelectedIndexChanged += new EventHandler(this.comboBoxDecimalPlaces_SelectedIndexChanged);

            // AlarmContinuousNG Count
            value = this.ParentForm.SystemConfig.AlarmContinuousNG.ToString();
            if (this.labelAlarmContinuousNG.Text != value)
                this.labelAlarmContinuousNG.Text = value;

            // AlarmContinuousNG Enable
            if (this.ParentForm.SystemConfig.IsAlarmContinuousNGEnable == true)
                this.buttonAlarmContinuousNG.ButtonDown();
            else
                this.buttonAlarmContinuousNG.ButtonUp();

            // AlarmTotalCount
            value = this.ParentForm.SystemConfig.AlarmTotalPassCnt.ToString();
            if (this.labelAlarmTotalPassCount.Text != value)
                this.labelAlarmTotalPassCount.Text = value;

            // AlarmTotalCount Enable
            if (this.ParentForm.SystemConfig.IsAlarmTotalPassCntEnable == true)
                this.buttonAlarmTotalPassCount.ButtonDown();
            else
                this.buttonAlarmTotalPassCount.ButtonUp();

            // Bypass
            for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
            {
                if (this.ParentForm.CollectionWeightData[i].IsBypassMode == true)
                    this.CollectionBypassButton[i].ButtonDown();
                else
                    this.CollectionBypassButton[i].ButtonUp();
            }
        }
        #endregion

        #region Override Member
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.InitializeDesign();
        }
        #endregion

        #region Event Handler
        private void buttonBack_Click(object sender, EventArgs e)
        {
            if (this.panelSpecialMenu.Visible == true)
                this.panelSpecialMenu.Visible = false;

            this.ParentForm.ChildFormMenu.DisplayRefresh();
            ((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMenu);
        }

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

            before = this.labelZeroParameterTime.Text;

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelZeroParameterTime.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.labelZeroParameterTime.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentZeroParameterItem.Time = myKeyPad.StringValue;
                    after = this.labelZeroParameterTime.Text;

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

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

            before = this.labelZeroParameterRange.Text;

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

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

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

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

            if (this.ParentForm.CurrentZeroParameterItem.Variate == "0")
                before = "0.05";
            else if (this.ParentForm.CurrentZeroParameterItem.Variate == "1")
                before = "0.1";
            else if (this.ParentForm.CurrentZeroParameterItem.Variate == "2")
                before = "0.2";
            else if (this.ParentForm.CurrentZeroParameterItem.Variate == "3")
                before = "0.5";
            else if (this.ParentForm.CurrentZeroParameterItem.Variate == "4")
                before = "1";
            else if (this.ParentForm.CurrentZeroParameterItem.Variate == "5")
                before = "1.2";
            else
                before = "0.05";

            this.ParentForm.CurrentZeroParameterItem.Variate = this.comboBoxZeroParameterVariate.SelectedIndex.ToString();

            value = Helper.StringZeroFillDigits4(this.comboBoxZeroParameterVariate.SelectedIndex.ToString());
            this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress.ZeroVariate, value);

            after = this.comboBoxZeroParameterVariate.SelectedItem.ToString();

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

        }

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

            if(this.ParentForm.CurrentOptionParameterItem.DoubleEnter == "0")
                before = "OFF";
            else
                before = "ON";
            
            if (this.buttonDoubleEnter.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
            {
                after = "ON";
                this.ParentForm.CurrentOptionParameterItem.DoubleEnter = "1";
                this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.DoubleEnter, Helper.StringZeroFillDigits4("1"));
            }
            else
            {
                after = "OFF";
                this.ParentForm.CurrentOptionParameterItem.DoubleEnter = "0";
                this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.DoubleEnter, Helper.StringZeroFillDigits4("0"));
            }

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

            before = this.labelChattering.Text;

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

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

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

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

            before = this.labelBuzzerOnTime.Text;

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelBuzzerOnTime.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.labelBuzzerOnTime.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentOptionParameterItem.BuzzerOnTime = myKeyPad.StringValue;
                    after = this.labelBuzzerOnTime.Text;

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

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

            before = this.labelRelayOnTime.Text;

            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelRelayOnTime.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.labelRelayOnTime.Text = myKeyPad.StringValue;
                    this.ParentForm.CurrentOptionParameterItem.RelayOnTime = myKeyPad.StringValue;
                    after = this.labelRelayOnTime.Text;

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

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

            // Before
            if (this.ParentForm.SystemConfig.DecimalPlaces == 0)
                before = "0";
            else if (this.ParentForm.SystemConfig.DecimalPlaces == 1)
                before = "0.0";
            else if (this.ParentForm.SystemConfig.DecimalPlaces == 2)
                before = "0.00";
            else
                before = "0";

            // After
            if (this.comboBoxDecimalPlaces.SelectedIndex == 0)
                after = "0";
            else if (this.comboBoxDecimalPlaces.SelectedIndex == 1)
                after = "0.0";
            else if (this.comboBoxDecimalPlaces.SelectedIndex == 2)
                after = "0.00";
            else
                after = "0";

            // Part 11
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.EtcDecimalpoint, "", before, after);

            this.ParentForm.SystemConfig.DecimalPlaces = this.comboBoxDecimalPlaces.SelectedIndex;
            this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig);
        }

        private void timerInterval_Tick(object sender, EventArgs e)
        {
            this.timerInterval.Enabled = false;
            this.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ParameterRead6901, "");
        }

        private void buttonBypassLane_Click(object sender, EventArgs e)
        {
            int iTemp = 0;

            for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
            {
                if (this.CollectionBypassButton[i].ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    iTemp++;
                }
            }

            if (iTemp == this.ParentForm.SystemConfig.EquipmentColumns)
                this.buttonBypassMode.ButtonDown();
            else
                this.buttonBypassMode.ButtonUp();

            this.buttonSaveBypass.Enabled = true;
        }
        private void buttonSaveBypass_Click(object sender, EventArgs e)
        {
            string before = "", after = "", lane = "";

            StringBuilder sb = new StringBuilder();

            if (this.ParentForm.SystemConfig.IsWeightViewForward == true)
            {
                for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
                {
                    if (this.CollectionBypassButton[i].ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                        sb.Append("1");
                    else
                        sb.Append("0");
                }
            }
            else
            {
                for (int i = 1; i <= this.ParentForm.SystemConfig.EquipmentColumns; i++)
                {
                    if (this.CollectionBypassButton[this.ParentForm.SystemConfig.EquipmentColumns - i].ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                        sb.Append("1");
                    else
                        sb.Append("0");
                }
            }

            #region Lane 1
            if (this.buttonBypassLane1.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                if (this.ParentForm.CollectionWeightData[0].IsBypassMode != true)
                {
                    this.ParentForm.CollectionWeightData[0].IsBypassMode = true;

                    before = "OFF";
                    after = "ON";
                    lane = "1";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            else
            {
                if (this.ParentForm.CollectionWeightData[0].IsBypassMode != false)
                {
                    this.ParentForm.CollectionWeightData[0].IsBypassMode = false;

                    before = "ON";
                    after = "OFF";
                    lane = "1";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            #endregion
            #region Lane 2
            // Lane 2
            if (this.buttonBypassLane2.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                if (this.ParentForm.CollectionWeightData[1].IsBypassMode != true)
                {
                    this.ParentForm.CollectionWeightData[1].IsBypassMode = true;

                    before = "OFF";
                    after = "ON";
                    lane = "2";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            else
            {
                if (this.ParentForm.CollectionWeightData[1].IsBypassMode != false)
                {
                    this.ParentForm.CollectionWeightData[1].IsBypassMode = false;

                    before = "ON";
                    after = "OFF";
                    lane = "2";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            #endregion
            #region Lane 3
            // Lane 3
            if (this.buttonBypassLane3.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                if (this.ParentForm.CollectionWeightData[2].IsBypassMode != true)
                {
                    this.ParentForm.CollectionWeightData[2].IsBypassMode = true;

                    before = "OFF";
                    after = "ON";
                    lane = "3";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            else
            {
                if (this.ParentForm.CollectionWeightData[2].IsBypassMode != false)
                {
                    this.ParentForm.CollectionWeightData[2].IsBypassMode = false;

                    before = "ON";
                    after = "OFF";
                    lane = "3";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            #endregion
            #region Lane 4
            // Lane 4
            if (this.buttonBypassLane4.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                if (this.ParentForm.CollectionWeightData[3].IsBypassMode != true)
                {
                    this.ParentForm.CollectionWeightData[3].IsBypassMode = true;

                    before = "OFF";
                    after = "ON";
                    lane = "4";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            else
            {
                if (this.ParentForm.CollectionWeightData[3].IsBypassMode != false)
                {
                    this.ParentForm.CollectionWeightData[3].IsBypassMode = false;

                    before = "ON";
                    after = "OFF";
                    lane = "4";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            #endregion
            #region Lane 5
            // Lane 5
            if (this.buttonBypassLane5.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                if (this.ParentForm.CollectionWeightData[4].IsBypassMode != true)
                {
                    this.ParentForm.CollectionWeightData[4].IsBypassMode = true;

                    before = "OFF";
                    after = "ON";
                    lane = "5";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            else
            {
                if (this.ParentForm.CollectionWeightData[4].IsBypassMode != false)
                {
                    this.ParentForm.CollectionWeightData[4].IsBypassMode = false;

                    before = "ON";
                    after = "OFF";
                    lane = "5";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            #endregion
            #region Lane 6
            // Lane 6
            if (this.buttonBypassLane6.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                if (this.ParentForm.CollectionWeightData[5].IsBypassMode != true)
                {
                    this.ParentForm.CollectionWeightData[5].IsBypassMode = true;

                    before = "OFF";
                    after = "ON";
                    lane = "6";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            else
            {
                if (this.ParentForm.CollectionWeightData[5].IsBypassMode != false)
                {
                    this.ParentForm.CollectionWeightData[5].IsBypassMode = false;

                    before = "ON";
                    after = "OFF";
                    lane = "6";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            #endregion
            #region Lane 7
            // Lane 7
            if (this.buttonBypassLane7.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                if (this.ParentForm.CollectionWeightData[6].IsBypassMode != true)
                {
                    this.ParentForm.CollectionWeightData[6].IsBypassMode = true;

                    before = "OFF";
                    after = "ON";
                    lane = "7";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            else
            {
                if (this.ParentForm.CollectionWeightData[6].IsBypassMode != false)
                {
                    this.ParentForm.CollectionWeightData[6].IsBypassMode = false;

                    before = "ON";
                    after = "OFF";
                    lane = "7";

                    // Part11
                    if (this.ParentForm.SystemConfig.IsPart11 == true)
                        this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                }
            }
            #endregion

            if (this.ParentForm.SystemConfig.EquipmentColumns == 8)
            {
                #region 8열
                // Lane 8
                if (this.buttonBypassLane8.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[7].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[7].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "8";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[7].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[7].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "8";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                #endregion
            }
            else if (this.ParentForm.SystemConfig.EquipmentColumns == 10)
            {
                #region 10열
                // Lane 8
                if (this.buttonBypassLane8.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[7].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[7].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "8";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[7].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[7].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "8";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 9
                if (this.buttonBypassLane9.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[8].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[8].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "9";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[8].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[8].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "9";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 10
                if (this.buttonBypassLane10.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[9].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[9].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "10";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[9].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[9].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "10";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                #endregion
            }
            else if (this.ParentForm.SystemConfig.EquipmentColumns == 12)
            {
                #region 12열
                // Lane 8
                if (this.buttonBypassLane8.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[7].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[7].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "8";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[7].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[7].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "8";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 9
                if (this.buttonBypassLane9.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[8].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[8].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "9";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[8].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[8].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "9";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 10
                if (this.buttonBypassLane10.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[9].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[9].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "10";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[9].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[9].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "10";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 11
                if (this.buttonBypassLane11.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[10].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[10].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "11";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[10].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[10].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "11";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 12
                if (this.buttonBypassLane12.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[11].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[11].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "12";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[11].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[11].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "12";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                #endregion
            }
            else if (this.ParentForm.SystemConfig.EquipmentColumns == 15)
            {
                #region 15열
                // Lane 8
                if (this.buttonBypassLane8.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[7].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[7].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "8";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[7].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[7].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "8";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 9
                if (this.buttonBypassLane9.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[8].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[8].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "9";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[8].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[8].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "9";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 10
                if (this.buttonBypassLane10.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[9].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[9].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "10";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[9].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[9].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "10";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 11
                if (this.buttonBypassLane11.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[10].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[10].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "11";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[10].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[10].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "11";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 12
                if (this.buttonBypassLane12.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[11].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[11].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "12";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[11].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[11].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "12";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 13
                if (this.buttonBypassLane13.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[12].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[12].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "13";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[12].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[12].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "13";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 14
                if (this.buttonBypassLane14.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[13].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[13].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "14";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[13].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[13].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "14";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                // Lane 15
                if (this.buttonBypassLane15.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
                {
                    if (this.ParentForm.CollectionWeightData[14].IsBypassMode != true)
                    {
                        this.ParentForm.CollectionWeightData[14].IsBypassMode = true;

                        before = "OFF";
                        after = "ON";
                        lane = "15";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                else
                {
                    if (this.ParentForm.CollectionWeightData[14].IsBypassMode != false)
                    {
                        this.ParentForm.CollectionWeightData[14].IsBypassMode = false;

                        before = "ON";
                        after = "OFF";
                        lane = "15";

                        // Part11
                        if (this.ParentForm.SystemConfig.IsPart11 == true)
                            this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_Individual, lane, before, after);
                    }
                }
                #endregion
            }

            this.ParentForm.SystemConfig.IsBypassMode = false;
            for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
            {
                if (this.ParentForm.CollectionWeightData[i].IsBypassMode == true)
                {
                    this.ParentForm.SystemConfig.IsBypassMode = true;
                    break;
                }
            }

            this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress.Bypass, sb.ToString());
            this.buttonSaveBypass.Enabled = false;
        }
        private void buttonBypassMode_Click(object sender, EventArgs e)
        {
            string before = "", after = "";

            StringBuilder sb = new StringBuilder();

            if (this.buttonBypassMode.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
            {
                for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
                {
                    sb.Append("1");
                    this.CollectionBypassButton[i].ButtonDown();
                }
                this.ParentForm.SystemConfig.IsBypassMode = true;

                for (int i = 0; i < this.ParentForm.CollectionWeightData.Count; i++)
                    this.ParentForm.CollectionWeightData[i].IsBypassMode = true;

                this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress.Bypass, sb.ToString());

                before = "OFF";
                after = "ON";
            }
            else
            {
                for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
                {
                    sb.Append("0");
                    this.CollectionBypassButton[i].ButtonUp();
                }
                this.ParentForm.SystemConfig.IsBypassMode = false;

                for (int i = 0; i < this.ParentForm.CollectionWeightData.Count; i++)
                    this.ParentForm.CollectionWeightData[i].IsBypassMode = false;

                this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress.Bypass, sb.ToString());

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

            // Part11
            if (this.ParentForm.SystemConfig.IsPart11 == true)
                this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.BP_All, "", before, after);
        }
        private void buttonScreen_Click(object sender, EventArgs e)
        {
            if (this.panelSpecialMenu.Visible == false)
            {
                this.panelSpecialMenu.Visible = true;
                this.panelSpecialMenu.BringToFront();
            }
            else
                this.panelSpecialMenu.Visible = false;
        }

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

            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;

                    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 buttonAlarmContinuousNG_Click(object sender, EventArgs e)
        {
            string before = "", after = "";

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

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

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

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

            before = this.labelAlarmTotalPassCount.Text;

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

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

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

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

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

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

        #region SpecialFunction Menu
        private void buttonZeroRange_Click(object sender, EventArgs e)
        {
            this.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.SubBoardAll, CommunicationAddress.ZeroRange, "");
        }
        private void buttonZeroVariate_Click(object sender, EventArgs e)
        {
            this.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.SubBoardAll, CommunicationAddress.ZeroVariate, "");
        }
        private void buttonZeroTime_Click(object sender, EventArgs e)
        {
            this.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.SubBoardAll, CommunicationAddress.ZeroTime, "");
        }
        private void buttonDigit_Click(object sender, EventArgs e)
        {
            this.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.SubBoardAll, CommunicationAddress.Digit, "");
        }
        private void buttonMaxWeight_Click(object sender, EventArgs e)
        {
            this.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.SubBoardAll, CommunicationAddress.MaxWeight, "");
        }
        private void buttonBalanceWeight_Click(object sender, EventArgs e)
        {
            this.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.SubBoardAll, CommunicationAddress.BalanceWeight, "");
        }
        private void buttonFilter_Click(object sender, EventArgs e)
        {
            this.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.SubBoardAll, CommunicationAddress.Filter, "");
        }
        #endregion

        #endregion
    }
}