using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

using SmartX;
using INT51DB.Forms;
using INT51DB_ImageDll;

namespace INT51DB.Controls
{
    public partial class ControlCenterSystemHelp : UserControl
    {
        #region Field
        private FormMenu m_ParentForm;

        private DataStore.MenuBottomSystem CurrentMenu;
        #endregion

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

            this.ParentForm = parent;

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

        #region Property
        public FormMenu 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.ParentForm.SystemConfig.Language == DataStore.LanguageID.English)
            {
            }
            else if (this.ParentForm.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
            {
            }
            else if (this.ParentForm.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech)
            {
            }
            else
            {
            }
        }
        private void DefaultSetting()
        {
            this.CurrentMenu = DataStore.MenuBottomSystem.Help;
        }

        public void UpdateDisplayMenuButton(DataStore.MenuBottomSystem menu)
        {
            switch (menu)
            {
                case DataStore.MenuBottomSystem.AutoZero:
                    if (this.buttonAutoZero.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
                        this.buttonAutoZero.ButtonDown();
                    if (this.buttonCalibration.ButtonStatus != SmartButton.BUTSTATUS.UP)
                        this.buttonCalibration.ButtonUp();
                    
                    break;
                case DataStore.MenuBottomSystem.Calibration:
                    break;
                case DataStore.MenuBottomSystem.Help:
                    break;
                case DataStore.MenuBottomSystem.IOTest:
                    break;
                case DataStore.MenuBottomSystem.JudgmentSetting:
                    break;
                case DataStore.MenuBottomSystem.SorterSetting:
                    break;
                default:
                    break;
            }
        }

        public void DisplayRefresh(DataStore.UserGroup group)
        {
            this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.SystemHelp;
            this.ParentForm.ParentForm.SetDisplayMode(DataStore.DisplayMode.Menu);
            this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
        }
        #endregion

        #region Event Handler
        private void buttonMenu_Click(object sender, EventArgs e)
        {
            SmartButton button = sender as SmartButton;

            if (button == null)
                return;

            if (button == this.buttonCalibration)
                this.CurrentMenu = DataStore.MenuBottomSystem.Calibration;
            else if (button == this.buttonJudgmentSetting)
                this.CurrentMenu = DataStore.MenuBottomSystem.JudgmentSetting;
            else if (button == this.buttonSorter)
                this.CurrentMenu = DataStore.MenuBottomSystem.SorterSetting;
            else if (button == this.buttonAutoZero)
                this.CurrentMenu = DataStore.MenuBottomSystem.AutoZero;
            else if (button == this.buttonExternalOutput)
                this.CurrentMenu = DataStore.MenuBottomSystem.ExternalOutput;
            else if (button == this.buttonIOTest)
                this.CurrentMenu = DataStore.MenuBottomSystem.IOTest;
            else if (button == this.buttonServo)
                this.CurrentMenu = DataStore.MenuBottomSystem.ServoMotor;
            else
                this.CurrentMenu = DataStore.MenuBottomSystem.Help;

            this.ParentForm.DisplayBottomSystem(this.CurrentMenu);
        }
        #endregion
    }
}
