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 INT51DB.Controls;
using INT51DB.DialogForms;
using INT51DB_ImageDll;
using SmartX;

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

        private DataStore.MemuSide SelectedSideMenu;
        private Collection<SmartButton> CollectionButtonMenu;

        // 기본설정
        public ControlCenterBasicDataBackup CenterBasicDataBackup;
        public ControlCenterBasicDataStatistics CenterBasicDataStatistics;
        public ControlCenterBasicHelp CenterBasicHelp;
        public ControlCenterBasicProduct CenterBasicProduct;
        public ControlCenterBasicTime CenterBasicTime;
        // 환경설정
        public ControlCenterConfiCommunication CenterConfiCommunication;
        public ControlCenterConfiHelp CenterConfiHelp;
        public ControlCenterConfiOption CenterConfiOption;
        // 장비설정
        public ControlCenterEquipHelp CenterEquipHelp;
        public ControlCenterEquipInitialize CenterEquipInitialize;
        public ControlCenterEquipUpdate CenterEquipUpdate;
        public ControlCenterEquipFunctionSetting CenterEquipFunctionSetting;
        public ControlCenterEquipUser CenterEquipUser;
        public ControlCenterEquipTest CenterEquipTest;
        // 시스템설정
        public ControlCenterSystemAutoZero CenterSystemAutoZero;
        public ControlCenterSystemCalibration CenterSystemCalibration;
        public ControlCenterSystemExternalOutput CenterSystemExternalOutput;
        public ControlCenterSystemHelp CenterSystemHelp;
        public ControlCenterSystemIOTest CenterSystemIOTest;
        public ControlCenterSystemJudgmentSetting CenterSystemJudgmentSetting;
        public ControlCenterSystemSorterSetting CenterSystemSorterSetting;
        public ControlCenterSystemServoMotor CenterSystemServoMotor;
        // 시스템 정보
        public ControlCenterInforHelp CenterInforHelp;
        public ControlCenterInforSystem CenterInforSystemInformation;
        public ControlCenterInforAS CenterInforAS;

        // Bottom Menu
        private ControlBottomBasic bottomBasic;
        private ControlBottomConfiguration bottomConfiguration;
        private ControlBottomEquipment bottomEquipment;
        private ControlBottomInformation bottomInformation;
        private 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.SystemConfig.Language == DataStore.LanguageID.English)
            {
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
            {
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech)
            {
            }
            else
            {
            }
        }
        private void DefaultSetting()
        {
            this.SelectedSideMenu = DataStore.MemuSide.Basic;

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

            this.InitializeControl();
        }
        private void InitializeControl()
        {
            this.CreateCenterBasicControl();
            this.CreateCenterConfigurationControl();
            this.CreateCenterEquipmentControl();
            this.CreateCenterSystemControl();
            this.CreateCenterInformationControl();

            #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);
            #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);
            #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);
            #endregion
        }
        private void CreateCenterBasicControl()
        {
            this.CenterBasicDataBackup = new ControlCenterBasicDataBackup(this);
            this.CenterBasicDataStatistics = new ControlCenterBasicDataStatistics(this);
            this.CenterBasicHelp = new ControlCenterBasicHelp(this);
            this.CenterBasicProduct = new ControlCenterBasicProduct(this);
            this.CenterBasicTime = new ControlCenterBasicTime(this);

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

            this.Controls.Add(this.CenterBasicDataBackup);
            this.Controls.Add(this.CenterBasicDataStatistics);
            this.Controls.Add(this.CenterBasicHelp);
            this.Controls.Add(this.CenterBasicProduct);
            this.Controls.Add(this.CenterBasicTime);
        }
        private void CreateCenterConfigurationControl()
        {
            this.CenterConfiCommunication = new ControlCenterConfiCommunication(this);
            this.CenterConfiHelp = new ControlCenterConfiHelp(this);
            this.CenterConfiOption = new ControlCenterConfiOption(this);

            this.CenterConfiCommunication.Location = new Point(0, 65);
            this.CenterConfiHelp.Location = new Point(0, 65);
            this.CenterConfiOption.Location = new Point(0, 65);

            this.Controls.Add(this.CenterConfiCommunication);
            this.Controls.Add(this.CenterConfiHelp);
            this.Controls.Add(this.CenterConfiOption);
        }
        private void CreateCenterEquipmentControl()
        {
            this.CenterEquipHelp = new ControlCenterEquipHelp(this);
            this.CenterEquipInitialize = new ControlCenterEquipInitialize(this);
            this.CenterEquipUpdate = new ControlCenterEquipUpdate(this);
            this.CenterEquipFunctionSetting = new ControlCenterEquipFunctionSetting(this);
            this.CenterEquipUser = new ControlCenterEquipUser(this);
            this.CenterEquipTest = new ControlCenterEquipTest(this);

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

            this.Controls.Add(this.CenterEquipHelp);
            this.Controls.Add(this.CenterEquipInitialize);
            this.Controls.Add(this.CenterEquipUpdate);
            this.Controls.Add(this.CenterEquipFunctionSetting);
            this.Controls.Add(this.CenterEquipUser);
            this.Controls.Add(this.CenterEquipTest);
        }
        private void CreateCenterSystemControl()
        {
            this.CenterSystemCalibration = new ControlCenterSystemCalibration(this);
            this.CenterSystemJudgmentSetting = new ControlCenterSystemJudgmentSetting(this);
            this.CenterSystemExternalOutput = new ControlCenterSystemExternalOutput(this);
            this.CenterSystemHelp = new ControlCenterSystemHelp(this);
            this.CenterSystemIOTest = new ControlCenterSystemIOTest(this);
            this.CenterSystemSorterSetting = new ControlCenterSystemSorterSetting(this);
            this.CenterSystemAutoZero = new ControlCenterSystemAutoZero(this);
            this.CenterSystemServoMotor = new ControlCenterSystemServoMotor(this);

            this.CenterSystemCalibration.Location = new Point(0, 65);
            this.CenterSystemJudgmentSetting.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.CenterSystemAutoZero.Location = new Point(0, 65);
            this.CenterSystemServoMotor.Location = new Point(0, 65);

            this.Controls.Add(this.CenterSystemCalibration);
            this.Controls.Add(this.CenterSystemJudgmentSetting);
            this.Controls.Add(this.CenterSystemExternalOutput);
            this.Controls.Add(this.CenterSystemHelp);
            this.Controls.Add(this.CenterSystemIOTest);
            this.Controls.Add(this.CenterSystemSorterSetting);
            this.Controls.Add(this.CenterSystemAutoZero);
            this.Controls.Add(this.CenterSystemServoMotor);
        }
        private void CreateCenterInformationControl()
        {
            this.CenterInforHelp = new ControlCenterInforHelp(this);
            this.CenterInforSystemInformation = new ControlCenterInforSystem(this);
            this.CenterInforAS = new ControlCenterInforAS(this);

            this.CenterInforHelp.Location = new Point(0, 65);
            this.CenterInforSystemInformation.Location = new Point(0, 65);
            this.CenterInforAS.Location = new Point(0, 65);

            this.Controls.Add(this.CenterInforHelp);
            this.Controls.Add(this.CenterInforSystemInformation);
            this.Controls.Add(this.CenterInforAS);
        }

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

            switch (this.SelectedSideMenu)
            {
                case DataStore.MemuSide.Basic:
                    this.bottomBasic.CurrentControlEnable(enable);
                    break;
                case DataStore.MemuSide.Configuration:
                    this.bottomConfiguration.CurrentControlEnable(enable);
                    break;
                case DataStore.MemuSide.System:
                    this.bottomSystem.CurrentControlEnable(enable);
                    break;
                case DataStore.MemuSide.Equipment:
                    this.bottomEquipment.CurrentControlEnable(enable);
                    break;
                case DataStore.MemuSide.Information:
                    this.bottomInformation.CurrentControlEnable(enable);
                    break;
                default:
                    break;
            }
        }
        private void UpdateDisplayUser(SystemStatus status)
        {
            string value = "";
            switch (status.CurrentUser.Group)
            {
                case DataStore.UserGroup.LogOff:
                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOff)
                        this.labelUserLevel.ForeColor = this.ParentForm.ColorLogOff;
                    if (this.labelUserLevel.Text != status.CurrentUser.Group.ToString())
                        this.labelUserLevel.Text = status.CurrentUser.Group.ToString();

                    this.buttonBasic.Enabled = true;
                    this.buttonConfiguration.Enabled = false;
                    this.buttonSystem.Enabled = false;
                    this.buttonEquipment.Enabled = false;
                    this.buttonInformation.Enabled = true;
                    break;
                case DataStore.UserGroup.Level1Operator:
                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
                        this.labelUserLevel.ForeColor = this.ParentForm.ColorLogOn;

                    value = "Level1";
                    if (this.labelUserLevel.Text != value)
                        this.labelUserLevel.Text = value;

                    this.buttonBasic.Enabled = true;
                    this.buttonConfiguration.Enabled = false;
                    this.buttonSystem.Enabled = false;
                    this.buttonEquipment.Enabled = false;
                    this.buttonInformation.Enabled = true;
                    break;
                case DataStore.UserGroup.Level2Engineer:
                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
                        this.labelUserLevel.ForeColor = this.ParentForm.ColorLogOn;

                    value = "Level2";
                    if (this.labelUserLevel.Text != value)
                        this.labelUserLevel.Text = value;

                    this.buttonBasic.Enabled = true;
                    this.buttonConfiguration.Enabled = true;
                    this.buttonSystem.Enabled = true;
                    this.buttonEquipment.Enabled = false;
                    this.buttonInformation.Enabled = true;
                    break;
                case DataStore.UserGroup.Level3Manager:
                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
                        this.labelUserLevel.ForeColor = this.ParentForm.ColorLogOn;

                    value = "Level3";
                    if (this.labelUserLevel.Text != value)
                        this.labelUserLevel.Text = value;

                    this.buttonBasic.Enabled = true;
                    this.buttonConfiguration.Enabled = true;
                    this.buttonSystem.Enabled = true;
                    this.buttonEquipment.Enabled = true;
                    this.buttonInformation.Enabled = true;
                    break;
                case DataStore.UserGroup.Level4Developer:
                    if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
                        this.labelUserLevel.ForeColor = this.ParentForm.ColorLogOn;

                    value = "Level4";
                    if (this.labelUserLevel.Text != value)
                        this.labelUserLevel.Text = value;

                    this.buttonBasic.Enabled = true;
                    this.buttonConfiguration.Enabled = true;
                    this.buttonSystem.Enabled = true;
                    this.buttonEquipment.Enabled = true;
                    this.buttonInformation.Enabled = true;
                    break;
                default:
                    break;
            }
        }

        private void DisplaySideMenu(DataStore.MemuSide menu)
        {
            switch (menu)
            {
                case DataStore.MemuSide.Basic:
                    this.bottomBasic.Visible = true;
                    this.bottomConfiguration.Visible = false;
                    this.bottomSystem.Visible = false;
                    this.bottomEquipment.Visible = false;
                    this.bottomInformation.Visible = false;

                    this.bottomBasic.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    break;
                case DataStore.MemuSide.Configuration:
                    this.bottomBasic.Visible = false;
                    this.bottomConfiguration.Visible = true;
                    this.bottomSystem.Visible = false;
                    this.bottomEquipment.Visible = false;
                    this.bottomInformation.Visible = false;

                    this.bottomConfiguration.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    break;
                case DataStore.MemuSide.System:
                    this.bottomBasic.Visible = false;
                    this.bottomConfiguration.Visible = false;
                    this.bottomSystem.Visible = true;
                    this.bottomEquipment.Visible = false;
                    this.bottomInformation.Visible = false;

                    this.bottomSystem.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    break;
                case DataStore.MemuSide.Equipment:
                    this.bottomBasic.Visible = false;
                    this.bottomConfiguration.Visible = false;
                    this.bottomSystem.Visible = false;
                    this.bottomEquipment.Visible = true;
                    this.bottomInformation.Visible = false;

                    this.bottomEquipment.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    break;
                case DataStore.MemuSide.Information:
                    this.bottomBasic.Visible = false;
                    this.bottomConfiguration.Visible = false;
                    this.bottomSystem.Visible = false;
                    this.bottomEquipment.Visible = false;
                    this.bottomInformation.Visible = true;

                    this.bottomInformation.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    break;
                default:
                    break;
            }
        }
        public void DisplayBottomBasic(DataStore.MenuBottomBasic menu)
        {
            switch (menu)
            {
                case DataStore.MenuBottomBasic.DataBackup:
                    this.CenterBasicDataBackup.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterBasicDataBackup.BringToFront();
                    break;
                case DataStore.MenuBottomBasic.DataStatistics:
                    this.CenterBasicDataStatistics.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterBasicDataStatistics.BringToFront();
                    break;
                case DataStore.MenuBottomBasic.Help:
                    this.CenterBasicHelp.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterBasicHelp.BringToFront();
                    break;
                case DataStore.MenuBottomBasic.Product:
                    this.CenterBasicProduct.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterBasicProduct.BringToFront();
                    break;
                case DataStore.MenuBottomBasic.Time:
                    this.CenterBasicTime.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterBasicTime.BringToFront();
                    break;
                default:
                    break;
            }

            this.bottomBasic.UpdateDisplayMenuButton(menu);
        }
        public void DisplayBottomConfiguration(DataStore.MenuBottomConfiguration menu)
        {
            switch (menu)
            {
                case DataStore.MenuBottomConfiguration.Communication:
                    this.CenterConfiCommunication.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterConfiCommunication.BringToFront();
                    break;
                case DataStore.MenuBottomConfiguration.Help:
                    this.CenterConfiHelp.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterConfiHelp.BringToFront();
                    break;
                case DataStore.MenuBottomConfiguration.Option:
                    this.CenterConfiOption.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterConfiOption.BringToFront();
                    break;
                default:
                    break;
            }

            this.bottomConfiguration.UpdateDisplayMenuButton(menu);
        }
        public void DisplayBottomSystem(DataStore.MenuBottomSystem menu)
        {
            switch (menu)
            {
                case DataStore.MenuBottomSystem.Calibration:
                    this.CenterSystemCalibration.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterSystemCalibration.BringToFront();
                    break;
                case DataStore.MenuBottomSystem.AutoZero:
                    this.CenterSystemAutoZero.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterSystemAutoZero.BringToFront();
                    break;
                case DataStore.MenuBottomSystem.Help:
                    this.CenterSystemHelp.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterSystemHelp.BringToFront();
                    break;
                case DataStore.MenuBottomSystem.IOTest:
                    this.CenterSystemIOTest.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterSystemIOTest.BringToFront();
                    break;
                case DataStore.MenuBottomSystem.JudgmentSetting:
                    this.CenterSystemJudgmentSetting.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterSystemJudgmentSetting.BringToFront();
                    break;
                case DataStore.MenuBottomSystem.SorterSetting:
                    this.CenterSystemSorterSetting.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterSystemSorterSetting.BringToFront();
                    break;
                case DataStore.MenuBottomSystem.ExternalOutput:
                    this.CenterSystemExternalOutput.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterSystemExternalOutput.BringToFront();
                    break;
                case DataStore.MenuBottomSystem.ServoMotor:
                    this.CenterSystemServoMotor.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterSystemServoMotor.BringToFront();
                    break;
                default:
                    break;
            }

            this.bottomSystem.UpdateDisplayMenuButton(menu);
        }
        public void DisplayBottomEquipment(DataStore.MenuBottomEquipment menu)
        {
            switch (menu)
            {
                case DataStore.MenuBottomEquipment.Help:
                    this.CenterEquipHelp.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterEquipHelp.BringToFront();
                    break;
                case DataStore.MenuBottomEquipment.Initialize:
                    this.CenterEquipInitialize.BringToFront();
                    this.Refresh();
                    this.CenterEquipInitialize.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    break;
                case DataStore.MenuBottomEquipment.Update:
                    this.CenterEquipUpdate.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterEquipUpdate.BringToFront();
                    break;
                case DataStore.MenuBottomEquipment.FunctionSetting:
                    this.CenterEquipFunctionSetting.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterEquipFunctionSetting.BringToFront();
                    break;
                case DataStore.MenuBottomEquipment.User:
                    this.CenterEquipUser.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterEquipUser.BringToFront();
                    break;
                case DataStore.MenuBottomEquipment.Test:
                    this.CenterEquipTest.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterEquipTest.BringToFront();
                    break;
                default:
                    break;
            }

            this.bottomEquipment.UpdateDisplayMenuButton(menu);
        }
        public void DisplayBottomInformation(DataStore.MenuBottomInformation menu)
        {
            switch (menu)
            {
                case DataStore.MenuBottomInformation.Help:
                    this.CenterInforHelp.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterInforHelp.BringToFront();
                    break;
                case DataStore.MenuBottomInformation.SystemInformation:
                    this.CenterInforSystemInformation.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterInforSystemInformation.BringToFront();
                    break;
                case DataStore.MenuBottomInformation.AS:
                    this.CenterInforAS.DisplayRefresh(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
                    this.CenterInforAS.BringToFront();
                    break;
                default:
                    break;
            }
            this.bottomInformation.UpdateDisplayMenuButton(menu);
        }
        public void UpdateEquipmentStatusDisplay(DataStore.EquipmentStatus status)
        {
            if (status == DataStore.EquipmentStatus.Start)
            {
                this.buttonBasic.Enabled = false;
                this.buttonConfiguration.Enabled = false;
                this.buttonSystem.Enabled = false;
                this.buttonEquipment.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;

                if (this.ParentForm.CurrentSystemStatus.CurrentDisplay == DataStore.DisplayStore.SystemJudgmentSetting)
                    this.CenterSystemJudgmentSetting.UpdateEquipmentStatusDisplay(status);
                else if (this.ParentForm.CurrentSystemStatus.CurrentDisplay == DataStore.DisplayStore.SystemSorterSetting)
                    this.CenterSystemSorterSetting.UpdateEquipmentStatusDisplay(status);
            }
            else
            {
                this.buttonBasic.Enabled = true;
                this.buttonConfiguration.Enabled = true;
                this.buttonSystem.Enabled = true;
                this.buttonEquipment.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;

                if (this.ParentForm.CurrentSystemStatus.CurrentDisplay == DataStore.DisplayStore.SystemJudgmentSetting)
                    this.CenterSystemJudgmentSetting.UpdateEquipmentStatusDisplay(status);
                else if (this.ParentForm.CurrentSystemStatus.CurrentDisplay == DataStore.DisplayStore.SystemSorterSetting)
                    this.CenterSystemSorterSetting.UpdateEquipmentStatusDisplay(status);
            }
        }

        public void DisplayTitleRoot(SystemStatus status)
        {
            switch (this.ParentForm.SystemConfig.Language)
            {
                case DataStore.LanguageID.English:
                    #region 영문
                    switch (status.CurrentDisplay)
                    {
                        case DataStore.DisplayStore.BasicDataBackup:
                            this.labelTitleRoot.Text = "Basic > Data backup";
                            break;
                        case DataStore.DisplayStore.BasicDataStatistics:
                            this.labelTitleRoot.Text = "Basic > Data statistics";
                            break;
                        case DataStore.DisplayStore.BasicHelp:
                            this.labelTitleRoot.Text = "Basic > Help";
                            break;
                        case DataStore.DisplayStore.BasicProduct:
                            this.labelTitleRoot.Text = "Basic > Product settings";
                            break;
                        case DataStore.DisplayStore.BasicTime:
                            this.labelTitleRoot.Text = "Basic > Time setting";
                            break;
                        case DataStore.DisplayStore.ConfiCommunication:
                            this.labelTitleRoot.Text = "Configuration > Serial";
                            break;
                        case DataStore.DisplayStore.ConfiHelp:
                            this.labelTitleRoot.Text = "Configuration > Help";
                            break;
                        case DataStore.DisplayStore.ConfiOption:
                            this.labelTitleRoot.Text = "Configuration > Option";
                            break;
                        case DataStore.DisplayStore.EquipFuctionSetting:
                            this.labelTitleRoot.Text = "Equipment > Feature Settings";
                            break;
                        case DataStore.DisplayStore.EquipHelp:
                            this.labelTitleRoot.Text = "Equipment > Help";
                            break;
                        case DataStore.DisplayStore.EquipInitialize:
                            this.labelTitleRoot.Text = "Equipment > Initialization";
                            break;
                        case DataStore.DisplayStore.EquipTest:
                            this.labelTitleRoot.Text = "Equipment > Equipment Test";
                            break;
                        case DataStore.DisplayStore.EquipUpdate:
                            this.labelTitleRoot.Text = "Equipment > Update";
                            break;
                        case DataStore.DisplayStore.EquipUser:
                            this.labelTitleRoot.Text = "Equipment > User Settings";
                            break;
                        case DataStore.DisplayStore.InforAS:
                            this.labelTitleRoot.Text = "Information > A/S";
                            break;
                        case DataStore.DisplayStore.InforHelp:
                            this.labelTitleRoot.Text = "Information > Help";
                            break;
                        case DataStore.DisplayStore.InforSystem:
                            this.labelTitleRoot.Text = "Information > Information";
                            break;
                        case DataStore.DisplayStore.SystemAutoZero:
                            this.labelTitleRoot.Text = "System > Auto zero";
                            break;
                        case DataStore.DisplayStore.SystemCalibration:
                            this.labelTitleRoot.Text = "System > Calibration";
                            break;
                        case DataStore.DisplayStore.SystemExternalOutput:
                            this.labelTitleRoot.Text = "System > External output";
                            break;
                        case DataStore.DisplayStore.SystemHelp:
                            this.labelTitleRoot.Text = "System > Help";
                            break;
                        case DataStore.DisplayStore.SystemIOTest:
                            this.labelTitleRoot.Text = "System > I/O test";
                            break;
                        case DataStore.DisplayStore.SystemJudgmentSetting:
                            this.labelTitleRoot.Text = "System > Judgment";
                            break;
                        case DataStore.DisplayStore.SystemSorterSetting:
                            this.labelTitleRoot.Text = "System > Sorter settings";
                            break;
                        case DataStore.DisplayStore.SystemServoMotor:
                            this.labelTitleRoot.Text = "System > Servo settings";
                            break;
                        default:
                            break;
                    }
                    #endregion
                    break;
                case DataStore.LanguageID.Chinese:
                    #region 중문
                    switch (status.CurrentDisplay)
                    {
                        case DataStore.DisplayStore.BasicDataBackup:
                            this.labelTitleRoot.Text = "基本 > 数据备份";
                            break;
                        case DataStore.DisplayStore.BasicDataStatistics:
                            this.labelTitleRoot.Text = "基本 > 数据统计";
                            break;
                        case DataStore.DisplayStore.BasicHelp:
                            this.labelTitleRoot.Text = "基本 > 帮助";
                            break;
                        case DataStore.DisplayStore.BasicProduct:
                            this.labelTitleRoot.Text = "基本 > 产品设置";
                            break;
                        case DataStore.DisplayStore.BasicTime:
                            this.labelTitleRoot.Text = "基本 > 时间设定";
                            break;
                        case DataStore.DisplayStore.ConfiCommunication:
                            this.labelTitleRoot.Text = "选项 > 串行端口";
                            break;
                        case DataStore.DisplayStore.ConfiHelp:
                            this.labelTitleRoot.Text = "选项 > 帮助";
                            break;
                        case DataStore.DisplayStore.ConfiOption:
                            this.labelTitleRoot.Text = "选项 > 选项";
                            break;
                        case DataStore.DisplayStore.EquipFuctionSetting:
                            this.labelTitleRoot.Text = "设备 > 功能设定";
                            break;
                        case DataStore.DisplayStore.EquipHelp:
                            this.labelTitleRoot.Text = "设备 > 帮助";
                            break;
                        case DataStore.DisplayStore.EquipInitialize:
                            this.labelTitleRoot.Text = "设备 > 工厂初期化";
                            break;
                        case DataStore.DisplayStore.EquipTest:
                            this.labelTitleRoot.Text = "设备 > 设备测试";
                            break;
                        case DataStore.DisplayStore.EquipUpdate:
                            this.labelTitleRoot.Text = "设备 > 更新";
                            break;
                        case DataStore.DisplayStore.EquipUser:
                            this.labelTitleRoot.Text = "设备 > 用户设置";
                            break;
                        case DataStore.DisplayStore.InforAS:
                            this.labelTitleRoot.Text = "信息 > A/S";
                            break;
                        case DataStore.DisplayStore.InforHelp:
                            this.labelTitleRoot.Text = "信息 > 帮助";
                            break;
                        case DataStore.DisplayStore.InforSystem:
                            this.labelTitleRoot.Text = "信息 > 系统信息";
                            break;
                        case DataStore.DisplayStore.SystemAutoZero:
                            this.labelTitleRoot.Text = "系统 > 自动零点跟踪";
                            break;
                        case DataStore.DisplayStore.SystemCalibration:
                            this.labelTitleRoot.Text = "系统 > 校准";
                            break;
                        case DataStore.DisplayStore.SystemExternalOutput:
                            this.labelTitleRoot.Text = "系统 > 外部输出";
                            break;
                        case DataStore.DisplayStore.SystemHelp:
                            this.labelTitleRoot.Text = "系统 > 帮助";
                            break;
                        case DataStore.DisplayStore.SystemIOTest:
                            this.labelTitleRoot.Text = "系统 > I/O测试";
                            break;
                        case DataStore.DisplayStore.SystemJudgmentSetting:
                            this.labelTitleRoot.Text = "系统 > 判断设置";
                            break;
                        case DataStore.DisplayStore.SystemSorterSetting:
                            this.labelTitleRoot.Text = "系统 > 筛选设定";
                            break;
                        case DataStore.DisplayStore.SystemServoMotor:
                            this.labelTitleRoot.Text = "System > Servo settings";
                            break;
                        default:
                            break;
                    }
                    #endregion
                    break;
                case DataStore.LanguageID.Czech:
                    break;
                default:
                    #region 한글
                    switch (status.CurrentDisplay)
                    {
                        case DataStore.DisplayStore.BasicDataBackup:
                            this.labelTitleRoot.Text = "기본설정 > 데이터백업";
                            break;
                        case DataStore.DisplayStore.BasicDataStatistics:
                            this.labelTitleRoot.Text = "기본설정 > 데이터집계";
                            break;
                        case DataStore.DisplayStore.BasicHelp:
                            this.labelTitleRoot.Text = "기본설정 > 도움말";
                            break;
                        case DataStore.DisplayStore.BasicProduct:
                            this.labelTitleRoot.Text = "기본설정 > 품목설정";
                            break;
                        case DataStore.DisplayStore.BasicTime:
                            this.labelTitleRoot.Text = "기본설정 > 시간설정";
                            break;
                        case DataStore.DisplayStore.ConfiCommunication:
                            this.labelTitleRoot.Text = "환경설정 > 시리얼통신";
                            break;
                        case DataStore.DisplayStore.ConfiHelp:
                            this.labelTitleRoot.Text = "환경설정 > 도움말";
                            break;
                        case DataStore.DisplayStore.ConfiOption:
                            this.labelTitleRoot.Text = "환경설정 > 옵션설정";
                            break;
                        case DataStore.DisplayStore.EquipFuctionSetting:
                            this.labelTitleRoot.Text = "장비설정 > 기능설정";
                            break;
                        case DataStore.DisplayStore.EquipHelp:
                            this.labelTitleRoot.Text = "장비설정 > 도움말";
                            break;
                        case DataStore.DisplayStore.EquipInitialize:
                            this.labelTitleRoot.Text = "장비설정 > 공장초기화";
                            break;
                        case DataStore.DisplayStore.EquipTest:
                            this.labelTitleRoot.Text = "장비설정 > 장비테스트";
                            break;
                        case DataStore.DisplayStore.EquipUpdate:
                            this.labelTitleRoot.Text = "장비설정 > 업데이트";
                            break;
                        case DataStore.DisplayStore.EquipUser:
                            this.labelTitleRoot.Text = "장비설정 > 유저설정";
                            break;
                        case DataStore.DisplayStore.InforAS:
                            this.labelTitleRoot.Text = "정보 > A/S";
                            break;
                        case DataStore.DisplayStore.InforHelp:
                            this.labelTitleRoot.Text = "정보 > 도움말";
                            break;
                        case DataStore.DisplayStore.InforSystem:
                            this.labelTitleRoot.Text = "정보 > 시스템정보";
                            break;
                        case DataStore.DisplayStore.SystemAutoZero:
                            this.labelTitleRoot.Text = "시스템설정 > 자동영점";
                            break;
                        case DataStore.DisplayStore.SystemCalibration:
                            this.labelTitleRoot.Text = "시스템설정 > 중량조정";
                            break;
                        case DataStore.DisplayStore.SystemExternalOutput:
                            this.labelTitleRoot.Text = "시스템설정 > 외부출력";
                            break;
                        case DataStore.DisplayStore.SystemHelp:
                            this.labelTitleRoot.Text = "시스템설정 > 도움말";
                            break;
                        case DataStore.DisplayStore.SystemIOTest:
                            this.labelTitleRoot.Text = "시스템설정 > I/O테스트";
                            break;
                        case DataStore.DisplayStore.SystemJudgmentSetting:
                            this.labelTitleRoot.Text = "시스템설정 > 판정설정";
                            break;
                        case DataStore.DisplayStore.SystemSorterSetting:
                            this.labelTitleRoot.Text = "시스템설정 > 선별기설정";
                            break;
                        case DataStore.DisplayStore.SystemServoMotor:
                            this.labelTitleRoot.Text = "시스템설정 > 서보모터설정";
                            break;
                        default:
                            break;
                    }
                    #endregion
                    break;
            }
        }

        public void DisplayRefresh(SystemStatus status)
        {
            //this.UpdateDisplayUser(status);
            this.DisplayTitleRoot(this.ParentForm.CurrentSystemStatus);

            this.buttonBasic.ButtonDown();
            this.buttonConfiguration.ButtonUp();
            this.buttonSystem.ButtonUp();
            this.buttonEquipment.ButtonUp();
            this.buttonInformation.ButtonUp();

            this.SelectedSideMenu = DataStore.MemuSide.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 = DataStore.MemuSide.Basic;
            this.DisplaySideMenu(this.SelectedSideMenu);
        }

        private void buttonConfiguration_Click(object sender, EventArgs e)
        {
            this.SelectedSideMenu = DataStore.MemuSide.Configuration;
            this.DisplaySideMenu(this.SelectedSideMenu);
        }

        private void buttonSystem_Click(object sender, EventArgs e)
        {
            this.SelectedSideMenu = DataStore.MemuSide.System;
            this.DisplaySideMenu(this.SelectedSideMenu);
        }

        private void buttonEquipment_Click(object sender, EventArgs e)
        {
            this.SelectedSideMenu = DataStore.MemuSide.Equipment;
            this.DisplaySideMenu(this.SelectedSideMenu);
        }

        private void buttonInformation_Click(object sender, EventArgs e)
        {
            this.SelectedSideMenu = DataStore.MemuSide.Information;
            this.DisplaySideMenu(this.SelectedSideMenu);
        }

        private void buttonMain_Click(object sender, EventArgs e)
        {
            // 서보 통신 Close
            this.CenterSystemServoMotor.ModbusClose();

            this.ParentForm.ChildFormMainDisplay.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
            ((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMainDisplay);
        }
        #endregion

        private void pictureBoxStop_Click(object sender, EventArgs e)
        {

        }

        private void pictureBoxStart_Click(object sender, EventArgs e)
        {

        }
    }
}