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 INT63DC_ImageDll;
using INT63DC_6CH.In_UserManager;
using SmartX;
using INT63DC_6CH.DialogForms;

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

        private Collection<Point> CollectionLevel1Location;
        private Collection<Point> CollectionLevel2Location;
        private Collection<Point> CollectionLevel3Location;

        private Collection<Control> CollectionLevel1Control;
        private Collection<Control> CollectionLevel2Control;
        private Collection<Control> CollectionLevel3Control;
        #endregion

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

            this.ParentForm = parent;
            this.DefaultSetting();
        }
        #endregion

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

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

            switch (this.ParentForm.SystemConfig.Language)
            {
                case DataStore.E_LanguageID.Korean:
                    break;
                case DataStore.E_LanguageID.English:
                    this.labelTitle.Text = "Group Editor";

                    this.labelTitleChangeName.TextHAlign = SmartLabel.TextHorAlign.Left;
                    this.labelTitleChangeName.TextVAlign = SmartLabel.TextVerAlign.Top;
                    this.labelTitleChangeName.Text = "Change Group Name";

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

                    this.buttonSave.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engSaveDisable));
                    this.buttonSave.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engSaveDown));
                    this.buttonSave.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engSaveUp));
                    break;
                case DataStore.E_LanguageID.Czech:
                    break;
                case DataStore.E_LanguageID.German:
                    this.labelTitle.Text = "Gruppeneditor";

                    this.labelTitleL1_1.Text = this.labelTitleL1_2.Text = "S1";
                    this.labelTitleL2_1.Text = this.labelTitleL2_2.Text = "S2";
                    this.labelTitleL3_1.Text = this.labelTitleL3_2.Text = "S3";

                    this.labelStaticMainDisplayAccess.Text = "Hauptanzeige";
                    this.labelStaticProductNo.Text = "Warenwechsel";
                    this.labelStaticWeightSetting.Text = "Gewichts-Einstellungen";
                    this.labelStaticClear.Text = "Löschen";
                    
                    this.labelStaticMenu.Text = "Menü";
                    this.labelStaticCommunication.Text = "Kommunikationseinstellungen";
                    this.labelStaticSubMenu.Text = "Untermenü";
                    this.labelStaticTimeSetting.Text = "Zeiteinstellung";
                    this.labelStaticInformation.Text = "Systeminformation";
                    this.labelStaticDataBackup.Text = "Datensicherung";
                    this.labelStaticCalibration.Text = "Kalibrierung";
                    this.labelStaticConfiguration.Text = "Konfiguration";
                    this.labelStaticUpdate.Text = "Aktualisierung";
                    this.labelStaticSystemSetting.Text = "Systemeinstellung";
                    this.labelStaticFactoryReset.Text = "Werkseinstellung";
                    this.labelStaticMotorSetting.Text = "Motoreinstellung";
                    this.labelStaticEquipmentSetting.Text = "Vorrichtungeinstellung";
                    this.labelStaticIOTest.Text = "I/O Test";
                    this.labelStaticUserSetting.Text = "Benutzereinstellungen";
                    this.labelStaticStatistics.Text = "Statistik";
                    this.labelStaticUserGroupSetting.Text = "Gruppeneditor";

                    this.labelTitleChangeName.TextHAlign = SmartLabel.TextHorAlign.Left;
                    this.labelTitleChangeName.TextVAlign = SmartLabel.TextVerAlign.Top;
                    this.labelTitleChangeName.Text = "Gruppennamen ändern";

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

                    this.buttonSave.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engSaveDisable));
                    this.buttonSave.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engSaveDown));
                    this.buttonSave.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engSaveUp));
                    break;
                case DataStore.E_LanguageID.Chinese:
                    #region Chinese
                    this.labelTitle.Text = "组编辑";

                    this.labelTitleL1_1.Text = "级别1";
                    this.labelTitleL2_1.Text = "级别2";
                    this.labelTitleL3_1.Text = "级别3";

                    this.labelStaticMainDisplayAccess.Text = "主显示访问";
                    this.labelStaticProductNo.Text = "编号";
                    this.labelStaticWeightSetting.Text = "体重设定";
                    this.labelStaticClear.Text = "消除";
                    this.labelStaticSubMenu.Text = "子菜单";

                    this.labelStaticMenu.Text = "菜单";
                    this.labelStaticTimeSetting.Text = "时间设定";
                    this.labelStaticInformation.Text = "系统信息";
                    this.labelStaticDataBackup.Text = "数据备份";
                    this.labelStaticCalibration.Text = "校准";
                    this.labelStaticConfiguration.Text = "选项";
                    this.labelStaticUpdate.Text = "更新";
                    this.labelStaticSystemSetting.Text = "系统设定";
                    this.labelStaticFactoryReset.Text = "回复出厂设置";
                    this.labelStaticMotorSetting.Text = "设置电机";
                    this.labelStaticEquipmentSetting.Text = "设备设置";
                    this.labelStaticIOTest.Text = "I/O测试";
                    this.labelStaticUserSetting.Text = "用户设置";
                    this.labelStaticStatistics.Text = "数据统计";

                    this.labelTitleChangeName.TextHAlign = SmartLabel.TextHorAlign.Middle;
                    this.labelTitleChangeName.TextVAlign = SmartLabel.TextVerAlign.Middle;
                    this.labelTitleChangeName.Text = "更改群組名";

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

                    this.buttonSave.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnSaveDisable));
                    this.buttonSave.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnSaveDown));
                    this.buttonSave.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnSaveUp)); 
                    #endregion
                    break;
                case DataStore.E_LanguageID.Japanese:
                    #region Japanese
                    this.labelTitle.Text = "グルㅡプエディタㅡ";

                    this.labelTitleL1_1.Text = "Level 1";
                    this.labelTitleL2_1.Text = "Level 2";
                    this.labelTitleL3_1.Text = "Level 3";

                    this.labelStaticMainDisplayAccess.Text = "メインディスプレイ";
                    this.labelStaticProductNo.Text = "番号";
                    this.labelStaticWeightSetting.Text = "設定値";
                    this.labelStaticClear.Text = "クリア";
                    this.labelStaticSubMenu.Text = "サブメニュㅡ";

                    this.labelStaticMenu.Text = "メニュㅡ";
                    this.labelStaticTimeSetting.Text = "時間設定";
                    this.labelStaticInformation.Text = "情報";
                    this.labelStaticDataBackup.Text = "デㅡタバックアップ";
                    this.labelStaticCalibration.Text = "校正";
                    this.labelStaticConfiguration.Text = "構成";
                    this.labelStaticUpdate.Text = "更新";
                    this.labelStaticSystemSetting.Text = "システム設定";
                    this.labelStaticFactoryReset.Text = "初期化";
                    this.labelStaticMotorSetting.Text = "モㅡタㅡ設定";
                    this.labelStaticEquipmentSetting.Text = "装置設定";
                    this.labelStaticIOTest.Text = "I/Oテスト";
                    this.labelStaticUserSetting.Text = "ユㅡザㅡの設定";
                    this.labelStaticStatistics.Text = "デㅡタ統計";

                    this.labelTitleChangeName.TextHAlign = SmartLabel.TextHorAlign.Left;
                    this.labelTitleChangeName.TextVAlign = SmartLabel.TextVerAlign.Top;
                    this.labelTitleChangeName.Text = "グループ名の変更";

                    this.buttonBack.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnBackDisable));
                    this.buttonBack.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnBackDown));
                    this.buttonBack.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnBackUp));

                    this.buttonSave.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnSaveDisable));
                    this.buttonSave.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnSaveDown));
                    this.buttonSave.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnSaveUp));
                    #endregion
                    break;
                default:
                    break;
            }
        }
        private void DefaultSetting()
        {
            this.CollectionLevel1Location = new Collection<Point>();
            this.CollectionLevel1Location.Add(this.labelTitleL1_1.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MainProductNo.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MainWeightSet.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MainClear.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MainSubMenu.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuTimeSetting.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuInformation.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuDataBackup.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuConfiguration.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuCalibration.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuSystemSetting.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuMotorSetting.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuIOTest.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuUpdate.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuFactoryReset.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuUserSetting.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuUserGroupSetting.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuEquipmentSetting.Location);
            this.CollectionLevel1Location.Add(this.checkBoxL1MenuDataStatistics.Location);

            this.CollectionLevel2Location = new Collection<Point>();
            this.CollectionLevel2Location.Add(this.labelTitleL2_1.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MainProductNo.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MainWeightSet.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MainClear.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MainSubMenu.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuTimeSetting.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuInformation.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuDataBackup.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuConfiguration.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuCalibration.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuSystemSetting.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuMotorSetting.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuIOTest.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuUpdate.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuFactoryReset.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuUserSetting.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuUserGroupSetting.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuEquipmentSetting.Location);
            this.CollectionLevel2Location.Add(this.checkBoxL2MenuDataStatistics.Location);

            this.CollectionLevel3Location = new Collection<Point>();
            this.CollectionLevel3Location.Add(this.labelTitleL3_1.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MainProductNo.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MainWeightSet.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MainClear.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MainSubMenu.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuTimeSetting.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuInformation.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuDataBackup.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuConfiguration.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuCalibration.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuSystemSetting.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuMotorSetting.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuIOTest.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuUpdate.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuFactoryReset.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuUserSetting.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuUserGroupSetting.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuEquipmentSetting.Location);
            this.CollectionLevel3Location.Add(this.checkBoxL3MenuDataStatistics.Location);

            this.CollectionLevel1Control = new Collection<Control>();
            this.CollectionLevel1Control.Add(this.labelTitleL1_1);
            this.CollectionLevel1Control.Add(this.checkBoxL1MainProductNo);
            this.CollectionLevel1Control.Add(this.checkBoxL1MainWeightSet);
            this.CollectionLevel1Control.Add(this.checkBoxL1MainClear);
            this.CollectionLevel1Control.Add(this.checkBoxL1MainSubMenu);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuTimeSetting);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuInformation);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuDataBackup);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuConfiguration);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuCalibration);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuSystemSetting);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuMotorSetting);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuIOTest);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuUpdate);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuFactoryReset);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuUserSetting);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuUserGroupSetting);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuEquipmentSetting);
            this.CollectionLevel1Control.Add(this.checkBoxL1MenuDataStatistics);

            this.CollectionLevel2Control = new Collection<Control>();
            this.CollectionLevel2Control.Add(this.labelTitleL2_1);
            this.CollectionLevel2Control.Add(this.checkBoxL2MainProductNo);
            this.CollectionLevel2Control.Add(this.checkBoxL2MainWeightSet);
            this.CollectionLevel2Control.Add(this.checkBoxL2MainClear);
            this.CollectionLevel2Control.Add(this.checkBoxL2MainSubMenu);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuTimeSetting);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuInformation);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuDataBackup);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuConfiguration);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuCalibration);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuSystemSetting);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuMotorSetting);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuIOTest);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuUpdate);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuFactoryReset);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuUserSetting);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuUserGroupSetting);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuEquipmentSetting);
            this.CollectionLevel2Control.Add(this.checkBoxL2MenuDataStatistics);

            this.CollectionLevel3Control = new Collection<Control>();
            this.CollectionLevel3Control.Add(this.labelTitleL3_1);
            this.CollectionLevel3Control.Add(this.checkBoxL3MainProductNo);
            this.CollectionLevel3Control.Add(this.checkBoxL3MainWeightSet);
            this.CollectionLevel3Control.Add(this.checkBoxL3MainClear);
            this.CollectionLevel3Control.Add(this.checkBoxL3MainSubMenu);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuTimeSetting);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuInformation);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuDataBackup);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuConfiguration);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuCalibration);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuSystemSetting);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuMotorSetting);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuIOTest);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuUpdate);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuFactoryReset);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuUserSetting);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuUserGroupSetting);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuEquipmentSetting);
            this.CollectionLevel3Control.Add(this.checkBoxL3MenuDataStatistics);

            //this.CollectionLevel4Control = new Collection<Control>();
            //this.CollectionLevel4Control.Add(this.labelTitle4);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMainProductNo);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMainWeightSet);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMainClear);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMainSubMenu);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuTimeSetting);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuInformation);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuDataBackup);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuConfiguration);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuCalibration);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuSystemSetting);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuMotorSetting);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuIOTest);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuUpdate);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuFactoryReset);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuUserSetting);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuUserGroupSetting);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuEquipmentSetting);
            //this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuDataStatistics);

            this.UpdateDisplay(this.ParentForm.CurrentUserGroup);
        }

        private void UpdateDisplay(UserGroup group)
        {
            #region Level1
            this.checkBoxL1MainProductNo.Checked = group.Level1.IsMainDisplayProductNo;
            this.checkBoxL1MainWeightSet.Checked = group.Level1.IsMainDisplayWeightSetting;
            this.checkBoxL1MainClear.Checked = group.Level1.IsMainDisplayClear;
            this.checkBoxL1MainSubMenu.Checked = group.Level1.IsMainDisplaySubMenu;

            this.checkBoxL1MenuCalibration.Checked = group.Level1.IsMenuCalibration;
            this.checkBoxL1MenuConfiguration.Checked = group.Level1.IsMenuConfiguration;
            this.checkBoxL1MenuDataBackup.Checked = group.Level1.IsMenuDataBackup;
            this.checkBoxL1MenuDataStatistics.Checked = group.Level1.IsMenuStatistics;
            this.checkBoxL1MenuEquipmentSetting.Checked = group.Level1.IsMenuEquipment;
            this.checkBoxL1MenuFactoryReset.Checked = group.Level1.IsMenuInitialization;
            this.checkBoxL1MenuInformation.Checked = group.Level1.IsMenuInformation;
            this.checkBoxL1MenuIOTest.Checked = group.Level1.IsMenuIOTest;
            this.checkBoxL1MenuMotorSetting.Checked = group.Level1.IsMenuMotor;
            this.checkBoxL1MenuSystemSetting.Checked = group.Level1.IsMenuSystem;
            this.checkBoxL1MenuTimeSetting.Checked = group.Level1.IsMenuTime;
            this.checkBoxL1MenuUpdate.Checked = group.Level1.IsMenuUpdate;
            this.checkBoxL1MenuUserGroupSetting.Checked = group.Level1.IsMenuUserGroupEditor;
            this.checkBoxL1MenuUserSetting.Checked = group.Level1.IsMenuUser;
            this.checkBoxL1MenuCommunication.Checked = group.Level1.IsMenuCommunication;
            this.checkBoxL1MenuViewer.Checked = group.Level1.IsMenuViewer;
            #endregion

            #region Level2
            this.checkBoxL2MainProductNo.Checked = group.Level2.IsMainDisplayProductNo;
            this.checkBoxL2MainWeightSet.Checked = group.Level2.IsMainDisplayWeightSetting;
            this.checkBoxL2MainClear.Checked = group.Level2.IsMainDisplayClear;
            this.checkBoxL2MainSubMenu.Checked = group.Level2.IsMainDisplaySubMenu;

            this.checkBoxL2MenuCalibration.Checked = group.Level2.IsMenuCalibration;
            this.checkBoxL2MenuConfiguration.Checked = group.Level2.IsMenuConfiguration;
            this.checkBoxL2MenuDataBackup.Checked = group.Level2.IsMenuDataBackup;
            this.checkBoxL2MenuDataStatistics.Checked = group.Level2.IsMenuStatistics;
            this.checkBoxL2MenuEquipmentSetting.Checked = group.Level2.IsMenuEquipment;
            this.checkBoxL2MenuFactoryReset.Checked = group.Level2.IsMenuInitialization;
            this.checkBoxL2MenuInformation.Checked = group.Level2.IsMenuInformation;
            this.checkBoxL2MenuIOTest.Checked = group.Level2.IsMenuIOTest;
            this.checkBoxL2MenuMotorSetting.Checked = group.Level2.IsMenuMotor;
            this.checkBoxL2MenuSystemSetting.Checked = group.Level2.IsMenuSystem;
            this.checkBoxL2MenuTimeSetting.Checked = group.Level2.IsMenuTime;
            this.checkBoxL2MenuUpdate.Checked = group.Level2.IsMenuUpdate;
            this.checkBoxL2MenuUserGroupSetting.Checked = group.Level2.IsMenuUserGroupEditor;
            this.checkBoxL2MenuUserSetting.Checked = group.Level2.IsMenuUser;
            this.checkBoxL2MenuCommunication.Checked = group.Level2.IsMenuCommunication;
            this.checkBoxL2MenuViewer.Checked = group.Level2.IsMenuViewer;
            #endregion

            #region Level3
            this.checkBoxL3MainProductNo.Checked = group.Level3.IsMainDisplayProductNo;
            this.checkBoxL3MainWeightSet.Checked = group.Level3.IsMainDisplayWeightSetting;
            this.checkBoxL3MainClear.Checked = group.Level3.IsMainDisplayClear;
            this.checkBoxL3MainSubMenu.Checked = group.Level3.IsMainDisplaySubMenu;

            this.checkBoxL3MenuCalibration.Checked = group.Level3.IsMenuCalibration;
            this.checkBoxL3MenuConfiguration.Checked = group.Level3.IsMenuConfiguration;
            this.checkBoxL3MenuDataBackup.Checked = group.Level3.IsMenuDataBackup;
            this.checkBoxL3MenuDataStatistics.Checked = group.Level3.IsMenuStatistics;
            this.checkBoxL3MenuEquipmentSetting.Checked = group.Level3.IsMenuEquipment;
            this.checkBoxL3MenuFactoryReset.Checked = group.Level3.IsMenuInitialization;
            this.checkBoxL3MenuInformation.Checked = group.Level3.IsMenuInformation;
            this.checkBoxL3MenuIOTest.Checked = group.Level3.IsMenuIOTest;
            this.checkBoxL3MenuMotorSetting.Checked = group.Level3.IsMenuMotor;
            this.checkBoxL3MenuSystemSetting.Checked = group.Level3.IsMenuSystem;
            this.checkBoxL3MenuTimeSetting.Checked = group.Level3.IsMenuTime;
            this.checkBoxL3MenuUpdate.Checked = group.Level3.IsMenuUpdate;
            this.checkBoxL3MenuUserGroupSetting.Checked = group.Level3.IsMenuUserGroupEditor;
            this.checkBoxL3MenuUserSetting.Checked = group.Level3.IsMenuUser;
            this.checkBoxL3MenuCommunication.Checked = group.Level3.IsMenuCommunication;
            this.checkBoxL3MenuViewer.Checked = group.Level3.IsMenuViewer;
            #endregion

            #region NotLogin
            //this.checkBoxNotLoginMainProductNo.Checked = group.NotLogin.IsMainDisplayProductNo;
            //this.checkBoxNotLoginMainWeightSet.Checked = group.NotLogin.IsMainDisplayWeightSetting;
            //this.checkBoxNotLoginMainClear.Checked = group.NotLogin.IsMainDisplayClear;
            //this.checkBoxNotLoginMainSubMenu.Checked = group.NotLogin.IsMainDisplaySubMenu;

            //this.checkBoxNotLoginMenuCalibration.Checked = group.NotLogin.IsMenuCalibration;
            //this.checkBoxNotLoginMenuConfiguration.Checked = group.NotLogin.IsMenuConfiguration;
            //this.checkBoxNotLoginMenuDataBackup.Checked = group.NotLogin.IsMenuDataBackup;
            //this.checkBoxNotLoginMenuDataStatistics.Checked = group.NotLogin.IsMenuStatistics;
            //this.checkBoxNotLoginMenuEquipmentSetting.Checked = group.NotLogin.IsMenuEquipment;
            //this.checkBoxNotLoginMenuFactoryReset.Checked = group.NotLogin.IsMenuInitialization;
            //this.checkBoxNotLoginMenuInformation.Checked = group.NotLogin.IsMenuInformation;
            //this.checkBoxNotLoginMenuIOTest.Checked = group.NotLogin.IsMenuIOTest;
            //this.checkBoxNotLoginMenuMotorSetting.Checked = group.NotLogin.IsMenuMotor;
            //this.checkBoxNotLoginMenuSystemSetting.Checked = group.NotLogin.IsMenuSystem;
            //this.checkBoxNotLoginMenuTimeSetting.Checked = group.NotLogin.IsMenuTime;
            //this.checkBoxNotLoginMenuUpdate.Checked = group.NotLogin.IsMenuUpdate;
            //this.checkBoxNotLoginMenuUserGroupSetting.Checked = group.NotLogin.IsMenuUserGroupEditor;
            //this.checkBoxNotLoginMenuUserSetting.Checked = group.NotLogin.IsMenuUser;
            #endregion
        }
        public void UpdateLevelNameDisplay(SystemConfigurationItem system)
        {
            this.labelLevel1.Text = system.User_Level1_Name;
            this.labelLevel2.Text = system.User_Level2_Name;
            this.labelLevel3.Text = system.User_Level3_Name;
        }

        public void DisplayRefresh()
        {
            this.UpdateDisplay(this.ParentForm.CurrentUserGroup);
            this.UpdateLevelNameDisplay(this.ParentForm.SystemConfig);

            this.buttonSave.Visible = false;

            // 현재 데이터 통계 메뉴가 없어서 Visible = false 처리함
            // 추후에 데이터 통계 메뉴 추가 되면 삭제
            if (this.ParentForm.SystemConfig.IsDataStatistics == false)
            {
                this.labelStaticStatistics.Visible = false;
                this.checkBoxL1MenuDataStatistics.Visible = false;
                this.checkBoxL2MenuDataStatistics.Visible = false;
                this.checkBoxL3MenuDataStatistics.Visible = false;
                //this.checkBoxNotLoginMenuDataStatistics.Visible = false;
            }
            if (this.ParentForm.SystemConfig.IsPart11 == false)
            {
                this.labelStaticViewer.Visible = false;
                this.checkBoxL1MenuViewer.Visible = false;
                this.checkBoxL2MenuViewer.Visible = false;
                this.checkBoxL3MenuViewer.Visible = false;
                //this.checkBoxNotLoginMenuViewer.Visible = false;
            }
        }
        #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)
        {
            this.ParentForm.ChildFormUserEditor.DisplayRefresh();
            ((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormUserEditor);
        }
        private void buttonSave_Click(object sender, EventArgs e)
        {
            #region Level1
            this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayProductNo = this.checkBoxL1MainProductNo.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayWeightSetting = this.checkBoxL1MainWeightSet.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayClear = this.checkBoxL1MainClear.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMainDisplaySubMenu = this.checkBoxL1MainSubMenu.Checked;

            this.ParentForm.CurrentUserGroup.Level1.IsMenuCalibration = this.checkBoxL1MenuCalibration.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuConfiguration = this.checkBoxL1MenuConfiguration.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuCommunication = this.checkBoxL1MenuCommunication.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuViewer = this.checkBoxL1MenuViewer.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuDataBackup = this.checkBoxL1MenuDataBackup.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuStatistics = this.checkBoxL1MenuDataStatistics.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuEquipment = this.checkBoxL1MenuEquipmentSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuInitialization = this.checkBoxL1MenuFactoryReset.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuInformation = this.checkBoxL1MenuInformation.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuIOTest = this.checkBoxL1MenuIOTest.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuMotor = this.checkBoxL1MenuMotorSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuSystem = this.checkBoxL1MenuSystemSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuTime = this.checkBoxL1MenuTimeSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuUpdate = this.checkBoxL1MenuUpdate.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuUserGroupEditor = this.checkBoxL1MenuUserGroupSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level1.IsMenuUser = this.checkBoxL1MenuUserSetting.Checked;
            #endregion

            #region Level2
            this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayProductNo = this.checkBoxL2MainProductNo.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayWeightSetting = this.checkBoxL2MainWeightSet.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayClear = this.checkBoxL2MainClear.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMainDisplaySubMenu = this.checkBoxL2MainSubMenu.Checked;

            this.ParentForm.CurrentUserGroup.Level2.IsMenuCalibration = this.checkBoxL2MenuCalibration.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuConfiguration = this.checkBoxL2MenuConfiguration.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuCommunication = this.checkBoxL2MenuCommunication.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuViewer = this.checkBoxL2MenuViewer.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuDataBackup = this.checkBoxL2MenuDataBackup.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuStatistics = this.checkBoxL2MenuDataStatistics.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuEquipment = this.checkBoxL2MenuEquipmentSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuInitialization = this.checkBoxL2MenuFactoryReset.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuInformation = this.checkBoxL2MenuInformation.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuIOTest = this.checkBoxL2MenuIOTest.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuMotor = this.checkBoxL2MenuMotorSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuSystem = this.checkBoxL2MenuSystemSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuTime = this.checkBoxL2MenuTimeSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuUpdate = this.checkBoxL2MenuUpdate.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuUserGroupEditor = this.checkBoxL2MenuUserGroupSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level2.IsMenuUser = this.checkBoxL2MenuUserSetting.Checked;
            #endregion

            #region Level3
            this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayProductNo = this.checkBoxL3MainProductNo.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayWeightSetting = this.checkBoxL3MainWeightSet.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayClear = this.checkBoxL3MainClear.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMainDisplaySubMenu = this.checkBoxL3MainSubMenu.Checked;

            this.ParentForm.CurrentUserGroup.Level3.IsMenuCalibration = this.checkBoxL3MenuCalibration.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuConfiguration = this.checkBoxL3MenuConfiguration.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuCommunication = this.checkBoxL3MenuCommunication.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuViewer = this.checkBoxL3MenuViewer.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuDataBackup = this.checkBoxL3MenuDataBackup.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuStatistics = this.checkBoxL3MenuDataStatistics.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuEquipment = true;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuInitialization = this.checkBoxL3MenuFactoryReset.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuInformation = this.checkBoxL3MenuInformation.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuIOTest = this.checkBoxL3MenuIOTest.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuMotor = this.checkBoxL3MenuMotorSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuSystem = this.checkBoxL3MenuSystemSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuTime = true;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuUpdate = this.checkBoxL3MenuUpdate.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuUserGroupEditor = this.checkBoxL3MenuUserGroupSetting.Checked;
            this.ParentForm.CurrentUserGroup.Level3.IsMenuUser = true;
            #endregion

            #region NotLogin
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayProductNo = this.checkBoxNotLoginMainProductNo.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayWeightSetting = this.checkBoxNotLoginMainWeightSet.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayClear = this.checkBoxNotLoginMainClear.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplaySubMenu = this.checkBoxNotLoginMainSubMenu.Checked;

            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuCalibration = this.checkBoxNotLoginMenuCalibration.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuConfiguration = this.checkBoxNotLoginMenuConfiguration.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuDataBackup = this.checkBoxNotLoginMenuDataBackup.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuStatistics = this.checkBoxNotLoginMenuDataStatistics.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuEquipment = this.checkBoxNotLoginMenuEquipmentSetting.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuInitialization = this.checkBoxNotLoginMenuFactoryReset.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuInformation = this.checkBoxNotLoginMenuInformation.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuIOTest = this.checkBoxNotLoginMenuIOTest.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuMotor = this.checkBoxNotLoginMenuMotorSetting.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuSystem = this.checkBoxNotLoginMenuSystemSetting.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuTime = this.checkBoxNotLoginMenuTimeSetting.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuUpdate = this.checkBoxNotLoginMenuUpdate.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuUserGroupEditor = this.checkBoxNotLoginMenuUserGroupSetting.Checked;
            //this.ParentForm.CurrentUserGroup.NotLogin.IsMenuUser = this.checkBoxNotLoginMenuUserSetting.Checked;
            #endregion

            this.ParentForm.SaveUserGroupFile(this.ParentForm.CurrentUserGroup);

            this.buttonSave.Visible = false;
        }

        private void labelTitle1_Click(object sender, EventArgs e)
        {
            if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Level3 ||
                this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer)
            {
                this.checkBoxL1MainProductNo.Checked = true;
                this.checkBoxL1MainWeightSet.Checked = true;
                this.checkBoxL1MainClear.Checked = true;
                this.checkBoxL1MainSubMenu.Checked = true;

                this.checkBoxL1MenuInformation.Checked = true;
                this.checkBoxL1MenuDataBackup.Checked = true;
                this.checkBoxL1MenuConfiguration.Checked = true;
                this.checkBoxL1MenuCommunication.Checked = true;
                this.checkBoxL1MenuViewer.Checked = true;
                this.checkBoxL1MenuCalibration.Checked = true;
                this.checkBoxL1MenuSystemSetting.Checked = true;
                this.checkBoxL1MenuMotorSetting.Checked = true;
                this.checkBoxL1MenuIOTest.Checked = true;
                this.checkBoxL1MenuUpdate.Checked = true;
                this.checkBoxL1MenuFactoryReset.Checked = true;
                this.checkBoxL1MenuUserSetting.Checked = true;
                this.checkBoxL1MenuUserGroupSetting.Checked = true;
                this.checkBoxL1MenuEquipmentSetting.Checked = true;
                this.checkBoxL1MenuDataStatistics.Checked = true;
                this.checkBoxL1MenuTimeSetting.Checked = true;

                this.buttonSave.Visible = true;
            }
        }
        private void labelTitle2_Click(object sender, EventArgs e)
        {
            if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Level3 ||
                this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer)
            {
                this.checkBoxL2MainProductNo.Checked = true;
                this.checkBoxL2MainWeightSet.Checked = true;
                this.checkBoxL2MainClear.Checked = true;
                this.checkBoxL2MainSubMenu.Checked = true;

                this.checkBoxL2MenuInformation.Checked = true;
                this.checkBoxL2MenuDataBackup.Checked = true;
                this.checkBoxL2MenuConfiguration.Checked = true;
                this.checkBoxL2MenuCommunication.Checked = true;
                this.checkBoxL2MenuViewer.Checked = true;
                this.checkBoxL2MenuCalibration.Checked = true;
                this.checkBoxL2MenuSystemSetting.Checked = true;
                this.checkBoxL2MenuMotorSetting.Checked = true;
                this.checkBoxL2MenuIOTest.Checked = true;
                this.checkBoxL2MenuUpdate.Checked = true;
                this.checkBoxL2MenuFactoryReset.Checked = true;
                this.checkBoxL2MenuUserSetting.Checked = true;
                this.checkBoxL2MenuUserGroupSetting.Checked = true;
                this.checkBoxL2MenuEquipmentSetting.Checked = true;
                this.checkBoxL2MenuDataStatistics.Checked = true;
                this.checkBoxL2MenuTimeSetting.Checked = true;

                this.buttonSave.Visible = true;
            }
        }
        private void labelTitle3_Click(object sender, EventArgs e)
        {
            if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Level3 ||
                this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer)
            {
                this.checkBoxL3MainProductNo.Checked = true;
                this.checkBoxL3MainWeightSet.Checked = true;
                this.checkBoxL3MainClear.Checked = true;
                this.checkBoxL3MainSubMenu.Checked = true;

                this.checkBoxL3MenuInformation.Checked = true;
                this.checkBoxL3MenuDataBackup.Checked = true;
                this.checkBoxL3MenuConfiguration.Checked = true;
                this.checkBoxL3MenuCommunication.Checked = true;
                this.checkBoxL3MenuViewer.Checked = true;
                this.checkBoxL3MenuCalibration.Checked = true;
                this.checkBoxL3MenuSystemSetting.Checked = true;
                this.checkBoxL3MenuMotorSetting.Checked = true;
                this.checkBoxL3MenuIOTest.Checked = true;
                this.checkBoxL3MenuUpdate.Checked = true;
                this.checkBoxL3MenuFactoryReset.Checked = true;
                this.checkBoxL3MenuUserSetting.Checked = true;
                this.checkBoxL3MenuUserGroupSetting.Checked = true;
                this.checkBoxL3MenuEquipmentSetting.Checked = true;
                this.checkBoxL3MenuDataStatistics.Checked = true;
                this.checkBoxL3MenuTimeSetting.Checked = true;

                this.buttonSave.Visible = true;
            }
        }

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

            before = this.labelLevel1.Text;
            DialogFormKeyboard keyboard = new DialogFormKeyboard(this.labelLevel1.Text);

            if (keyboard.ShowDialog() == DialogResult.OK)
            {
                value = keyboard.RetStringValue;

                this.labelLevel1.Text = value;

                this.ParentForm.SystemConfig.User_Level1_Name = value;
                this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig);

                after = this.labelLevel1.Text;

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

            before = this.labelLevel2.Text;
            DialogFormKeyboard keyboard = new DialogFormKeyboard(this.labelLevel2.Text);

            if (keyboard.ShowDialog() == DialogResult.OK)
            {
                value = keyboard.RetStringValue;

                this.labelLevel2.Text = value;

                this.ParentForm.SystemConfig.User_Level2_Name = value;
                this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig);

                after = this.labelLevel2.Text;

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

            before = this.labelLevel3.Text;
            DialogFormKeyboard keyboard = new DialogFormKeyboard(this.labelLevel3.Text);

            if (keyboard.ShowDialog() == DialogResult.OK)
            {
                value = keyboard.RetStringValue;

                this.labelLevel3.Text = value;

                this.ParentForm.SystemConfig.User_Level3_Name = value;
                this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig);

                after = this.labelLevel3.Text;

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

        private void checkBox_Click(object sender, EventArgs e)
        {
            if (this.buttonSave.Visible == false)
                this.buttonSave.Visible = true;
        }
        #endregion
    }
}