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 System.Threading;
using System.IO;

using SmartX;
using ITC81DB_2H.Controls;
using ITC81DB_2H.DialogForms;
using ITC81DB_2H_ImageDll;
using ITC81DB_2H.Datastore;
using ITC81DB_2H.Part11_UserManager;
using ITC81DB_2H.Part11_Encryption;

namespace ITC81DB_2H.Forms
{
    public partial class FormMenu : Form
    {
        #region Field
        private Queue<string> Q_FileList = new Queue<string>();
        private string EncFileName;
        private Define.E_DataType SelectedDataType;
        private SmartSplash Splash;
        
        private FormMain m_ParentForm;

        private Define.E_MenuSide SelectedSideMenu;
        private Collection<SmartButton> CollectionButtonMenu;

        public ControlMainDisplayAlarm MainAlarm;

        // 기본설정
        public ControlCenterBasicDataStatistics CenterBasicDataStatistics;
        public ControlCenterBasicHelp CenterBasicHelp;
        public ControlCenterBasicProduct CenterBasicProduct;
        public ControlCenterBasicTime CenterBasicTime;
        // 환경설정
        public ControlCenterConfiSerial CenterConfiSerial;
        public ControlCenterConfiEthernet CenterConfiEthernet;
        public ControlCenterConfiHelp CenterConfiHelp;
        public ControlCenterConfiOptionBoard CenterConfiOptionBoard;
        // 장비설정
        public ControlCenterEquipHelp CenterEquipHelp;
        public ControlCenterEquipInitialize CenterEquipInitialize;
        public ControlCenterEquipUpdate CenterEquipUpdate;
        public ControlCenterEquipFunctionSetting CenterEquipFunctionSetting;
        public ControlCenterEquipUser CenterEquipUser;
        public ControlCenterEquipEngineer CenterEquipEngineer;
        public ControlCenterEquipUserGroupEditor CenterEquipUserGroupEditor;
        public ControlCenterEquipMyPage CenterEquipMyPage;
        // 시스템설정
        public ControlCenterSystemAutoZero CenterSystemAutoZero;
        public ControlCenterSystemCalibration CenterSystemCalibration;
        public ControlCenterSystemExternalOutput CenterSystemExternalOutput;
        public ControlCenterSystemHelp CenterSystemHelp;
        public ControlCenterSystemIOTest CenterSystemIOTest;
        public ControlCenterSystemJudgment CenterSystemJudgment;
        public ControlCenterSystemSorterSetting CenterSystemSorterSetting;
        public ControlCenterSystemBLDCMotorSetting CenterSystemBLDCMotorSetting;
        // 로그
        public ControlCenterLogHelp CenterLogHelp;
        public ControlCenterLogInspection CenterLogInspection;
        public ControlCenterLogHistory CenterLogHistory;
        public ControlCenterLogOthers CenterLogOthers;
        // 시스템 정보
        public ControlCenterInforHelp CenterInforHelp;
        public ControlCenterInforSystem CenterInforSystem;
        public ControlCenterInforAS CenterInforAS;
        public ControlCenterInforSystem2 CenterInforSystem2;
        public ControlCenterInforSystem3 CenterInforSystem3;

        // Bottom Menu
        public ControlBottomBasic BottomBasic;
        public ControlBottomConfiguration BottomConfiguration;
        public ControlBottomEquipment BottomEquipment;
        public ControlBottomInformation BottomInformation;
        public ControlBottomLog BottomLog;
        public ControlBottomSystem BottomSystem;
        #endregion

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

            this.ParentForm = parent;

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

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

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

            if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.English)
            {
                this.labelTitleRoot.Font = new Font("새굴림", 20, FontStyle.Bold);

                this.buttonBasic.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuDefaultDisable));
                this.buttonBasic.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuDefaultDown));
                this.buttonBasic.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuDefaultUp));
                this.buttonConfiguration.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuConfigDisable));
                this.buttonConfiguration.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuConfigDown));
                this.buttonConfiguration.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuConfigUp));
                this.buttonSystem.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuSystemDisable));
                this.buttonSystem.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuSystemDown));
                this.buttonSystem.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuSystemUp));
                this.buttonEquipment.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuEquipmentDisable));
                this.buttonEquipment.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuEquipmentDown));
                this.buttonEquipment.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuEquipmentUp));
                this.buttonLog.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuLogDisable));
                this.buttonLog.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuLogDown));
                this.buttonLog.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuLogUp));
                this.buttonInformation.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuInformationDisable));
                this.buttonInformation.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuInformationDown));
                this.buttonInformation.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMenuInformationUp));
            }
            else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
            {
                this.labelTitleRoot.Font = new Font("새굴림", 20, FontStyle.Bold);

                this.buttonBasic.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuDefaultDisable));
                this.buttonBasic.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuDefaultDown));
                this.buttonBasic.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuDefaultUp));
                this.buttonConfiguration.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuConfigDisable));
                this.buttonConfiguration.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuConfigDown));
                this.buttonConfiguration.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuConfigUp));
                this.buttonSystem.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuSystemDisable));
                this.buttonSystem.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuSystemDown));
                this.buttonSystem.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuSystemUp));
                this.buttonEquipment.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuEquipmentDisable));
                this.buttonEquipment.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuEquipmentDown));
                this.buttonEquipment.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuEquipmentUp));
                this.buttonLog.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuLogDisable));
                this.buttonLog.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuLogDown));
                this.buttonLog.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuLogUp));
                this.buttonInformation.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuInformationDisable));
                this.buttonInformation.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuInformationDown));
                this.buttonInformation.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormMenuInformationUp));
            }
            else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Czech)
            {
            }
            else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Russian)
            {
                this.labelTitleRoot.Font = new Font("새굴림", 14, FontStyle.Bold);

                this.buttonBasic.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuDefaultDisable));
                this.buttonBasic.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuDefaultDown));
                this.buttonBasic.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuDefaultUp));
                this.buttonConfiguration.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuConfigDisable));
                this.buttonConfiguration.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuConfigDown));
                this.buttonConfiguration.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuConfigUp));
                this.buttonSystem.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuSystemDisable));
                this.buttonSystem.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuSystemDown));
                this.buttonSystem.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuSystemUp));
                this.buttonEquipment.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuEquipmentDisable));
                this.buttonEquipment.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuEquipmentDown));
                this.buttonEquipment.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuEquipmentUp));
                this.buttonLog.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuLogDisable));
                this.buttonLog.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuLogDown));
                this.buttonLog.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuLogUp));
                this.buttonInformation.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuInformationDisable));
                this.buttonInformation.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuInformationDown));
                this.buttonInformation.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusFormMenuInformationUp));
            }
            else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German)
            {
                this.labelTitleRoot.Font = new Font("새굴림", 20, FontStyle.Bold);

                this.buttonBasic.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuDefaultDisable));
                this.buttonBasic.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuDefaultDown));
                this.buttonBasic.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuDefaultUp));
                this.buttonConfiguration.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuConfigDisable));
                this.buttonConfiguration.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuConfigDown));
                this.buttonConfiguration.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuConfigUp));
                this.buttonSystem.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuSystemDisable));
                this.buttonSystem.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuSystemDown));
                this.buttonSystem.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuSystemUp));
                this.buttonEquipment.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuEquipmentDisable));
                this.buttonEquipment.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuEquipmentDown));
                this.buttonEquipment.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuEquipmentUp));
                this.buttonLog.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuLogDisable));
                this.buttonLog.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuLogDown));
                this.buttonLog.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuLogUp));
                this.buttonInformation.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuInformationDisable));
                this.buttonInformation.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuInformationDown));
                this.buttonInformation.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMenuInformationUp));
            }
            else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
            {

            }
            else
            {
                this.labelTitleRoot.Font = new Font("새굴림", 20, FontStyle.Bold);

                this.buttonBasic.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuDefaultDisable));
                this.buttonBasic.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuDefaultDown));
                this.buttonBasic.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuDefaultUp));
                this.buttonConfiguration.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuConfigDisable));
                this.buttonConfiguration.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuConfigDown));
                this.buttonConfiguration.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuConfigUp));
                this.buttonSystem.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuSystemDisable));
                this.buttonSystem.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuSystemDown));
                this.buttonSystem.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuSystemUp));
                this.buttonEquipment.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuEquipmentDisable));
                this.buttonEquipment.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuEquipmentDown));
                this.buttonEquipment.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuEquipmentUp));
                this.buttonLog.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuLogDisable));
                this.buttonLog.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuLogDown));
                this.buttonLog.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuLogUp));
                this.buttonInformation.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuInformationDisable));
                this.buttonInformation.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuInformationDown));
                this.buttonInformation.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMenuInformationUp));
            }

            this.UpdateDisplayUser(this.ParentForm.CurrentSystemStatus);
        }
        private void DefaultSetting()
        {
            this.EncFileName = "";
            this.SelectedSideMenu = Define.E_MenuSide.Basic;
            this.SelectedDataType = Define.E_DataType.None;

            this.CollectionButtonMenu = new Collection<SmartButton>();
            this.CollectionButtonMenu.Clear();
            this.CollectionButtonMenu.Add(this.buttonBasic);
            this.CollectionButtonMenu.Add(this.buttonSystem);
            this.CollectionButtonMenu.Add(this.buttonEquipment);
            this.CollectionButtonMenu.Add(this.buttonInformation);
            this.CollectionButtonMenu.Add(this.buttonLog);
            this.CollectionButtonMenu.Add(this.buttonMain);

            this.InitializeControl();

            // 알람 표시
            this.pictureBoxIconAlarm.Visible = false;
            this.MainAlarm.Visible = false;
            this.MainAlarm.BringToFront();

            if (this.ParentForm.SystemConfig1.IsLogin == true)
                this.LoginVisible(true);
        }
        public void LoginVisible(bool bValue)
        {
            this.labelUserID.Visible = bValue;
            this.labelUserLevel.Visible = bValue;
        }
        private void InitializeControl()
        {
            this.MainAlarm = new ControlMainDisplayAlarm();
            this.MainAlarm.Location = new Point(390, 60);
            this.Controls.Add(this.MainAlarm);

            this.CreateCenterBasicControl();
            this.CreateCenterConfigurationControl();
            this.CreateCenterEquipmentControl();
            this.CreateCenterSystemControl();
            this.CreateCenterInformationControl();
            this.CreateCenterLogControl();

            #region new
            // Bottom Menu
            this.BottomBasic = new ControlBottomBasic(this);
            this.BottomConfiguration = new ControlBottomConfiguration(this);
            this.BottomEquipment = new ControlBottomEquipment(this);
            this.BottomInformation = new ControlBottomInformation(this);
            this.BottomSystem = new ControlBottomSystem(this);
            this.BottomLog = new ControlBottomLog(this);
            #endregion

            #region Location
            // Bottom Menu
            this.BottomBasic.Location = new Point(0, 535);
            this.BottomConfiguration.Location = new Point(0, 535);
            this.BottomEquipment.Location = new Point(0, 535);
            this.BottomInformation.Location = new Point(0, 535);
            this.BottomSystem.Location = new Point(0, 535);
            this.BottomLog.Location = new Point(0, 535);
            #endregion

            #region Add
            // Bottom Menu
            this.Controls.Add(this.BottomBasic);
            this.Controls.Add(this.BottomConfiguration);
            this.Controls.Add(this.BottomEquipment);
            this.Controls.Add(this.BottomInformation);
            this.Controls.Add(this.BottomSystem);
            this.Controls.Add(this.BottomLog);
            #endregion
        }
        private void CreateCenterBasicControl()
        {
            this.CenterBasicHelp = new ControlCenterBasicHelp(this);
            this.CenterBasicProduct = new ControlCenterBasicProduct(this);
            this.CenterBasicDataStatistics = new ControlCenterBasicDataStatistics(this);
            this.CenterBasicTime = new ControlCenterBasicTime(this);

            this.CenterBasicHelp.Location = new Point(0, 65);
            this.CenterBasicProduct.Location = new Point(0, 65);
            this.CenterBasicDataStatistics.Location = new Point(0, 65);
            this.CenterBasicTime.Location = new Point(0, 65);

            this.Controls.Add(this.CenterBasicHelp);
            this.Controls.Add(this.CenterBasicProduct);
            this.Controls.Add(this.CenterBasicDataStatistics);
            this.Controls.Add(this.CenterBasicTime);
        }
        private void CreateCenterConfigurationControl()
        {
            this.CenterConfiHelp = new ControlCenterConfiHelp(this);
            this.CenterConfiSerial = new ControlCenterConfiSerial(this);
            this.CenterConfiEthernet = new ControlCenterConfiEthernet(this);
            this.CenterConfiOptionBoard = new ControlCenterConfiOptionBoard(this);

            this.CenterConfiHelp.Location = new Point(0, 65);
            this.CenterConfiSerial.Location = new Point(0, 65);
            this.CenterConfiEthernet.Location = new Point(0, 65);
            this.CenterConfiOptionBoard.Location = new Point(0, 65);

            this.Controls.Add(this.CenterConfiHelp);
            this.Controls.Add(this.CenterConfiSerial);
            this.Controls.Add(this.CenterConfiEthernet);
            this.Controls.Add(this.CenterConfiOptionBoard);
        }
        private void CreateCenterEquipmentControl()
        {
            this.CenterEquipHelp = new ControlCenterEquipHelp(this);
            this.CenterEquipUpdate = new ControlCenterEquipUpdate(this);
            this.CenterEquipInitialize = new ControlCenterEquipInitialize(this);
            this.CenterEquipFunctionSetting = new ControlCenterEquipFunctionSetting(this);
            this.CenterEquipUser = new ControlCenterEquipUser(this);
            this.CenterEquipEngineer = new ControlCenterEquipEngineer(this);
            this.CenterEquipUserGroupEditor = new ControlCenterEquipUserGroupEditor(this);
            this.CenterEquipMyPage = new ControlCenterEquipMyPage(this);

            this.CenterEquipHelp.Location = new Point(0, 65);
            this.CenterEquipUpdate.Location = new Point(0, 65);
            this.CenterEquipInitialize.Location = new Point(0, 65);
            this.CenterEquipFunctionSetting.Location = new Point(0, 65);
            this.CenterEquipUser.Location = new Point(0, 65);
            this.CenterEquipEngineer.Location = new Point(0, 65);
            this.CenterEquipUserGroupEditor.Location = new Point(0, 65);
            this.CenterEquipMyPage.Location = new Point(0, 65);           

            this.Controls.Add(this.CenterEquipHelp);
            this.Controls.Add(this.CenterEquipUpdate);
            this.Controls.Add(this.CenterEquipInitialize);
            this.Controls.Add(this.CenterEquipFunctionSetting);
            this.Controls.Add(this.CenterEquipUser);
            this.Controls.Add(this.CenterEquipEngineer);
            this.Controls.Add(this.CenterEquipUserGroupEditor);
            this.Controls.Add(this.CenterEquipMyPage);
        }
        private void CreateCenterSystemControl()
        {
            this.CenterSystemCalibration = new ControlCenterSystemCalibration(this);
            this.CenterSystemJudgment = new ControlCenterSystemJudgment(this);
            this.CenterSystemExternalOutput = new ControlCenterSystemExternalOutput(this);
            this.CenterSystemHelp = new ControlCenterSystemHelp(this);
            this.CenterSystemIOTest = new ControlCenterSystemIOTest(this);
            this.CenterSystemSorterSetting = new ControlCenterSystemSorterSetting(this);
            this.CenterSystemBLDCMotorSetting = new ControlCenterSystemBLDCMotorSetting(this);
            this.CenterSystemAutoZero = new ControlCenterSystemAutoZero(this);

            this.CenterSystemCalibration.Location = new Point(0, 65);
            this.CenterSystemJudgment.Location = new Point(0, 65);
            this.CenterSystemExternalOutput.Location = new Point(0, 65);
            this.CenterSystemHelp.Location = new Point(0, 65);
            this.CenterSystemIOTest.Location = new Point(0, 65);
            this.CenterSystemSorterSetting.Location = new Point(0, 65);
            this.CenterSystemBLDCMotorSetting.Location = new Point(0, 65);
            this.CenterSystemAutoZero.Location = new Point(0, 65);

            this.Controls.Add(this.CenterSystemCalibration);
            this.Controls.Add(this.CenterSystemJudgment);
            this.Controls.Add(this.CenterSystemExternalOutput);
            this.Controls.Add(this.CenterSystemHelp);
            this.Controls.Add(this.CenterSystemIOTest);
            this.Controls.Add(this.CenterSystemSorterSetting);
            this.Controls.Add(this.CenterSystemBLDCMotorSetting);
            this.Controls.Add(this.CenterSystemAutoZero);
        }
        private void CreateCenterLogControl()
        {
            this.CenterLogHelp = new ControlCenterLogHelp(this);
            this.CenterLogInspection = new ControlCenterLogInspection(this);
            this.CenterLogHistory = new ControlCenterLogHistory(this);
            this.CenterLogOthers = new ControlCenterLogOthers(this);

            this.CenterLogHelp.Location = new Point(0, 65);
            this.CenterLogInspection.Location = new Point(0, 65);
            this.CenterLogHistory.Location = new Point(0, 65);
            this.CenterLogOthers.Location = new Point(0, 65);

            this.Controls.Add(this.CenterLogHelp);
            this.Controls.Add(this.CenterLogInspection);
            this.Controls.Add(this.CenterLogHistory);
            this.Controls.Add(this.CenterLogOthers);
        }
        private void CreateCenterInformationControl()
        {
            this.CenterInforHelp = new ControlCenterInforHelp(this);
            this.CenterInforSystem = new ControlCenterInforSystem(this);
            this.CenterInforAS = new ControlCenterInforAS(this);
            this.CenterInforSystem2 = new ControlCenterInforSystem2(this);
            this.CenterInforSystem3 = new ControlCenterInforSystem3(this);

            this.CenterInforHelp.Location = new Point(0, 65);
            this.CenterInforSystem.Location = new Point(0, 65);
            this.CenterInforAS.Location = new Point(0, 65);
            this.CenterInforSystem2.Location = new Point(0, 65);
            this.CenterInforSystem3.Location = new Point(0, 65);

            this.Controls.Add(this.CenterInforHelp);
            this.Controls.Add(this.CenterInforSystem);
            this.Controls.Add(this.CenterInforAS);
            this.Controls.Add(this.CenterInforSystem2);
            this.Controls.Add(this.CenterInforSystem3);
        }

        #region Log
        private void CreateHeaderFile(string headerFilePath, string sourceFilePath, FileHeaderItem header)
        {
            string[] result, fileName;
            string filePath, section, key, value;

            result = sourceFilePath.Split('\\');
            fileName = result[result.Length - 1].Split('.');
            filePath = string.Format("{0}{1}_h.ini", headerFilePath, fileName[0]);
            section = header.GetType().Name;

            // LoginID
            key = Define.E_FileHeaderItem.LoginId.ToString();
            value = header.LoginId;
            LogIniFile.WriteString(filePath, section, key, value);
            Thread.Sleep(5);

            // SerialNumber
            key = Define.E_FileHeaderItem.SerialNumber.ToString();
            value = header.SerialNumber;
            LogIniFile.WriteString(filePath, section, key, value);
            Thread.Sleep(5);

            // EquipmentColumns
            key = Define.E_FileHeaderItem.EquipmentColumns.ToString();
            value = header.EquipmentColumns.ToString();
            LogIniFile.WriteString(filePath, section, key, value);
            Thread.Sleep(5);

            // TimeStamp
            key = Define.E_FileHeaderItem.TimeStamp.ToString();
            value = header.TimeStamp.ToString("MM/dd/yyyy HH:mm:ss");
            LogIniFile.WriteString(filePath, section, key, value);
            Thread.Sleep(5);

            // Type
            key = Define.E_FileHeaderItem.EquipmentType.ToString();
            value = header.Type.ToString();
            LogIniFile.WriteString(filePath, section, key, value);
            Thread.Sleep(5);
        }
        private void DirectoryFileDelete(string dirPath)
        {
            DirectoryInfo dir = new DirectoryInfo(dirPath);
            FileInfo[] files = dir.GetFiles();

            foreach (FileInfo file in files)
            {
                file.Delete();
            }
        }
        private void EncryptionFile(string sourceFilePath)
        {
            string[] data = sourceFilePath.Split('\\');
            string destinationFilePath = string.Format("{0}{1}", this.ParentForm.PathEncryptionFolder, data[data.Length - 1]);

            this.UI_Invoke(delegate
            {
                //this.labelFileName.Text = data[data.Length - 1];
                this.EncFileName = sourceFilePath;
            });

            Encryption.fAesEncryption(sourceFilePath, destinationFilePath, true, true);
        }

        // Backup
        public void Backup(Define.E_DataType type, TreeView view)
        {
            int count = 0;
            string targetPath = "", sourceFilePath = "", destFilePath = "", dataFolderPath = "";
            string[] result;
            DirectoryInfo dir;
            FileInfo[] files;
            List<string> listSelectedFile = new List<string>();     // 백업할 파일 리스트 (yyyy\\MM\\filename.csv)
            this.Q_FileList = new Queue<string>();

            switch (type)
            {
                case Define.E_DataType.None:
                    break;
                case Define.E_DataType.History:
                    dataFolderPath = this.ParentForm.PathDataHistoryFolder;
                    this.SelectedDataType = Define.E_DataType.History;
                    break;
                case Define.E_DataType.Inspection:
                    dataFolderPath = this.ParentForm.PathDataInspectionFolder;
                    this.SelectedDataType = Define.E_DataType.Inspection;
                    break;
                case Define.E_DataType.Others:
                    dataFolderPath = this.ParentForm.PathDataOthersFolder;
                    this.SelectedDataType = Define.E_DataType.Others;
                    break;
                default:
                    break;
            }

            if (dataFolderPath == "")
                return;

            targetPath = "하드 디스크\\";
            #region USB 장착 유무 체크
            dir = new DirectoryInfo(targetPath);
            if (dir.Exists == false)
            {
                // USB메모리가 장착되지 않았습니다
                DialogFormMessage msg = new DialogFormMessage(5, this.ParentForm.SystemConfig1.Language);
                msg.ShowDialog();
                return;
            }
            #endregion

            listSelectedFile = this.GetSeletedNodeList(view);
            #region 백업할 파일 유무 체크
            if (listSelectedFile.Count == 0)
            {
                // 백업할 파일이 없습니다
                DialogFormMessage msg = new DialogFormMessage(4, this.ParentForm.SystemConfig1.Language);
                msg.ShowDialog();
                return;
            }
            #endregion

            // Splash Start
            this.SplashStart();
            this.timerTimeout.Enabled = true;
            //if (this.ParentForm.IsCommunicationLogOpen == true)
            //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("Backup() ({0:yyyy-MM-dd HH:mm:ss}): timeout true1", DateTime.Now));

            try
            {
                if (this.ParentForm.SystemConfig3.IsPart11 == true)
                {
                    #region Header && Encryption 폴더에 파일 삭제
                    // Header && Encryption 폴더에 파일 삭제
                    this.DirectoryFileDelete(this.ParentForm.PathEncryptionFolder);
                    this.DirectoryFileDelete(this.ParentForm.PathHeaderFolder);
                    #endregion

                    #region Header 파일 생성
                    // Header 파일 생성
                    FileHeaderItem header = new FileHeaderItem();
                    header.TimeStamp = DateTime.Now;
                    header.LoginId = this.ParentForm.CurrentSystemStatus.CurrentUser.ID;
                    header.SerialNumber = this.ParentForm.SystemConfig1.SerialNumber;
                    header.EquipmentColumns = 1;
                    header.Type = 1;

                    for (int i = 0; i < listSelectedFile.Count; i++)
                    {
                        this.CreateHeaderFile(this.ParentForm.PathHeaderFolder, listSelectedFile[i], header);
                        //if (this.ParentForm.IsCommunicationLogOpen == true)
                        //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("Header-FileName ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, listSelectedFile[i]));
                    }
                    #endregion

                    #region 파일 암호화
                    // 데이터 파일
                    for (int i = 0; i < listSelectedFile.Count; i++)
                        this.Q_FileList.Enqueue(string.Format("{0}{1}", dataFolderPath, listSelectedFile[i]));
                    // 헤더 파일
                    dir = new DirectoryInfo(this.ParentForm.PathHeaderFolder);
                    files = dir.GetFiles();
                    foreach (FileInfo file in files)
                    {
                        result = file.FullName.Split('\\');
                        sourceFilePath = file.FullName;
                        destFilePath = string.Format("{0}{1}", this.ParentForm.PathEncryptionFolder, result[result.Length - 1]);

                        this.Q_FileList.Enqueue(file.FullName);
                    }

                    this.EncryptionFile(this.Q_FileList.Dequeue());
                    #endregion
                }
                else
                {
                    this.timerTimeout.Enabled = false;
                    //if (this.ParentForm.IsCommunicationLogOpen == true)
                    //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("Backup() ({0:yyyy-MM-dd HH:mm:ss}): timeout false1", DateTime.Now));

                    #region Part11 미사용 시 - USB 복사
                    // USB\SerialNumber\Data\{Type}\yyyyMMdd_HHmmss 루트
                    targetPath = string.Format("{0}{1}\\Data\\{2}\\{3}\\", targetPath, this.ParentForm.SystemConfig1.SerialNumber, type, DateTime.Now.ToString("yyyyMMdd_HHmmss"));

                    // Target폴더 - USB 폴더 체크 및 생성
                    dir = new DirectoryInfo(targetPath);
                    if (dir.Exists == false)
                        dir.Create();

                    count = listSelectedFile.Count;
                    for (int i = 0; i < listSelectedFile.Count; i++)
                    {
                        result = listSelectedFile[i].Split('\\');
                        sourceFilePath = dataFolderPath + listSelectedFile[i];
                        destFilePath = string.Format("{0}{1}", targetPath, result[result.Length - 1]);

                        // 파일 중복 검사
                        if (File.Exists(destFilePath) == true)
                        {
                            DialogFormYesNo df = new DialogFormYesNo(this.ParentForm.SystemConfig1.Language, 1, Path.GetFileName(result[result.Length - 1]));
                            df.BringToFront();
                            if (df.ShowDialog() == DialogResult.Yes)
                            {
                                this.Refresh();
                                File.Delete(destFilePath);  // 존재하는 파일 삭제
                                File.Copy(sourceFilePath, destFilePath);
                            }
                            else
                            {
                                count--;
                                this.Refresh();
                            }
                        }
                        else
                        {
                            File.Copy(sourceFilePath, destFilePath);
                            File.Delete(sourceFilePath);  // 존재하는 파일 삭제
                        }
                    }

                    // 복사 완료 메시지
                    DialogFormMessage msg = new DialogFormMessage(count.ToString(), this.ParentForm.SystemConfig1.Language);
                    this.SplashFinish();
                    msg.ShowDialog();
                    #endregion
                }
            }
            catch
            {
                // 제조사에 문의하세요
                DialogFormMessage msg = new DialogFormMessage(6, this.ParentForm.SystemConfig1.Language);
                this.timerTimeout.Enabled = false;
                //if (this.ParentForm.IsCommunicationLogOpen == true)
                //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("Backup() ({0:yyyy-MM-dd HH:mm:ss}): timeout false2", DateTime.Now));
                msg.ShowDialog();
                this.SplashFinish();
                return;
            }
        }

        // FileCopy
        public void FileCopy(Define.E_DataType type)
        {
            int count = 0;
            string targetPath = "", destTargetPath = "", sourceFilePath = "", destFilePath = "";
            string[] result;
            DirectoryInfo dir;
            FileInfo[] files;

            try
            {
                #region USB 복사
                targetPath = "하드 디스크\\";

                // USB\SerialNumber\ 루트
                destTargetPath = string.Format("{0}{1}\\Data\\{2}\\{3}\\", targetPath, this.ParentForm.SystemConfig1.SerialNumber, type, DateTime.Now.ToString("yyyyMMdd_HHmmss"));

                // USB 폴더 체크 및 생성
                dir = new DirectoryInfo(destTargetPath);
                if (dir.Exists == false)
                    dir.Create();

                // Encryption 폴더
                dir = new DirectoryInfo(this.ParentForm.PathEncryptionFolder);
                if (dir.Exists == false)
                    dir.Create();

                files = dir.GetFiles();
                count = files.Length;
                foreach (FileInfo file in files)
                {
                    result = file.FullName.Split('\\');
                    sourceFilePath = file.FullName;
                    destFilePath = string.Format("{0}{1}", destTargetPath, result[result.Length - 1]);

                    // 파일 중복 검사
                    if (File.Exists(destFilePath) == true)
                    {
                        DialogFormYesNo df = new DialogFormYesNo(this.ParentForm.SystemConfig1.Language, 1, Path.GetFileName(result[result.Length - 1]));
                        df.BringToFront();
                        if (df.ShowDialog() == DialogResult.Yes)
                        {
                            this.Refresh();
                            File.Delete(destFilePath);  // 존재하는 파일 삭제
                            File.Copy(sourceFilePath, destFilePath);
                        }
                        else
                        {
                            count--;
                            this.Refresh();
                        }
                    }
                    else
                    {
                        File.Copy(sourceFilePath, destFilePath);
                    }
                }

                //if (type == Define.E_DataType.Others)
                //{
                //    dir = new DirectoryInfo(this.ParentForm.PathDataOthersFolder);
                //    files = dir.GetFiles();
                //    foreach (FileInfo file in files)
                //        file.Delete();

                //    //this.UpdateDisplayOtherFile();
                //}

                // 복사 완료 메시지
                DialogFormMessage msg = new DialogFormMessage((count / 2).ToString(), this.ParentForm.SystemConfig1.Language);
                this.timerTimeout.Enabled = false;
                //if (this.ParentForm.IsCommunicationLogOpen == true)
                //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("FileCopy() ({0:yyyy-MM-dd HH:mm:ss}): timeout false1", DateTime.Now));
                this.SplashFinish();
                msg.ShowDialog();
                #endregion
            }
            catch
            {
                // 제조사에 문의하세요
                DialogFormMessage msg = new DialogFormMessage(6, this.ParentForm.SystemConfig1.Language);
                this.timerTimeout.Enabled = false;
                //if (this.ParentForm.IsCommunicationLogOpen == true)
                //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("FileCopy() ({0:yyyy-MM-dd HH:mm:ss}): timeout false2", DateTime.Now));
                this.SplashFinish();
                msg.ShowDialog();
                return;
            }
        }

        public void FileClose()
        {
            this.CenterLogHistory.FileClose();
            this.CenterLogInspection.FileClose();
            this.CenterLogOthers.FileClose();
        }

        public void CopyFolder(string sourceFolder, string destFolder)
        {
            if (!Directory.Exists(destFolder))
                Directory.CreateDirectory(destFolder);

            string[] files = Directory.GetFiles(sourceFolder);
            string[] folders = Directory.GetDirectories(sourceFolder);

            foreach (string file in files)
            {
                string name = Path.GetFileName(file);
                string dest = Path.Combine(destFolder, name);
                File.Copy(file, dest);
            }

            foreach (string folder in folders)
            {
                string name = Path.GetFileName(folder);
                string dest = Path.Combine(destFolder, name);
                this.CopyFolder(folder, dest);
            }
        }
        public void CopyFile(string sourceFile, string destFile)
        {
            string[] targetPath = destFile.Split('\\');
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < targetPath.Length - 1; i++)
            {
                sb.Append(targetPath[i]);
                sb.Append("\\");
            }

            if (!Directory.Exists(sb.ToString()))
                Directory.CreateDirectory(sb.ToString());

            File.Copy(sourceFile, destFile);


            //string[] files = Directory.GetFiles(sourceFolder);
            //string[] folders = Directory.GetDirectories(sourceFolder);

            //foreach (string file in files)
            //{
            //    if (targetFileFullPath == file)
            //    {
            //        string name = Path.GetFileName(file);
            //        string dest = Path.Combine(destFolder, name);
            //        File.Copy(sourceFile, destFile);
            //        return;
            //    }
            //}

            //foreach (string folder in folders)
            //{
            //    for (int i = 0; i < targetPath.Length; i++)
            //    {
            //        if (targetPath[i] == folder)
            //        {
            //            string name = Path.GetFileName(folder);
            //            string dest = Path.Combine(destFolder, name);
            //            this.CopyFolder(folder, dest);
            //        }
            //    }
            //}
        }

        public void SplashStart()
        {
            try
            {
                this.Splash = new SmartX.SmartSplash();
                this.Splash.CenterPosition = true;
                //this.Splash.Left = 462;
                //this.Splash.Top = 200;
                this.Splash.AnimationInterval = 200;
                this.Splash.LoadingImagePathname = "SmartLoading4";
                this.Splash.Start();
                this.Enabled = false;
            }
            catch
            {
            }
        }
        public void SplashFinish()
        {
            try
            {
                this.Splash.Finish();
                this.Enabled = true;

                this.EncFileName = "";
                this.SelectedDataType = Define.E_DataType.None;
            }
            catch
            {
            }
        }

        public List<string> DirectorySort(DirectoryInfo[] directorys)
        {
            List<string> listDirectory = new List<string>();
            Dictionary<string, int> dirNames = new Dictionary<string, int>();

            foreach (DirectoryInfo dir in directorys)
                if (dir.Name != "Log")
                    dirNames.Add(dir.Name, int.Parse(dir.Name));

            // 순서데로 오름차순 정렬
            var vrList = dirNames.OrderBy(x => x.Value);
            foreach (var v in vrList)
                listDirectory.Add(v.Key);

            return listDirectory;
        }
        private List<string> GetSeletedNodeList(TreeView tree)
        {
            int yearCNT, monthCNT, dayCNT;
            List<string> listSelectedFile = new List<string>();

            yearCNT = tree.Nodes.Count;
            if (yearCNT != 0)
            {
                for (int i = 0; i < yearCNT; i++)
                {
                    monthCNT = tree.Nodes[i].Nodes.Count;
                    if (monthCNT != 0)
                    {
                        for (int j = 0; j < monthCNT; j++)
                        {
                            dayCNT = tree.Nodes[i].Nodes[j].Nodes.Count;
                            if (dayCNT != 0)
                            {
                                for (int k = 0; k < dayCNT; k++)
                                {
                                    if (tree.Nodes[i].Nodes[j].Nodes[k].Checked == true)
                                    {
                                        //listSelectedFile.Add(tree.Nodes[i].Nodes[j].Nodes[k].Text);
                                        listSelectedFile.Add(string.Format("{0}\\{1}\\{2}", tree.Nodes[i].Text, tree.Nodes[i].Nodes[j].Text, tree.Nodes[i].Nodes[j].Nodes[k].Text));
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return listSelectedFile;
        }
        #endregion

        public void HelpLocation(int iValue, Collection<SmartButton> buttons, Collection<PictureBox> disablePictures, Collection<PictureBox> enablePictures)
        {
            // Control 크기
            int controlSizeX = 710;
            int controlSizeY = 470;

            // 버튼 크기
            int buttonSizeX = 340;
            int buttonSizeY = 78;

            int buttonFirstLocationX = 0, buttonFirstLocationY = 0, y = 0;

            switch (iValue)
            {
                case 2:
                case 3:
                case 4:
                    buttonFirstLocationX = (controlSizeX - buttonSizeX) / 2;
                    buttonFirstLocationY = (controlSizeY - ((buttonSizeY * iValue) + (iValue - 1) * 6)) / 2;

                    for (int i = 0; i < iValue; i++)
                    {
                        y = buttonFirstLocationY + (buttonSizeY + 6) * i;
                        buttons[i].Location = new Point(buttonFirstLocationX, y);
                        disablePictures[i].Location = new Point(buttonFirstLocationX + 29, y + 19);
                        enablePictures[i].Location = new Point(buttonFirstLocationX + 29, y + 19);
                    }
                    break;
                case 5:
                case 6:
                case 7:
                case 8:
                    buttonFirstLocationX = (controlSizeX - ((buttonSizeX * 2) + (6 * (iValue % 4)))) / 2;
                    buttonFirstLocationY = (controlSizeY - ((buttonSizeY * 4) + 3 * 6)) / 2;

                    for (int i = 0; i < iValue; i++)
                    {
                        if (i < 4)
                        {
                            y = buttonFirstLocationY + (buttonSizeY + 6) * i;
                            buttons[i].Location = new Point(buttonFirstLocationX, y);
                            disablePictures[i].Location = new Point(buttonFirstLocationX + 29, y + 19);
                            enablePictures[i].Location = new Point(buttonFirstLocationX + 29, y + 19);
                        }
                        else
                        {
                            y = buttonFirstLocationY + (buttonSizeY + 6) * (i % 4);
                            buttons[i].Location = new Point(buttonFirstLocationX + buttonSizeX + 6, y);
                            disablePictures[i].Location = new Point(buttonFirstLocationX + buttonSizeX + 6 + 29, y + 19);
                            enablePictures[i].Location = new Point(buttonFirstLocationX + buttonSizeX + 6 + 29, y + 19);
                        }
                    }
                    break;
                default:
                    break;
            }
        }

        private bool UI_Invoke(ThreadStart invoker)
        {
            try
            {
                if (this.InvokeRequired)
                {
                    if (this.IsDisposed)
                        return true;

                    this.Invoke(invoker);
                }
                else
                {
                    invoker();
                }

                return true;

            }
            catch (Exception e)
            {
                return false;
            }

        }

        public void CurrentControlEnable(bool enable)
        {
            foreach (SmartButton button in this.CollectionButtonMenu)
                button.Enabled = enable;

            switch (this.SelectedSideMenu)
            {
                case Define.E_MenuSide.Basic:
                    this.BottomBasic.CurrentControlEnable(enable);
                    break;
                case Define.E_MenuSide.Configuration:
                    this.BottomConfiguration.CurrentControlEnable(enable);
                    break;
                case Define.E_MenuSide.System:
                    this.BottomSystem.CurrentControlEnable(enable);
                    break;
                case Define.E_MenuSide.Equipment:
                    this.BottomEquipment.CurrentControlEnable(enable);
                    break;
                case Define.E_MenuSide.Information:
                    this.BottomInformation.CurrentControlEnable(enable);
                    break;
                default:
                    break;
            }
        }
        public void UpdateDisplayUser(SystemStatus status)
        {
            string id = "", group = "", expireDate = "";

            switch (status.CurrentUser.Group)
            {
                case Define.E_UserGroup.LogOut:
                    id = "";
                    if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German)
                        group = "Ausloggen";
                    else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
                        group = "登出";
                    else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Russian)
                        group = "Выйти.";
                    else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
                        group = "Cerrar sesión";
                    else
                        group = "Log out";

                    this.labelExpireOfPassword.Visible = false;

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

                    this.buttonBasic.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsBasicEnable;
                    this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsConfiEnable;
                    this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsSystemEnable;
                    this.buttonEquipment.Enabled = true;
                    this.buttonLog.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsLogEnable;
                    this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsInforEnable;
                    break;
                case Define.E_UserGroup.Level1:
                    id = status.CurrentUser.ID;
                    group = this.ParentForm.SystemConfig2.UserGroupLevel1Name;

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

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

                    this.buttonBasic.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsBasicEnable;
                    this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsConfiEnable;
                    this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsSystemEnable;
                    this.buttonEquipment.Enabled = true;
                    this.buttonLog.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsLogEnable;
                    this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsInforEnable;
                    break;
                case Define.E_UserGroup.Level2:
                    id = status.CurrentUser.ID;
                    group = this.ParentForm.SystemConfig2.UserGroupLevel2Name;

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

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

                    this.buttonBasic.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsBasicEnable;
                    this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsConfiEnable;
                    this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsSystemEnable;
                    this.buttonEquipment.Enabled = true;
                    this.buttonLog.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsLogEnable;
                    this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsInforEnable;
                    break;
                case Define.E_UserGroup.Level3:
                    id = status.CurrentUser.ID;
                    group = this.ParentForm.SystemConfig2.UserGroupLevel3Name;

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

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

                    this.buttonBasic.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsBasicEnable;
                    this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsConfiEnable;
                    this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsSystemEnable;
                    this.buttonEquipment.Enabled = true;
                    this.buttonLog.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsLogEnable;
                    this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsInforEnable;
                    break;
                case Define.E_UserGroup.Admin:
                    id = status.CurrentUser.ID;
                    if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German)
                        group = "Administrator";
                    else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
                        group = "行政";
                    else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Russian)
                        group = "Администратор";
                    else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
                        group = "Administrator";
                    else
                        group = "Administrator";

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

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

                    this.buttonBasic.Enabled = true;
                    this.buttonConfiguration.Enabled = true;
                    this.buttonSystem.Enabled = true;
                    this.buttonEquipment.Enabled = true;
                    this.buttonLog.Enabled = true;
                    this.buttonInformation.Enabled = true;
                    break;
                case Define.E_UserGroup.Developer:
                    id = status.CurrentUser.ID;
                    if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German)
                        group = "Entwickler";
                    else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
                        group = "开发商";
                    else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Russian)
                        group = "Разработчик";
                    else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
                        group = "Desarrollador";
                    else
                        group = "Developer";

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

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

                    this.buttonBasic.Enabled = true;
                    this.buttonConfiguration.Enabled = true;
                    this.buttonSystem.Enabled = true;
                    this.buttonEquipment.Enabled = true;
                    this.buttonLog.Enabled = true;
                    this.buttonInformation.Enabled = true;
                    break;
                case Define.E_UserGroup.NotLogin:
                    this.buttonBasic.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsBasicEnable;
                    this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsConfiEnable;
                    this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsSystemEnable;
                    this.buttonEquipment.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsEquipEnable;
                    this.buttonLog.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsLogEnable;
                    this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsInforEnable;
                    break;
                default:
                    id = "";
                    if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German)
                        group = "Ausloggen";
                    else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
                        group = "登出";
                    else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Russian)
                        group = "Выйти.";
                    else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
                        group = "Cerrar sesión";
                    else
                        group = "Log out";

                    this.labelExpireOfPassword.Visible = false;

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

                    this.buttonBasic.Enabled = false;
                    this.buttonConfiguration.Enabled = false;
                    this.buttonSystem.Enabled = false;
                    this.buttonEquipment.Enabled = false;
                    this.buttonLog.Enabled = true;
                    this.buttonInformation.Enabled = true;
                    break;
            }

            if (this.ParentForm.SystemConfig1.IsLogin == true)
            {
                if (this.ParentForm.SystemConfig3.IsPart11 == true)
                {
                    expireDate = this.ParentForm.ChildFormMainDisplay.DisplayExpireOfPassword(status.CurrentUser.Group);
                    if (expireDate != "-")
                    {
                        int intExpireDate = int.Parse(expireDate);

                        if (intExpireDate == 0)
                        {
                            this.labelExpireOfPassword.ForeColor = this.ParentForm.ColorLogOff;
                            this.labelExpireOfPassword.Text = "D-0";
                        }
                        else if (intExpireDate < 0)
                        {
                            if (intExpireDate * -1 > this.ParentForm.CurrentSystemStatus.CurrentUser.ExpirePassword)
                                expireDate = "-" + (this.ParentForm.CurrentSystemStatus.CurrentUser.ExpirePassword - 1).ToString();

                            if (intExpireDate >= -10)
                                this.labelExpireOfPassword.ForeColor = this.ParentForm.ColorLogOff;
                            else
                                this.labelExpireOfPassword.ForeColor = this.ParentForm.ColorLogOn;
                            this.labelExpireOfPassword.Text = "D" + expireDate;
                        }
                        else
                        {
                            this.labelExpireOfPassword.ForeColor = this.ParentForm.ColorLogOn;
                            this.labelExpireOfPassword.Text = "D+" + expireDate;
                        }
                    }
                    else
                    {
                        this.labelExpireOfPassword.ForeColor = this.ParentForm.ColorLogOn;
                        this.labelExpireOfPassword.Text = "-";
                    }
                }
                else
                {
                    this.labelExpireOfPassword.ForeColor = this.ParentForm.ColorLogOn;
                    this.labelExpireOfPassword.Text = "-";
                }
            }

            if (this.labelUserLevel.Text != group)
                this.labelUserLevel.Text = group;
            if (this.labelUserID.Text != id)
                this.labelUserID.Text = id;
        }
        private bool EquipmentRun(Define.E_DisplayStore currentDisplay)
        {
            if (currentDisplay == Define.E_DisplayStore.SystemJudgment
                || currentDisplay == Define.E_DisplayStore.SystemSorterSetting
                || currentDisplay == Define.E_DisplayStore.SystemBLDCMotorSetting)
                return true;
            else
                return false;
        }

        public void AlarmOccurs(int errorNum, string alarmRawData)
        {
            string errorName = "";

            switch (errorNum)
            {
                case 1:
                    #region a1_진입센서 에러
                    switch (this.ParentForm.SystemConfig1.Language)
                    {
                        case Define.E_LanguageID.Korean:
                            errorName = "a1_진입센서 에러";
                            break;
                        case Define.E_LanguageID.German:
                            errorName = "a1_Fehler Eingangssensor";
                            break;
                        case Define.E_LanguageID.Chinese:
                            errorName = "a1_入口传感器错误";
                            break;
                        case Define.E_LanguageID.Russian:
                            errorName = "a1_Ошибка датчика входа";
                            break;
                        case Define.E_LanguageID.Spanish:
                            errorName = "a1_Error en el sensor de entrada";
                            break;
                        case Define.E_LanguageID.Turkish:
                            errorName = "a1_Giriş Sensörü Hatası";
                            break;
                        case Define.E_LanguageID.French:
                            errorName = "a1_Erreur du capteur d'entrée";
                            break;
                        case Define.E_LanguageID.Czech:
                            break;
                        default:
                            errorName = "a1_Entry Sensor Error";
                            break;
                    }
                    #endregion
                    break;
                case 2:
                    #region a2_로드셀 에러
                    switch (this.ParentForm.SystemConfig1.Language)
                    {
                        case Define.E_LanguageID.Korean:
                            errorName = "a2_로드셀 에러";
                            break;
                        case Define.E_LanguageID.German:
                            errorName = "a2_Fehler Wägezelle";
                            break;
                        case Define.E_LanguageID.Chinese:
                            errorName = "a2_称重传感器错误";
                            break;
                        case Define.E_LanguageID.Russian:
                            errorName = "a2_Ошибка тензодатчика";
                            break;
                        case Define.E_LanguageID.Spanish:
                            errorName = "a2_Error en la celda de carga";
                            break;
                        case Define.E_LanguageID.Turkish:
                            errorName = "a2_Yük Hücresi Hatası";
                            break;
                        case Define.E_LanguageID.French:
                            errorName = "a2_Erreur de cellule de charge";
                            break;
                        case Define.E_LanguageID.Czech:
                            break;
                        default:
                            errorName = "a2_LoadCell Error";
                            break;
                    }
                    #endregion
                    break;
                case 3:
                    #region a3_공압 낮음
                    switch (this.ParentForm.SystemConfig1.Language)
                    {
                        case Define.E_LanguageID.Korean:
                            errorName = "a3_공압 낮음";
                            break;
                        case Define.E_LanguageID.German:
                            errorName = "a3_Niedriger Druck";
                            break;
                        case Define.E_LanguageID.Chinese:
                            errorName = "a3_低压";
                            break;
                        case Define.E_LanguageID.Russian:
                            errorName = "a3_Низкое давление воздуха";
                            break;
                        case Define.E_LanguageID.Spanish:
                            errorName = "a3_Baja presión";
                            break;
                        case Define.E_LanguageID.Turkish:
                            errorName = "a3_Düşük Basınç";
                            break;
                        case Define.E_LanguageID.French:
                            errorName = "a3_Basse pression";
                            break;
                        case Define.E_LanguageID.Czech:
                            break;
                        default:
                            errorName = "a3_Low Pressure";
                            break;
                    }
                    #endregion
                    break;
                case 4:
                    #region a4_문 열림 감지
                    switch (this.ParentForm.SystemConfig1.Language)
                    {
                        case Define.E_LanguageID.Korean:
                            errorName = "a4_문 열림 감지";
                            break;
                        case Define.E_LanguageID.German:
                            errorName = "a4_Türverriegelung";
                            break;
                        case Define.E_LanguageID.Chinese:
                            errorName = "a4_门联锁";
                            break;
                        case Define.E_LanguageID.Russian:
                            errorName = "a4_Обнаружение открытой двери";
                            break;
                        case Define.E_LanguageID.Spanish:
                            errorName = "a4_Enclavamiento de la puerta";
                            break;
                        case Define.E_LanguageID.Turkish:
                            errorName = "a4_Kapı Kilidi";
                            break;
                        case Define.E_LanguageID.French:
                            errorName = "a4_Interverrouillage de porte";
                            break;
                        case Define.E_LanguageID.Czech:
                            break;
                        default:
                            errorName = "a4_Door Interlock";
                            break;
                    }
                    #endregion
                    break;
                case 6:
                    #region a6_적체 에러
                    switch (this.ParentForm.SystemConfig1.Language)
                    {
                        case Define.E_LanguageID.Korean:
                            errorName = "a6_적체 에러";
                            break;
                        case Define.E_LanguageID.German:
                            errorName = "a6_Stapelfehler";
                            break;
                        case Define.E_LanguageID.Chinese:
                            errorName = "a6_堆叠错误";
                            break;
                        case Define.E_LanguageID.Russian:
                            errorName = "a6_Ошибка штабеля";
                            break;
                        case Define.E_LanguageID.Spanish:
                            errorName = "a6_Error de apilamiento";
                            break;
                        case Define.E_LanguageID.Turkish:
                            errorName = "a6_Yığma Hatası";
                            break;
                        case Define.E_LanguageID.French:
                            errorName = "a6_Erreur d'empilage";
                            break;
                        case Define.E_LanguageID.Czech:
                            break;
                        default:
                            errorName = "a6_Stack up Error";
                            break;
                    }
                    #endregion
                    break;
                case 7:
                    #region a7_선별부A 에러
                    switch (this.ParentForm.SystemConfig1.Language)
                    {
                        case Define.E_LanguageID.Korean:
                            errorName = "a7_선별부A 에러";
                            break;
                        case Define.E_LanguageID.German:
                            errorName = "a7_Fehler Sortierer A";
                            break;
                        case Define.E_LanguageID.Chinese:
                            errorName = "a7_分拣机 A 错误";
                            break;
                        case Define.E_LanguageID.Russian:
                            errorName = "a7_Ошибка сортировочного блока A";
                            break;
                        case Define.E_LanguageID.Spanish:
                            errorName = "a7_Error en el clasificador A";
                            break;
                        case Define.E_LanguageID.Turkish:
                            errorName = "a7_Sıralayıcı A Hatası";
                            break;
                        case Define.E_LanguageID.French:
                            errorName = "a7_Erreur du trieur A";
                            break;
                        case Define.E_LanguageID.Czech:
                            break;
                        default:
                            errorName = "a7_Sorter A Error";
                            break;
                    }
                    #endregion
                    break;
                case 8:
                    #region a8_비상정지
                    switch (this.ParentForm.SystemConfig1.Language)
                    {
                        case Define.E_LanguageID.Korean:
                            errorName = "a8_비상정지";
                            break;
                        case Define.E_LanguageID.German:
                            errorName = "a8_Not-Aus";
                            break;
                        case Define.E_LanguageID.Chinese:
                            errorName = "a8_紧急停止";
                            break;
                        case Define.E_LanguageID.Russian:
                            errorName = "a8_Аварийная остановка";
                            break;
                        case Define.E_LanguageID.Spanish:
                            errorName = "a8_Parada de emergencia";
                            break;
                        case Define.E_LanguageID.Turkish:
                            errorName = "a8_Acil Durdurma";
                            break;
                        case Define.E_LanguageID.French:
                            errorName = "a8_Arrêt d'urgence";
                            break;
                        case Define.E_LanguageID.Czech:
                            break;
                        default:
                            errorName = "a8_Emergency Stop";
                            break;
                    }
                    #endregion
                    break;
                case 9:
                    #region a9_인버터 에러
                    switch (this.ParentForm.SystemConfig1.Language)
                    {
                        case Define.E_LanguageID.Korean:
                            errorName = "a9_인버터 에러";
                            break;
                        case Define.E_LanguageID.German:
                            errorName = "a9_Wechselrichterfehler";
                            break;
                        case Define.E_LanguageID.Chinese:
                            errorName = "a9_逆变器错误";
                            break;
                        case Define.E_LanguageID.Russian:
                            errorName = "a9_Ошибка инвертора";
                            break;
                        case Define.E_LanguageID.Spanish:
                            errorName = "a9_Error del inversor";
                            break;
                        case Define.E_LanguageID.Turkish:
                            errorName = "a9_İnverter Hatası";
                            break;
                        case Define.E_LanguageID.French:
                            errorName = "a9_Erreur de l'onduleur";
                            break;
                        case Define.E_LanguageID.Czech:
                            break;
                        default:
                            errorName = "a9_Inverter Error";
                            break;
                    }
                    #endregion
                    break;
                case 13:
                    #region a13_방풍커버 열림
                    switch (this.ParentForm.SystemConfig1.Language)
                    {
                        case Define.E_LanguageID.Korean:
                            errorName = "a13_방풍커버 열림";
                            break;
                        case Define.E_LanguageID.German:
                            errorName = "a13_Windschutzscheibenabdeckung offen";
                            break;
                        case Define.E_LanguageID.Chinese:
                            errorName = "a13_挡风玻璃盖打开";
                            break;
                        case Define.E_LanguageID.Russian:
                            errorName = "a13_Открыта крышка ветрового стекла";
                            break;
                        case Define.E_LanguageID.Spanish:
                            errorName = "a13_Cubierta del parabrisas abierta";
                            break;
                        case Define.E_LanguageID.Turkish:
                            errorName = "a13_Rüzgar Geçirmez Açık";
                            break;
                        case Define.E_LanguageID.French:
                            errorName = "a13_Couvercle de pare-brise ouvert";
                            break;
                        case Define.E_LanguageID.Czech:
                            errorName = "";
                            break;
                        default:
                            errorName = "a13_Windshield cover open";
                            break;
                    }
                    #endregion
                    break;
                case 14:
                    #region a14_선별부B 에러
                    switch (this.ParentForm.SystemConfig1.Language)
                    {
                        case Define.E_LanguageID.Korean:
                            errorName = "a14_선별부B 에러";
                            break;
                        case Define.E_LanguageID.German:
                            errorName = "a14_Fehler Sortierer B";
                            break;
                        case Define.E_LanguageID.Chinese:
                            errorName = "a14_分拣机 B 错误";
                            break;
                        case Define.E_LanguageID.Russian:
                            errorName = "a14_Ошибка сортировочного блока B";
                            break;
                        case Define.E_LanguageID.Spanish:
                            errorName = "a14_Error en el clasificador B";
                            break;
                        case Define.E_LanguageID.Turkish:
                            errorName = "a14_Sıralayıcı B Hatası";
                            break;
                        case Define.E_LanguageID.French:
                            errorName = "a14_Erreur du trieur B";
                            break;
                        case Define.E_LanguageID.Czech:
                            break;
                        default:
                            errorName = "a14_Sorter B Error";
                            break;
                    }
                    #endregion
                    break;
                case 18:
                    #region a18_제품진입 미감지
                    switch (this.ParentForm.SystemConfig1.Language)
                    {
                        case Define.E_LanguageID.Korean:
                            errorName = "a18_제품진입 미감지";
                            break;
                        case Define.E_LanguageID.German:
                            errorName = "a18_Produkteingang nicht erkannt";
                            break;
                        case Define.E_LanguageID.Chinese:
                            errorName = "a18_产品入口未检测到";
                            break;
                        case Define.E_LanguageID.Russian:
                            errorName = "a14_Ошибка сортировочного блока B";
                            break;
                        case Define.E_LanguageID.Spanish:
                            errorName = "a18_Entrada de producto no detectada";
                            break;
                        case Define.E_LanguageID.Turkish:
                            errorName = "a18_Ürün girişi algılanmadı";
                            break;
                        case Define.E_LanguageID.French:
                            errorName = "a18_Entrée de produit non détectée";
                            break;
                        case Define.E_LanguageID.Czech:
                            break;
                        default:
                            errorName = "a18_Product entry undetected";
                            break;
                    }
                    #endregion
                    break;
                default:
                    break;
            }

            this.MainAlarm.listBoxMessage.Items.Add(errorName);
        }
        public void UpdateDisplayAlarmView(AlarmList alarm, string alarmData)
        {
            if (alarm.IsLoadCellError == true || alarm.IsInverterError == true || alarm.IsEmergencyStop == true || alarm.IsDoorInterlock == true
                || alarm.IsPressureSensingError == true || alarm.IsStackUpSensorError == true
                || alarm.IsEntrySensorError == true || alarm.IsEntryNotDetected == true)
            {
                if (this.pictureBoxIconAlarm.Visible == false)
                    this.pictureBoxIconAlarm.Visible = true;

                if (alarm.IsEntryNotDetected == true)
                    this.ParentForm.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
                //if (alarm.IsStackUpSensorError == true)
                //{
                //    if (int.Parse(this.ParentForm.CurrentSystemParameter1.OptionBoard) != 2) // 디스펜서 사용 시, 컨베어 미정지
                //    {
                //        this.ParentForm.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
                //        if (this.ParentForm.SystemConfig3.IsStartStopLog == true)
                //            this.ParentForm.smartFileStartStopLog.WriteString(string.Format("Send Stop ({0:yyyy-MM-dd HH:mm:ss}): FormMainDisplay-UpdateDisplayAlarmView2", DateTime.Now));
                //    }
                //}

                if (alarm.Flag == true)
                {
                    if (this.ParentForm.SystemConfig1.IsExternalInputLamp == true)
                        this.ParentForm.OnExternalInputLampSignal(true);
                    if (this.ParentForm.SystemConfig1.IsExternalInputBuzzer == true)
                        this.ParentForm.OnExternalInputBuzzerSignal(true);
                }
            }
            else
            {
                this.pictureBoxIconAlarm.Visible = false;
                this.MainAlarm.Visible = false;

                if (this.ParentForm.SystemConfig1.IsExternalInputLamp == true)
                    this.ParentForm.OnExternalInputLampSignal(false);
                if (this.ParentForm.SystemConfig1.IsExternalInputBuzzer == true)
                    this.ParentForm.OnExternalInputBuzzerSignal(false);

                return;
            }

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

            if (alarm.IsEntrySensorError == true)
                this.AlarmOccurs(1, alarmData);
            if (alarm.IsLoadCellError == true)
                this.AlarmOccurs(2, alarmData);
            if (alarm.IsPressureSensingError == true)
                this.AlarmOccurs(3, alarmData);
            if (alarm.IsDoorInterlock == true)
                this.AlarmOccurs(4, alarmData);
            if (alarm.IsStackUpSensorError == true)
                this.AlarmOccurs(6, alarmData);
            if (alarm.IsEmergencyStop == true)
                this.AlarmOccurs(8, alarmData);
            if (alarm.IsInverterError == true)
                this.AlarmOccurs(9, alarmData);
            if (alarm.IsEntryNotDetected == true)
                this.AlarmOccurs(18, alarmData);
        }

        public void CallBackGetUserData(UserManager.UserMgr_user_list_t userList)
        {
            this.CenterEquipUser.CallBackGetUserData(userList);
        }
        public void CallBackUserListLockDataEvent(UserManager.UserMgr_user_lock_t user)
        {
            this.CenterEquipUser.CallBackUserListLockDataEvent(user);
        }
        public void CallBackUserListDeleteDataEvent(UserManager.UserMgr_user_del_t user)
        {
            this.CenterEquipUser.CallBackUserListDeleteDataEvent(user);
        }
        public void CallBackUserModifyUserData(UserManager.UserMgr_user_modify_t user)
        {
            this.CenterEquipUser.CallBackUserModifyUserData(user);
        }
        public void CallBackUserListModifyInfoData(UserManager.UserMgr_user_info_t user)
        {
            try
            {
                if (this.ParentForm.CurrentSystemStatus.CurrentDisplay == Define.E_DisplayStore.EquipUser)
                    this.CenterEquipUser.CallBackUserListModifyInfoDataEvent(user);
                else if (this.ParentForm.CurrentSystemStatus.CurrentDisplay == Define.E_DisplayStore.EquipMyPage)
                    this.CenterEquipMyPage.CallBackUserListModifyInfoDataEvent(user);
            }
            catch (Exception ex)
            {
                FormMain.Exception(ex);
            }
        }
        public void CallBackUserListNewData(UserManager.UserMgr_user_info_t user)
        {
            this.CenterEquipUser.CallBackUserListNewData(user);
        }

        public void CallBackEncryptionEvent(Encryption.auth_encryption_status_t sender)
        {
            if (sender.inFileName == this.EncFileName)
            {
                this.UI_Invoke(delegate
                {
                    //this.labelPercentage.Text = string.Format("{0} %", sender.percentage);
                    //if (this.ParentForm.IsCommunicationLogOpen == true)
                    //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("CallBackEncryptionEvent() ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sender.percentage));
                });

                if (sender.percentage == 100)
                {
                    this.timerTimeout.Enabled = false;
                    //if (this.ParentForm.IsCommunicationLogOpen == true)
                    //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("CallBackEncryptionEvent() ({0:yyyy-MM-dd HH:mm:ss}): timeout false", DateTime.Now));

                    if (sender.status == 0)
                    {
                        if (this.Q_FileList.Count != 0)
                        {
                            this.UI_Invoke(delegate
                            {
                                this.timerEncryption.Enabled = true;
                            });

                        }
                        else
                        {
                            this.UI_Invoke(delegate
                            {
                                this.timerFileCopy.Enabled = true;
                            });
                        }
                    }
                }
            }
        }

        private void DisplaySideMenu(Define.E_MenuSide menu)
        {
            // Log - smartFile Close
            this.FileClose();

            switch (menu)
            {
                case Define.E_MenuSide.Basic:
                    this.BottomBasic.Visible = true;
                    this.BottomConfiguration.Visible = false;
                    this.BottomSystem.Visible = false;
                    this.BottomEquipment.Visible = false;
                    this.BottomLog.Visible = false;
                    this.BottomInformation.Visible = false;

                    this.BottomBasic.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    break;
                case Define.E_MenuSide.Configuration:
                    this.BottomBasic.Visible = false;
                    this.BottomConfiguration.Visible = true;
                    this.BottomSystem.Visible = false;
                    this.BottomEquipment.Visible = false;
                    this.BottomLog.Visible = false;
                    this.BottomInformation.Visible = false;

                    this.BottomConfiguration.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    break;
                case Define.E_MenuSide.System:
                    this.BottomBasic.Visible = false;
                    this.BottomConfiguration.Visible = false;
                    this.BottomSystem.Visible = true;
                    this.BottomEquipment.Visible = false;
                    this.BottomLog.Visible = false;
                    this.BottomInformation.Visible = false;

                    this.BottomSystem.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    break;
                case Define.E_MenuSide.Equipment:
                    this.BottomBasic.Visible = false;
                    this.BottomConfiguration.Visible = false;
                    this.BottomSystem.Visible = false;
                    this.BottomEquipment.Visible = true;
                    this.BottomLog.Visible = false;
                    this.BottomInformation.Visible = false;

                    this.BottomEquipment.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    break;
                case Define.E_MenuSide.Log:
                    this.BottomBasic.Visible = false;
                    this.BottomConfiguration.Visible = false;
                    this.BottomSystem.Visible = false;
                    this.BottomEquipment.Visible = false;
                    this.BottomLog.Visible = true;
                    this.BottomInformation.Visible = false;

                    this.BottomLog.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    break;
                case Define.E_MenuSide.Information:
                    this.BottomBasic.Visible = false;
                    this.BottomConfiguration.Visible = false;
                    this.BottomSystem.Visible = false;
                    this.BottomEquipment.Visible = false;
                    this.BottomLog.Visible = false;
                    this.BottomInformation.Visible = true;

                    this.BottomInformation.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    break;
                default:
                    break;
            }
        }
        public void DisplayHiddenMenu(Define.E_DisplayStore menu, SystemConfigurationItem1 systemConfig1)
        {
            // Log - smartFile Close
            this.FileClose();

            switch (menu)
            {
                case Define.E_DisplayStore.MainDisplay:
                    this.ParentForm.ChildFormMainDisplay.DisplayHiddenMenu(true);
                    break;
                case Define.E_DisplayStore.ConfiEthernet:
                    this.CenterConfiEthernet.DisplayHiddenMenu(true);
                    break;
                case Define.E_DisplayStore.EquipInitialize:
                    this.CenterEquipInitialize.DisplayHiddenMenu(true);
                    break;
                case Define.E_DisplayStore.EquipFuctionSetting:
                    this.CenterEquipFunctionSetting.DisplayHiddenMenu(true);
                    break;
                case Define.E_DisplayStore.InforSystem:
                    string temp = systemConfig1.MainBoardVersion.Replace(".", "");
                    try
                    {
                        if (int.Parse(temp) >= 20000)
                            this.CenterInforSystem.DisplayHiddenMenu(true);
                    }
                    catch
                    {
                    }
                    break;
                case Define.E_DisplayStore.EquipUser:
                    this.CenterEquipUser.DisplayHiddenMenu(true);
                    break;
                case Define.E_DisplayStore.SystemJudgment:
                    this.CenterSystemJudgment.DisplayHiddenMenu(true);
                    break;
                case Define.E_DisplayStore.EquipHelp:
                    DialogFormPasswordKeyPad password = new DialogFormPasswordKeyPad(8, this.ParentForm.SystemConfig1.Language, this.ParentForm.CurrentSystemStatus.CurrentUserPasswordType);
                    DialogResult dialogResult = password.ShowDialog();
                    if (dialogResult == DialogResult.OK)
                    {
                        this.CenterEquipHelp.DisplayHiddenEngineer(true);
                        this.BottomEquipment.DisplayHiddenEngineer(true);
                        //this.CenterEquipHelp.DisplayHiddenManufacturer(this.ParentForm.IsManufacturerVisible);
                        //this.BottomEquipment.DisplayHiddenManufacturer(this.ParentForm.IsManufacturerVisible);
                    }
                    break;
                default:
                    break;
            }
        }
        public void DisplayBottomBasic(Define.E_MenuBottomBasic menu)
        {
            switch (menu)
            {
                case Define.E_MenuBottomBasic.DataStatistics:
                    this.CenterBasicDataStatistics.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterBasicDataStatistics.BringToFront();
                    break;
                case Define.E_MenuBottomBasic.Help:
                    this.CenterBasicHelp.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterBasicHelp.BringToFront();
                    break;
                case Define.E_MenuBottomBasic.Product:
                    this.CenterBasicProduct.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterBasicProduct.BringToFront();
                    break;
                case Define.E_MenuBottomBasic.Time:
                    this.CenterBasicTime.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterBasicTime.BringToFront();
                    break;
                default:
                    break;
            }

            this.BottomBasic.UpdateDisplayMenuButton(menu);
        }
        public void DisplayBottomConfiguration(Define.E_MenuBottomConfiguration menu)
        {
            switch (menu)
            {
                case Define.E_MenuBottomConfiguration.SerialCOM1:
                    this.BottomConfiguration.CurrentMenu = Define.E_MenuBottomConfiguration.SerialCOM1;
                    this.CenterConfiSerial.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterConfiSerial.BringToFront();
                    break;
                case Define.E_MenuBottomConfiguration.SerialCOM3:
                    this.BottomConfiguration.CurrentMenu = Define.E_MenuBottomConfiguration.SerialCOM3;
                    this.CenterConfiSerial.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterConfiSerial.BringToFront();
                    break;
                case Define.E_MenuBottomConfiguration.SerialCOM4:
                    this.BottomConfiguration.CurrentMenu = Define.E_MenuBottomConfiguration.SerialCOM4;
                    this.CenterConfiSerial.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterConfiSerial.BringToFront();
                    break;
                case Define.E_MenuBottomConfiguration.Ethernet:
                    this.BottomConfiguration.CurrentMenu = Define.E_MenuBottomConfiguration.Ethernet;
                    this.CenterConfiEthernet.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterConfiEthernet.BringToFront();
                    break;
                case Define.E_MenuBottomConfiguration.Help:
                    this.CenterConfiHelp.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterConfiHelp.BringToFront();
                    break;
                case Define.E_MenuBottomConfiguration.OptionBoard:
                    this.CenterConfiOptionBoard.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterConfiOptionBoard.BringToFront();
                    break;
                default:
                    break;
            }

            this.BottomConfiguration.UpdateDisplayMenuButton(menu);
        }
        public void DisplayBottomSystem(Define.E_MenuBottomSystem menu)
        {
            switch (menu)
            {
                case Define.E_MenuBottomSystem.Calibration:
                    this.CenterSystemCalibration.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterSystemCalibration.BringToFront();
                    break;
                case Define.E_MenuBottomSystem.Help:
                    this.CenterSystemHelp.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterSystemHelp.BringToFront();
                    break;
                case Define.E_MenuBottomSystem.IOTest:
                    this.CenterSystemIOTest.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterSystemIOTest.BringToFront();
                    break;
                case Define.E_MenuBottomSystem.JudgmentSetting:
                    this.CenterSystemJudgment.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterSystemJudgment.BringToFront();
                    break;
                case Define.E_MenuBottomSystem.SorterSetting:
                    this.CenterSystemSorterSetting.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterSystemSorterSetting.BringToFront();
                    break;
                case Define.E_MenuBottomSystem.AutoZero:
                    this.CenterSystemAutoZero.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterSystemAutoZero.BringToFront();
                    break;
                case Define.E_MenuBottomSystem.ExternalOutput:
                    this.CenterSystemExternalOutput.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterSystemExternalOutput.BringToFront();
                    break;
                case Define.E_MenuBottomSystem.BLDCMotorSetting:
                    this.CenterSystemBLDCMotorSetting.DisplayRefresh(this.ParentForm.CurrentSystemStatus, this.ParentForm.CollectionBLDCParameter);
                    this.CenterSystemBLDCMotorSetting.BringToFront();
                    break;
                default:
                    break;
            }

            this.BottomSystem.UpdateDisplayMenuButton(menu);
        }
        public void DisplayBottomEquipment(Define.E_MenuBottomEquipment menu)
        {
            //if (this.ParentForm.CurrentSystemStatus.CurrentUser.Group == Define.E_UserGroup.Developer 
            //    && this.ParentForm.SystemConfig1.IsLogin == true)
            //    this.BottomEquipment.DisplayHiddenMenu(true);
            //else
            //    this.BottomEquipment.DisplayHiddenMenu(false);

            this.BottomEquipment.UpdateDisplayMenuButton(menu);

            switch (menu)
            {
                case Define.E_MenuBottomEquipment.Help:
                    this.CenterEquipHelp.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterEquipHelp.BringToFront();
                    break;
                case Define.E_MenuBottomEquipment.Initialize:
                    this.CenterEquipInitialize.BringToFront();
                    this.Refresh();
                    this.CenterEquipInitialize.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    break;
                case Define.E_MenuBottomEquipment.Update:
                    this.CenterEquipUpdate.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterEquipUpdate.BringToFront();
                    break;
                case Define.E_MenuBottomEquipment.FunctionSetting:
                    this.CenterEquipFunctionSetting.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterEquipFunctionSetting.BringToFront();
                    break;
                case Define.E_MenuBottomEquipment.User:
                    this.DisplayUserScreen(this.ParentForm.CurrentUserGroup);
                    break;
                case Define.E_MenuBottomEquipment.Engineer:
                    this.BottomEquipment.DisplayHiddenEngineer(true);
                    this.CenterEquipEngineer.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterEquipEngineer.BringToFront();
                    break;
                default:
                    break;
            }

            this.BottomEquipment.UpdateDisplayMenuButton(menu);
        }
        public void DisplayBottomLog(Define.E_MenuBottomLog menu)
        {
            // Log - smartFile Close
            this.FileClose();

            this.BottomLog.UpdateDisplayMenuButton(menu);

            switch (menu)
            {
                case Define.E_MenuBottomLog.Help:
                    this.CenterLogHelp.BringToFront();
                    this.CenterLogHelp.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    break;
                case Define.E_MenuBottomLog.LogInspection:
                    this.CenterLogInspection.BringToFront();
                    this.CenterLogInspection.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    break;
                case Define.E_MenuBottomLog.LogHistory:
                    this.CenterLogHistory.BringToFront();
                    this.CenterLogHistory.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    break;
                case Define.E_MenuBottomLog.LogOthers:
                    this.CenterLogOthers.BringToFront();
                    this.CenterLogOthers.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    break;
                default:
                    break;
            }
        }
        public void DisplayBottomInformation(Define.E_MenuBottomInformation menu)
        {
            switch (menu)
            {
                case Define.E_MenuBottomInformation.Help:
                    this.CenterInforHelp.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterInforHelp.BringToFront();
                    break;
                case Define.E_MenuBottomInformation.SystemInformation:
                    this.CenterInforSystem.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterInforSystem.BringToFront();
                    break;
                case Define.E_MenuBottomInformation.AS:
                    this.CenterInforAS.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterInforAS.BringToFront();
                    break;
                default:
                    break;
            }
            this.BottomInformation.UpdateDisplayMenuButton(menu);
        }
        public void UpdateEquipmentStatusDisplay(Define.E_EquipmentStatus status)
        {
            if (status == Define.E_EquipmentStatus.Start)
            {
                this.buttonBasic.Enabled = false;
                this.buttonConfiguration.Enabled = false;
                this.buttonSystem.Enabled = false;
                this.buttonEquipment.Enabled = false;
                this.buttonLog.Enabled = false;
                this.buttonInformation.Enabled = false;
                this.buttonMain.Enabled = false;

                this.BottomBasic.Enabled = false;
                this.BottomConfiguration.Enabled = false;
                this.BottomEquipment.Enabled = false;
                this.BottomInformation.Enabled = false;
                this.BottomSystem.Enabled = false;
                this.BottomLog.Enabled = false;

                this.pictureBoxStart.Visible = true;
                this.pictureBoxStop.Visible = false;

                if (this.ParentForm.CurrentSystemStatus.CurrentDisplay == Define.E_DisplayStore.SystemJudgment)
                    this.CenterSystemJudgment.UpdateEquipmentStatusDisplay(status);
                else if (this.ParentForm.CurrentSystemStatus.CurrentDisplay == Define.E_DisplayStore.SystemSorterSetting)
                    this.CenterSystemSorterSetting.UpdateEquipmentStatusDisplay(status);
            }
            else
            {
                this.buttonBasic.Enabled = true;
                this.buttonConfiguration.Enabled = true;
                this.buttonSystem.Enabled = true;
                this.buttonEquipment.Enabled = true;
                this.buttonLog.Enabled = true;
                this.buttonInformation.Enabled = true;
                this.buttonMain.Enabled = true;

                this.BottomBasic.Enabled = true;
                this.BottomConfiguration.Enabled = true;
                this.BottomEquipment.Enabled = true;
                this.BottomInformation.Enabled = true;
                this.BottomSystem.Enabled = true;
                this.BottomLog.Enabled = true;

                this.pictureBoxStart.Visible = false;
                this.pictureBoxStop.Visible = true;

                if (this.ParentForm.CurrentSystemStatus.CurrentDisplay == Define.E_DisplayStore.SystemJudgment)
                    this.CenterSystemJudgment.UpdateEquipmentStatusDisplay(status);
                else if (this.ParentForm.CurrentSystemStatus.CurrentDisplay == Define.E_DisplayStore.SystemSorterSetting)
                    this.CenterSystemSorterSetting.UpdateEquipmentStatusDisplay(status);
            }
        }
        public void UpdateMenuExceptBarcodeDisplay(bool bValue)
        {
            this.buttonBasic.Enabled = bValue;
            this.buttonConfiguration.Enabled = bValue;
            this.buttonSystem.Enabled = bValue;
            this.buttonEquipment.Enabled = bValue;
            this.buttonInformation.Enabled = bValue;
            this.buttonMain.Enabled = bValue;

            this.BottomBasic.Enabled = bValue;
            this.BottomConfiguration.Enabled = bValue;
            this.BottomEquipment.Enabled = bValue;
            this.BottomInformation.Enabled = bValue;
            this.BottomSystem.Enabled = bValue;
        }
        private void DisplayUserScreen(UserGroup group)
        {
            switch (this.ParentForm.CurrentSystemStatus.CurrentUser.Group)
            {
                case Define.E_UserGroup.Level1:
                    //if (group.Level1.IsEquipUserSetting == true)
                    //{
                    //    this.CenterEquipUser.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    //    this.CenterEquipUser.BringToFront();
                    //}
                    //else
                    //{
                        this.CenterEquipMyPage.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                        this.CenterEquipMyPage.BringToFront();
                    //}
                    break;
                case Define.E_UserGroup.Level2:
                    //if (group.Level2.IsEquipUserSetting == true)
                    //{
                    //    this.CenterEquipUser.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    //    this.CenterEquipUser.BringToFront();
                    //}
                    //else
                    //{
                        this.CenterEquipMyPage.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                        this.CenterEquipMyPage.BringToFront();
                    //}
                    break;
                case Define.E_UserGroup.Level3:
                    //if (group.Level3.IsEquipUserSetting == true)
                    //{
                        this.CenterEquipUser.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                        this.CenterEquipUser.BringToFront();
                    //}
                    //else
                    //{
                    //    this.CenterEquipMyPage.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    //    this.CenterEquipMyPage.BringToFront();
                    //}
                    break;
                case Define.E_UserGroup.Developer:
                case Define.E_UserGroup.Admin:
                    this.CenterEquipUser.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
                    this.CenterEquipUser.BringToFront();
                    break;
                default:
                    break;
            }
        }

        public void UpdateMenuDisplay(SystemStatus status)
        {
            switch (status.CurrentUser.Group)
            {
                case Define.E_UserGroup.Level1:
                    this.buttonBasic.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsBasicEnable;
                    this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsConfiEnable;
                    this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsSystemEnable;
                    this.buttonEquipment.Enabled = true;
                    this.buttonLog.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsLogEnable;
                    this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsInforEnable;
                    break;
                case Define.E_UserGroup.Level2:
                    this.buttonBasic.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsBasicEnable;
                    this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsConfiEnable;
                    this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsSystemEnable;
                    this.buttonEquipment.Enabled = true;
                    this.buttonLog.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsLogEnable;
                    this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsInforEnable;
                    break;
                case Define.E_UserGroup.Level3:
                    this.buttonBasic.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsBasicEnable;
                    this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsConfiEnable;
                    this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsSystemEnable;
                    this.buttonEquipment.Enabled = true;
                    this.buttonLog.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsLogEnable;
                    this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsInforEnable;
                    break;
                case Define.E_UserGroup.Admin:
                case Define.E_UserGroup.Developer:
                    this.buttonBasic.Enabled = true;
                    this.buttonConfiguration.Enabled = true;
                    this.buttonSystem.Enabled = true;
                    this.buttonEquipment.Enabled = true;
                    this.buttonLog.Enabled = true;
                    this.buttonInformation.Enabled = true;
                    break;
                case Define.E_UserGroup.NotLogin:
                    this.buttonBasic.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsBasicEnable;
                    this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsConfiEnable;
                    this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsSystemEnable;
                    this.buttonEquipment.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsEquipEnable;
                    this.buttonLog.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsLogEnable;
                    this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsInforEnable;
                    break;
                default:
                    break;
            }
        }

        public void ChangeToMainScreen()
        {
            if (this.CenterConfiEthernet != null)
            {
                if (this.CenterConfiEthernet.timerServer.Enabled == true)
                    this.CenterConfiEthernet.timerServer.Enabled = false;
            }

            //if (this.ParentForm.SystemConfig2.Barcode == 2) // DataLogic 바코드 사용 시
            //{
            //    this.ParentForm.ChangeSerialCOM3FrameSeparateType(DataStore.SeparateType.ETXONLY);
            //    this.ParentForm.TransferSerialCOM3RawData(Barcode.ExitProgrammingMode);
            //}

            this.ParentForm.ChildFormMainDisplay.DisplayHiddenMenu(false);

            if (this.ParentForm.SystemConfig2.EthernetOperationMode == 2)
                this.ParentForm.EthernetClientDisconnect();

            if (this.ParentForm.ChildFormMainDisplay.MainFeedback.IsUsingFeedback() == true)
            {
                string feedbackValue = "";

                if (this.ParentForm.CurrentSystemParameter2.OPT1IsWeightSetting == "1")
                {
                    this.ParentForm.CurrentSystemParameter2.OPT1OverRange =
                        (this.ParentForm.CurrentProductItem.PassRangeInt + this.ParentForm.CurrentFeedbackItem.OverRangeDeviationInt).ToString();

                    this.ParentForm.CurrentSystemParameter2.OPT1UnderRange =
                        (this.ParentForm.CurrentProductItem.PassRangeInt + this.ParentForm.CurrentFeedbackItem.UnderRangeDeviationInt).ToString();
                }
                else
                {
                    this.ParentForm.CurrentSystemParameter2.OPT1OverRange = this.ParentForm.CurrentProductItem.OverRange;
                    this.ParentForm.CurrentSystemParameter2.OPT1UnderRange = this.ParentForm.CurrentProductItem.UnderRange;
                    this.ParentForm.CurrentFeedbackItem.OverRangeDeviation = this.ParentForm.CurrentProductItem.OverRangeDeviation.ToString();
                    this.ParentForm.CurrentFeedbackItem.UnderRangeDeviation = this.ParentForm.CurrentProductItem.UnderRangeDeviation.ToString();
                }

                this.ParentForm.SaveSystemParameter2File(this.ParentForm.CurrentSystemParameter2);
                feedbackValue = Helper.StringZeroFillDigits7(this.ParentForm.CurrentSystemParameter2.OPT1OverRange);
                this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.OPT1OverRange, feedbackValue);
                feedbackValue = Helper.StringZeroFillDigits7(this.ParentForm.CurrentSystemParameter2.OPT1UnderRange);
                this.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.OPT1UnderRange, feedbackValue);
            }

            this.ParentForm.ChildFormMainDisplay.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
            ((FormMain)(Owner)).smartForm.Show((int)Define.E_FormStore.FormMainDisplay);
        }
        public void DisplayTitleRoot(SystemStatus status)
        {
            switch (this.ParentForm.SystemConfig1.Language)
            {
                case Define.E_LanguageID.English:
                    #region 영문
                    switch (status.CurrentDisplay)
                    {
                        case Define.E_DisplayStore.BasicDataStatistics:
                            this.labelTitleRoot.Text = "Basic > Data statistics";
                            break;
                        case Define.E_DisplayStore.BasicHelp:
                            this.labelTitleRoot.Text = "Basic > Help";
                            break;
                        case Define.E_DisplayStore.BasicProduct:
                            this.labelTitleRoot.Text = "Basic > Product settings";
                            break;
                        case Define.E_DisplayStore.BasicRandomMode:
                            this.labelTitleRoot.Text = "Basic > Product settings > Random Mode";
                            break;
                        case Define.E_DisplayStore.BasicTime:
                            this.labelTitleRoot.Text = "Basic > Time setting";
                            break;
                        case Define.E_DisplayStore.ConfiSerial:
                            if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM1)
                                this.labelTitleRoot.Text = "Configuration > Serial(COM1)";
                            else if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM3)
                                this.labelTitleRoot.Text = "Configuration > Serial(COM3)";
                            else if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM4)
                                this.labelTitleRoot.Text = "Configuration > Serial(COM4)";
                            break;
                        case Define.E_DisplayStore.ConfiEthernet:
                            this.labelTitleRoot.Text = "Configuration > Ethernet";
                            break;
                        case Define.E_DisplayStore.ConfiHelp:
                            this.labelTitleRoot.Text = "Configuration > Help";
                            break;
                        case Define.E_DisplayStore.ConfiOptionBoard:
                            this.labelTitleRoot.Text = "Configuration > Option board";
                            break;
                        case Define.E_DisplayStore.EquipFuctionSetting:
                            this.labelTitleRoot.Text = "Equipment > Feature Settings";
                            break;
                        case Define.E_DisplayStore.EquipHelp:
                            this.labelTitleRoot.Text = "Equipment > Help";
                            break;
                        case Define.E_DisplayStore.EquipInitialize:
                            this.labelTitleRoot.Text = "Equipment > Initialization";
                            break;
                        case Define.E_DisplayStore.EquipUpdate:
                            this.labelTitleRoot.Text = "Equipment > Update";
                            break;
                        case Define.E_DisplayStore.EquipUser:
                        case Define.E_DisplayStore.EquipMyPage:
                            this.labelTitleRoot.Text = "Equipment > User Settings";
                            break;
                        case Define.E_DisplayStore.EquipEngineer:
                            this.labelTitleRoot.Text = "Equipment > Engineer Settings";
                            break;
                        case Define.E_DisplayStore.LogHelp:
                            this.labelTitleRoot.Text = "Log > Help";
                            break;
                        case Define.E_DisplayStore.LogInspection:
                            this.labelTitleRoot.Text = "Log > Inspection";
                            break;
                        case Define.E_DisplayStore.LogHistory:
                            this.labelTitleRoot.Text = "Log > History";
                            break;
                        case Define.E_DisplayStore.LogOthers:
                            this.labelTitleRoot.Text = "Log > Others";
                            break;
                        case Define.E_DisplayStore.InforAS:
                            this.labelTitleRoot.Text = "Information > A/S";
                            break;
                        case Define.E_DisplayStore.InforHelp:
                            this.labelTitleRoot.Text = "Information > Help";
                            break;
                        case Define.E_DisplayStore.InforSystem:
                            this.labelTitleRoot.Text = "Information > Information";
                            break;
                        case Define.E_DisplayStore.SystemAutoZero:
                            this.labelTitleRoot.Text = "System > Auto zero";
                            break;
                        case Define.E_DisplayStore.SystemCalibration:
                            this.labelTitleRoot.Text = "System > Calibration";
                            break;
                        case Define.E_DisplayStore.SystemExternalOutput:
                            this.labelTitleRoot.Text = "System > External output";
                            break;
                        case Define.E_DisplayStore.SystemHelp:
                            this.labelTitleRoot.Text = "System > Help";
                            break;
                        case Define.E_DisplayStore.SystemIOTest:
                            this.labelTitleRoot.Text = "System > I/O test";
                            break;
                        case Define.E_DisplayStore.SystemJudgment:
                            this.labelTitleRoot.Text = "System > Judgment";
                            break;
                        case Define.E_DisplayStore.SystemSorterSetting:
                            this.labelTitleRoot.Text = "System > Sorter settings";
                            break;
                        case Define.E_DisplayStore.SystemBLDCMotorSetting:
                            this.labelTitleRoot.Text = "System > BLDC settings";
                            break;
                        default:
                            break;
                    } 
                    #endregion
                    break;
                case Define.E_LanguageID.Chinese:
                    #region 중문
                    switch (status.CurrentDisplay)
                    {
                        case Define.E_DisplayStore.BasicDataStatistics:
                            this.labelTitleRoot.Text = "基本 > 数据统计";
                            break;
                        case Define.E_DisplayStore.BasicHelp:
                            this.labelTitleRoot.Text = "基本 > 帮助";
                            break;
                        case Define.E_DisplayStore.BasicProduct:
                            this.labelTitleRoot.Text = "基本 > 产品设置";
                            break;
                        case Define.E_DisplayStore.BasicRandomMode:
                            this.labelTitleRoot.Text = "基本 > 产品设置 > 随机模式";
                            break;
                        case Define.E_DisplayStore.BasicTime:
                            this.labelTitleRoot.Text = "基本 > 时间设定";
                            break;
                        case Define.E_DisplayStore.ConfiSerial:
                            if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM1)
                                this.labelTitleRoot.Text = "选项 > 串行端口(COM1)";
                            else if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM3)
                                this.labelTitleRoot.Text = "选项 > 串行端口(COM3)";
                            else if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM4)
                                this.labelTitleRoot.Text = "选项 > 串行端口(COM4)";
                            break;
                        case Define.E_DisplayStore.ConfiEthernet:
                            this.labelTitleRoot.Text = "选项 > 以太网";
                            break;
                        case Define.E_DisplayStore.ConfiHelp:
                            this.labelTitleRoot.Text = "选项 > 帮助";
                            break;
                        case Define.E_DisplayStore.ConfiOptionBoard:
                            this.labelTitleRoot.Text = "选项 > 选项板";
                            break;
                        case Define.E_DisplayStore.EquipFuctionSetting:
                            this.labelTitleRoot.Text = "设备 > 功能设定";
                            break;
                        case Define.E_DisplayStore.EquipHelp:
                            this.labelTitleRoot.Text = "设备 > 帮助";
                            break;
                        case Define.E_DisplayStore.EquipInitialize:
                            this.labelTitleRoot.Text = "设备 > 工厂初期化";
                            break;
                        case Define.E_DisplayStore.EquipUpdate:
                            this.labelTitleRoot.Text = "设备 > 更新";
                            break;
                        case Define.E_DisplayStore.EquipUser:
                        case Define.E_DisplayStore.EquipMyPage:
                            this.labelTitleRoot.Text = "设备 > 用户设置";
                            break;
                        case Define.E_DisplayStore.EquipEngineer:
                            this.labelTitleRoot.Text = "设备 > 工程师设置";
                            break;
                        case Define.E_DisplayStore.LogHelp:
                            this.labelTitleRoot.Text = "日志 > 帮助";
                            break;
                        case Define.E_DisplayStore.LogInspection:
                            this.labelTitleRoot.Text = "日志 > 判断日志";
                            break;
                        case Define.E_DisplayStore.LogHistory:
                            this.labelTitleRoot.Text = "日志 > 历史日志";
                            break;
                        case Define.E_DisplayStore.LogOthers:
                            this.labelTitleRoot.Text = "日志 > 其他的";
                            break;
                        case Define.E_DisplayStore.InforAS:
                            this.labelTitleRoot.Text = "信息 > A/S";
                            break;
                        case Define.E_DisplayStore.InforHelp:
                            this.labelTitleRoot.Text = "信息 > 帮助";
                            break;
                        case Define.E_DisplayStore.InforSystem:
                            this.labelTitleRoot.Text = "信息 > 系统信息";
                            break;
                        case Define.E_DisplayStore.SystemAutoZero:
                            this.labelTitleRoot.Text = "系统 > 自动零点跟踪";
                            break;
                        case Define.E_DisplayStore.SystemCalibration:
                            this.labelTitleRoot.Text = "系统 > 校准";
                            break;
                        case Define.E_DisplayStore.SystemExternalOutput:
                            this.labelTitleRoot.Text = "系统 > 外部输出";
                            break;
                        case Define.E_DisplayStore.SystemHelp:
                            this.labelTitleRoot.Text = "系统 > 帮助";
                            break;
                        case Define.E_DisplayStore.SystemIOTest:
                            this.labelTitleRoot.Text = "系统 > I/O测试";
                            break;    
                        case Define.E_DisplayStore.SystemJudgment:
                            this.labelTitleRoot.Text = "系统 > 判断设置";
                            break;
                        case Define.E_DisplayStore.SystemSorterSetting:
                            this.labelTitleRoot.Text = "系统 > 筛选设定";
                            break;
                        case Define.E_DisplayStore.SystemBLDCMotorSetting:
                            this.labelTitleRoot.Text = "系统 > BLDC设置";
                            break;
                        default:
                            break;
                    }
                    #endregion
                    break;
                case Define.E_LanguageID.Czech:
                    break;
                case Define.E_LanguageID.German:
                    #region 독일어
                    switch (status.CurrentDisplay)
                    {
                        case Define.E_DisplayStore.BasicDataStatistics:
                            this.labelTitleRoot.Text = "Basic > Statistik";
                            break;
                        case Define.E_DisplayStore.BasicHelp:
                            this.labelTitleRoot.Text = "Basic > Hilfe";
                            break;
                        case Define.E_DisplayStore.BasicProduct:
                            this.labelTitleRoot.Text = "Basic > Produkteinstellung";
                            break;
                        case Define.E_DisplayStore.BasicRandomMode:
                            this.labelTitleRoot.Text = "Basic > Produkteinstellung > Zufallsmodus";
                            break;
                        case Define.E_DisplayStore.BasicTime:
                            this.labelTitleRoot.Text = "Basic > Zeiteinstellung";
                            break;
                        case Define.E_DisplayStore.ConfiSerial:
                            if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM1)
                                this.labelTitleRoot.Text = "Konfiguration > Serielle(COM1)";
                            else if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM3)
                                this.labelTitleRoot.Text = "Konfiguration > Serielle(COM3)";
                            else if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM4)
                                this.labelTitleRoot.Text = "Konfiguration > Serielle(COM4)";
                            break;
                        case Define.E_DisplayStore.ConfiEthernet:
                            this.labelTitleRoot.Text = "Konfiguration > Ethernet";
                            break;
                        case Define.E_DisplayStore.ConfiHelp:
                            this.labelTitleRoot.Text = "Konfiguration > Hilfe";
                            break;
                        case Define.E_DisplayStore.ConfiOptionBoard:
                            this.labelTitleRoot.Text = "Konfiguration > Optionsplatine";
                            break;
                        case Define.E_DisplayStore.EquipFuctionSetting:
                            this.labelTitleRoot.Text = "Vorrichtung > Funktionseinstellungen";
                            break;
                        case Define.E_DisplayStore.EquipHelp:
                            this.labelTitleRoot.Text = "Vorrichtung > Hilfe";
                            break;
                        case Define.E_DisplayStore.EquipInitialize:
                            this.labelTitleRoot.Text = "Vorrichtung > Initialisierung";
                            break;
                        case Define.E_DisplayStore.EquipUpdate:
                            this.labelTitleRoot.Text = "Vorrichtung > Aktualisierung";
                            break;
                        case Define.E_DisplayStore.EquipUser:
                        case Define.E_DisplayStore.EquipMyPage:
                            this.labelTitleRoot.Text = "Vorrichtung > Benutzereinstellungen";
                            break;
                        case Define.E_DisplayStore.EquipEngineer:
                            this.labelTitleRoot.Text = "Vorrichtung > Ingenieur Einstellung";
                            break;
                        case Define.E_DisplayStore.InforAS:
                            this.labelTitleRoot.Text = "Information > Kundendienst";
                            break;
                        case Define.E_DisplayStore.InforHelp:
                            this.labelTitleRoot.Text = "Information > Hilfe";
                            break;
                        case Define.E_DisplayStore.InforSystem:
                            this.labelTitleRoot.Text = "Information > Information";
                            break;
                        case Define.E_DisplayStore.SystemAutoZero:
                            this.labelTitleRoot.Text = "Systemeinstellung > Automatische Nullung";
                            break;
                        case Define.E_DisplayStore.SystemCalibration:
                            this.labelTitleRoot.Text = "Systemeinstellung > Kalibrierung";
                            break;
                        case Define.E_DisplayStore.SystemExternalOutput:
                            this.labelTitleRoot.Text = "Systemeinstellung > Externer Ausgang";
                            break;
                        case Define.E_DisplayStore.SystemHelp:
                            this.labelTitleRoot.Text = "Systemeinstellung > Hilfe";
                            break;
                        case Define.E_DisplayStore.SystemIOTest:
                            this.labelTitleRoot.Text = "Systemeinstellung > I/O test";
                            break;
                        case Define.E_DisplayStore.SystemJudgment:
                            this.labelTitleRoot.Text = "Systemeinstellung > Tascheneinstellung";
                            break;
                        case Define.E_DisplayStore.SystemSorterSetting:
                            this.labelTitleRoot.Text = "Systemeinstellung > Sortierereinstellung";
                            break;
                        case Define.E_DisplayStore.SystemBLDCMotorSetting:
                            this.labelTitleRoot.Text = "Systemeinstellung > BLDC-Einstellung";
                            break;
                        default:
                            break;
                    }
                    #endregion
                    break;
                case Define.E_LanguageID.Russian:
                    #region 러시아어
                    switch (status.CurrentDisplay)
                    {
                        case Define.E_DisplayStore.BasicDataStatistics:
                            this.labelTitleRoot.Text = "Основной > Статистика данных";
                            break;
                        case Define.E_DisplayStore.BasicHelp:
                            this.labelTitleRoot.Text = "Основной > Помощь";
                            break;
                        case Define.E_DisplayStore.BasicProduct:
                            this.labelTitleRoot.Text = "Основной > Настройки продукта";
                            break;
                        case Define.E_DisplayStore.BasicRandomMode:
                            this.labelTitleRoot.Text = "Основной > Настройки продукта > Случайный режим";
                            break;
                        case Define.E_DisplayStore.BasicTime:
                            this.labelTitleRoot.Text = "Основной > Настройки времени";
                            break;

                        case Define.E_DisplayStore.ConfiSerial:
                            if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM1)
                                this.labelTitleRoot.Text = "Конфигурация > Послед. порт(COM1)";
                            else if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM3)
                                this.labelTitleRoot.Text = "Конфигурация > Послед. порт(COM3)";
                            else if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM4)
                                this.labelTitleRoot.Text = "Конфигурация > Послед. порт(COM4)";
                            break;
                        case Define.E_DisplayStore.ConfiEthernet:
                            this.labelTitleRoot.Text = "Конфигурация > Локальная сеть";
                            break;
                        case Define.E_DisplayStore.ConfiHelp:
                            this.labelTitleRoot.Text = "Конфигурация > Помощь";
                            break;
                        case Define.E_DisplayStore.ConfiOptionBoard:
                            this.labelTitleRoot.Text = "Конфигурация > Опции";
                            break;
                        case Define.E_DisplayStore.EquipFuctionSetting:
                            this.labelTitleRoot.Text = "Настройка > Функциональные настройки";
                            break;
                        case Define.E_DisplayStore.EquipHelp:
                            this.labelTitleRoot.Text = "Настройка > Помощь";
                            break;
                        case Define.E_DisplayStore.EquipInitialize:
                            this.labelTitleRoot.Text = "Настройка > Инициализация";
                            break;
                        case Define.E_DisplayStore.EquipUpdate:
                            this.labelTitleRoot.Text = "Настройка > Обновить";
                            break;
                        case Define.E_DisplayStore.EquipUser:
                        case Define.E_DisplayStore.EquipMyPage:
                            this.labelTitleRoot.Text = "Настройка > Настройки пользователя";
                            break;
                        case Define.E_DisplayStore.EquipEngineer:
                            this.labelTitleRoot.Text = "Настройка > Инженерные настройки";
                            break;
                        case Define.E_DisplayStore.InforAS:
                            this.labelTitleRoot.Text = "Информация > Обслуживание клиентов";
                            break;
                        case Define.E_DisplayStore.InforHelp:
                            this.labelTitleRoot.Text = "Информация > Помощь";
                            break;
                        case Define.E_DisplayStore.InforSystem:
                            this.labelTitleRoot.Text = "Информация > Информация";
                            break;
                        case Define.E_DisplayStore.SystemAutoZero:
                            this.labelTitleRoot.Text = "Системные > Автоотслеживание нуля";
                            break;
                        case Define.E_DisplayStore.SystemCalibration:
                            this.labelTitleRoot.Text = "Системные > Калибровка";
                            break;
                        case Define.E_DisplayStore.SystemExternalOutput:
                            this.labelTitleRoot.Text = "Системные > Внешний выход";
                            break;
                        case Define.E_DisplayStore.SystemHelp:
                            this.labelTitleRoot.Text = "Системные > Помощь";
                            break;
                        case Define.E_DisplayStore.SystemIOTest:
                            this.labelTitleRoot.Text = "Системные > Тест ввода/вывода";
                            break; 
                        case Define.E_DisplayStore.SystemJudgment:
                            this.labelTitleRoot.Text = "Системные > Настройка отбраковки";
                            break;
                        case Define.E_DisplayStore.SystemSorterSetting:
                            this.labelTitleRoot.Text = "Системные > Настройка сортировки";
                            break;
                        case Define.E_DisplayStore.SystemBLDCMotorSetting:
                            this.labelTitleRoot.Text = "Системные > Настройки BLDC";
                            break;
                        default:
                            break;
                    }
                    #endregion
                    break;
                case Define.E_LanguageID.Spanish:
                    break;
                default:
                    #region 한글
                    switch (status.CurrentDisplay)
                    {
                        case Define.E_DisplayStore.BasicDataStatistics:
                            this.labelTitleRoot.Text = "기본설정 > 데이터집계";
                            break;
                        case Define.E_DisplayStore.BasicHelp:
                            this.labelTitleRoot.Text = "기본설정 > 도움말";
                            break;
                        case Define.E_DisplayStore.BasicProduct:
                            this.labelTitleRoot.Text = "기본설정 > 품목설정";
                            break;
                        case Define.E_DisplayStore.BasicRandomMode:
                            this.labelTitleRoot.Text = "기본설정 > 품목설정 > 랜덤모드";
                            break;
                        case Define.E_DisplayStore.BasicTime:
                            this.labelTitleRoot.Text = "기본설정 > 시간설정";
                            break;
                        case Define.E_DisplayStore.ConfiSerial:
                            if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM1)
                                this.labelTitleRoot.Text = "환경설정 > 시리얼통신(COM1)";
                            else if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM3)
                                this.labelTitleRoot.Text = "환경설정 > 시리얼통신(COM3)";
                            else if (this.CurrentConfigurationMenu() == Define.E_MenuBottomConfiguration.SerialCOM4)
                                this.labelTitleRoot.Text = "환경설정 > 시리얼통신(COM4)";
                            break;
                        case Define.E_DisplayStore.ConfiEthernet:
                            this.labelTitleRoot.Text = "환경설정 > 이더넷통신";
                            break;
                        case Define.E_DisplayStore.ConfiHelp:
                            this.labelTitleRoot.Text = "환경설정 > 도움말";
                            break;
                        case Define.E_DisplayStore.ConfiOptionBoard:
                            this.labelTitleRoot.Text = "환경설정 > 옵션보드설정";
                            break;
                        case Define.E_DisplayStore.EquipFuctionSetting:
                            this.labelTitleRoot.Text = "장비설정 > 기능설정";
                            break;
                        case Define.E_DisplayStore.EquipHelp:
                            this.labelTitleRoot.Text = "장비설정 > 도움말";
                            break;
                        case Define.E_DisplayStore.EquipInitialize:
                            this.labelTitleRoot.Text = "장비설정 > 공장초기화";
                            break;
                        case Define.E_DisplayStore.EquipUpdate:
                            this.labelTitleRoot.Text = "장비설정 > 업데이트";
                            break;
                        case Define.E_DisplayStore.EquipUser:
                        case Define.E_DisplayStore.EquipMyPage:
                            this.labelTitleRoot.Text = "장비설정 > 유저설정";
                            break;
                        case Define.E_DisplayStore.EquipEngineer:
                            this.labelTitleRoot.Text = "장비설정 > 엔지니어설정";
                            break;
                        case Define.E_DisplayStore.LogHelp:
                            this.labelTitleRoot.Text = "로그 > 도움말";
                            break;
                        case Define.E_DisplayStore.LogInspection:
                            this.labelTitleRoot.Text = "로그 > 판정로그";
                            break;
                        case Define.E_DisplayStore.LogHistory:
                            this.labelTitleRoot.Text = "로그 > 히스토리로그";
                            break;
                        case Define.E_DisplayStore.LogOthers:
                            this.labelTitleRoot.Text = "로그 > 기타로그";
                            break;
                        case Define.E_DisplayStore.InforAS:
                            this.labelTitleRoot.Text = "정보 > A/S";
                            break;
                        case Define.E_DisplayStore.InforHelp:
                            this.labelTitleRoot.Text = "정보 > 도움말";
                            break;
                        case Define.E_DisplayStore.InforSystem:
                            this.labelTitleRoot.Text = "정보 > 시스템정보";
                            break;
                        case Define.E_DisplayStore.SystemAutoZero:
                            this.labelTitleRoot.Text = "시스템설정 > 자동영점";
                            break;
                        case Define.E_DisplayStore.SystemCalibration:
                            this.labelTitleRoot.Text = "시스템설정 > 중량조정";
                            break;
                        case Define.E_DisplayStore.SystemExternalOutput:
                            this.labelTitleRoot.Text = "시스템설정 > 외부출력";
                            break;
                        case Define.E_DisplayStore.SystemHelp:
                            this.labelTitleRoot.Text = "시스템설정 > 도움말";
                            break;
                        case Define.E_DisplayStore.SystemIOTest:
                            this.labelTitleRoot.Text = "시스템설정 > I/O테스트";
                            break;                        
                        case Define.E_DisplayStore.SystemJudgment:
                            this.labelTitleRoot.Text = "시스템설정 > 판정설정";
                            break;
                        case Define.E_DisplayStore.SystemSorterSetting:
                            this.labelTitleRoot.Text = "시스템설정 > 선별기설정";
                            break;
                        case Define.E_DisplayStore.SystemBLDCMotorSetting:
                            this.labelTitleRoot.Text = "시스템설정 > BLDC 설정";
                            break;
                        default:
                            break;
                    }
                    #endregion
                    break;
            }
        }
        public void DisplayRefresh(SystemStatus status)
        {
            this.EncFileName = "";
            this.SelectedDataType = Define.E_DataType.None;

            if (this.buttonBasic.Enabled == true)
            {
                this.buttonBasic.ButtonDown();
                this.buttonConfiguration.ButtonUp();
                this.buttonSystem.ButtonUp();
                this.buttonEquipment.ButtonUp();
                this.buttonLog.ButtonUp();
                this.buttonInformation.ButtonUp();

                this.SelectedSideMenu = Define.E_MenuSide.Basic;
            }
            else if (this.buttonConfiguration.Enabled == true)
            {
                this.buttonBasic.ButtonUp();
                this.buttonConfiguration.ButtonDown();
                this.buttonSystem.ButtonUp();
                this.buttonEquipment.ButtonUp();
                this.buttonLog.ButtonUp();
                this.buttonInformation.ButtonUp();

                this.SelectedSideMenu = Define.E_MenuSide.Configuration;
            }
            else if (this.buttonSystem.Enabled == true)
            {
                this.buttonBasic.ButtonUp();
                this.buttonConfiguration.ButtonUp();
                this.buttonSystem.ButtonDown();
                this.buttonEquipment.ButtonUp();
                this.buttonLog.ButtonUp();
                this.buttonInformation.ButtonUp();

                this.SelectedSideMenu = Define.E_MenuSide.System;
            }
            else if (this.buttonEquipment.Enabled == true)
            {
                this.buttonBasic.ButtonUp();
                this.buttonConfiguration.ButtonUp();
                this.buttonSystem.ButtonUp();
                this.buttonEquipment.ButtonDown();
                this.buttonLog.ButtonUp();
                this.buttonInformation.ButtonUp();

                this.SelectedSideMenu = Define.E_MenuSide.Equipment;
            }
            else if (this.BottomLog.Enabled == true)
            {
                this.buttonBasic.ButtonUp();
                this.buttonConfiguration.ButtonUp();
                this.buttonSystem.ButtonUp();
                this.buttonEquipment.ButtonUp();
                this.buttonLog.ButtonDown();
                this.buttonInformation.ButtonUp();

                this.SelectedSideMenu = Define.E_MenuSide.Equipment;
            }
            else if (this.buttonInformation.Enabled == true)
            {
                this.buttonBasic.ButtonUp();
                this.buttonConfiguration.ButtonUp();
                this.buttonSystem.ButtonUp();
                this.buttonEquipment.ButtonUp();
                this.buttonLog.ButtonUp();
                this.buttonInformation.ButtonDown();

                this.SelectedSideMenu = Define.E_MenuSide.Information;
            }
            else
            {
                this.buttonConfiguration.ButtonUp();
                this.buttonSystem.ButtonUp();
                this.buttonEquipment.ButtonUp();
                this.buttonLog.ButtonUp();
                this.buttonInformation.ButtonUp();

                this.SelectedSideMenu = Define.E_MenuSide.Basic;
            }

            this.DisplaySideMenu(this.SelectedSideMenu);
        }
        #endregion

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

        #region Event Handler
        private void buttonBasic_Click(object sender, EventArgs e)
        {
            this.SelectedSideMenu = Define.E_MenuSide.Basic;
            this.DisplaySideMenu(this.SelectedSideMenu);
        }
        private void buttonConfiguration_Click(object sender, EventArgs e)
        {
            this.SelectedSideMenu = Define.E_MenuSide.Configuration;
            this.DisplaySideMenu(this.SelectedSideMenu);
        }
        private void buttonSystem_Click(object sender, EventArgs e)
        {
            this.SelectedSideMenu = Define.E_MenuSide.System;
            this.DisplaySideMenu(this.SelectedSideMenu);
        }
        private void buttonEquipment_Click(object sender, EventArgs e)
        {
            this.SelectedSideMenu = Define.E_MenuSide.Equipment;
            this.DisplaySideMenu(this.SelectedSideMenu);
        }
        private void buttonLog_Click(object sender, EventArgs e)
        {
            this.SelectedSideMenu = Define.E_MenuSide.Log;
            this.DisplaySideMenu(this.SelectedSideMenu);
        }
        private void buttonInformation_Click(object sender, EventArgs e)
        {
            this.SelectedSideMenu = Define.E_MenuSide.Information;
            this.DisplaySideMenu(this.SelectedSideMenu);
        }

        private void buttonHiddenMenu_Click(object sender, EventArgs e)
        {
            if (this.ParentForm.SystemConfig1.IsLogin == false)
            {
                this.DisplayHiddenMenu(this.ParentForm.CurrentSystemStatus.CurrentDisplay, this.ParentForm.SystemConfig1);
            }
            else
            {
                if (this.ParentForm.CurrentSystemStatus.CurrentUser.Group == Define.E_UserGroup.Admin
                    || this.ParentForm.CurrentSystemStatus.CurrentUser.Group == Define.E_UserGroup.Developer
                    || this.ParentForm.CurrentSystemStatus.CurrentUser.Group == Define.E_UserGroup.Level3)
                    this.DisplayHiddenMenu(this.ParentForm.CurrentSystemStatus.CurrentDisplay, this.ParentForm.SystemConfig1);
            }
        }

        private void buttonMain_Click(object sender, EventArgs e)
        {
            // Log - smartFile Close
            this.FileClose();

            this.ChangeToMainScreen();          
        }

        private void pictureBoxStart_Click(object sender, EventArgs e)
        {
            if(this.EquipmentRun(this.ParentForm.CurrentSystemStatus.CurrentDisplay) == true)
                this.ParentForm.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
        }
        private void pictureBoxStop_Click(object sender, EventArgs e)
        {
            if (this.EquipmentRun(this.ParentForm.CurrentSystemStatus.CurrentDisplay) == true)
                this.ParentForm.TransferData(CommunicationCommand.Start, CommunicationID.MainBoard);
        }
        private void pictureBoxIconAlarm_Click(object sender, EventArgs e)
        {
            if (this.MainAlarm.Visible == true)
                this.MainAlarm.Visible = false;
            else
            {
                this.MainAlarm.BringToFront();
                this.MainAlarm.Visible = true;
            }

            this.ParentForm.TransferData(CommunicationCommand.LampOnContinuousDisable, CommunicationID.MainBoard);
            this.ParentForm.TransferData(CommunicationCommand.BuzzerOnContinuousDisable, CommunicationID.MainBoard);
        }

        private void timerEncryption_Tick(object sender, EventArgs e)
        {
            this.timerEncryption.Enabled = false;
            this.timerTimeout.Enabled = true;
            //if (this.ParentForm.IsCommunicationLogOpen == true)
            //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("timerEncryption_Tick() ({0:yyyy-MM-dd HH:mm:ss}): timeout true", DateTime.Now));
            this.EncryptionFile(this.Q_FileList.Dequeue());
        }
        private void timerFileCopy_Tick(object sender, EventArgs e)
        {
            this.timerFileCopy.Enabled = false;
            this.timerTimeout.Enabled = true;
            //if (this.ParentForm.IsCommunicationLogOpen == true)
            //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("timerFileCopy_Tick() ({0:yyyy-MM-dd HH:mm:ss}): timeout true", DateTime.Now));
            this.FileCopy(this.SelectedDataType);
        }
        private void timerTimeout_Tick(object sender, EventArgs e)
        {
            this.timerTimeout.Enabled = false;
            //if (this.ParentForm.IsCommunicationLogOpen == true)
            //    this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("timerTimeout_Tick() ({0:yyyy-MM-dd HH:mm:ss}): timeout false", DateTime.Now));
            this.SplashFinish();

            DialogFormMessage myMsg = new DialogFormMessage(16, this.ParentForm.SystemConfig1.Language);
            myMsg.ShowDialog();
        }

        public Define.E_MenuBottomConfiguration CurrentConfigurationMenu()
        {
            return this.BottomConfiguration.CurrentMenu;
        }
        #endregion
    }
}