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 ITC81DB_2.Forms;
using ITC81DB_2_ImageDll;

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

        private Define.E_MenuBottomConfiguration CurrentMenu;
        #endregion

        #region Constructor
        public ControlCenterConfiHelp(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 == Define.E_LanguageID.English)
            {
                this.buttonSerialCOM1.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM1Disable));
                this.buttonSerialCOM1.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM1Down));
                this.buttonSerialCOM1.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM1Up));
                this.buttonSerialCOM3.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM3Disable));
                this.buttonSerialCOM3.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM3Down));
                this.buttonSerialCOM3.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM3Up));
                this.buttonSerialCOM4.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM4Disable));
                this.buttonSerialCOM4.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM4Down));
                this.buttonSerialCOM4.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM4Up));
                this.buttonEthernet.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpEthernetDisable));
                this.buttonEthernet.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpEthernetDown));
                this.buttonEthernet.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpEthernetUp));
                this.buttonOptionBoard.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpOptionBoardDisable));
                this.buttonOptionBoard.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpOptionBoardDown));
                this.buttonOptionBoard.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpOptionBoardUp));
            }
            else if (this.ParentForm.ParentForm.SystemConfig.Language == Define.E_LanguageID.Chinese)
            {
                this.buttonSerialCOM1.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM1Disable));
                this.buttonSerialCOM1.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM1Down));
                this.buttonSerialCOM1.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM1Up));
                this.buttonSerialCOM3.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM3Disable));
                this.buttonSerialCOM3.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM3Down));
                this.buttonSerialCOM3.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM3Up));
                this.buttonSerialCOM4.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM4Disable));
                this.buttonSerialCOM4.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM4Down));
                this.buttonSerialCOM4.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM4Up));
                this.buttonEthernet.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpEthernetDisable));
                this.buttonEthernet.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpEthernetDown));
                this.buttonEthernet.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpEthernetUp));
                this.buttonOptionBoard.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpOptionBoardDisable));
                this.buttonOptionBoard.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpOptionBoardDown));
                this.buttonOptionBoard.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpOptionBoardUp));
            }
            else if (this.ParentForm.ParentForm.SystemConfig.Language == Define.E_LanguageID.Czech)
            {
            }
            else if (this.ParentForm.ParentForm.SystemConfig.Language == Define.E_LanguageID.Spanish)
            {
                this.buttonSerialCOM1.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpSerialCOM1Disable));
                this.buttonSerialCOM1.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpSerialCOM1Down));
                this.buttonSerialCOM1.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpSerialCOM1Up));
                this.buttonSerialCOM3.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpSerialCOM3Disable));
                this.buttonSerialCOM3.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpSerialCOM3Down));
                this.buttonSerialCOM3.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpSerialCOM3Up));
                this.buttonSerialCOM4.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpSerialCOM4Disable));
                this.buttonSerialCOM4.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpSerialCOM4Down));
                this.buttonSerialCOM4.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpSerialCOM4Up));
                this.buttonEthernet.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpEthernetDisable));
                this.buttonEthernet.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpEthernetDown));
                this.buttonEthernet.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpEthernetUp));
                this.buttonOptionBoard.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpOptionBoardDisable));
                this.buttonOptionBoard.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpOptionBoardDown));
                this.buttonOptionBoard.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnHelpOptionBoardUp));
            }
            else
            {
                this.buttonSerialCOM1.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM1Disable));
                this.buttonSerialCOM1.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM1Down));
                this.buttonSerialCOM1.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM1Up));
                this.buttonSerialCOM3.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM3Disable));
                this.buttonSerialCOM3.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM3Down));
                this.buttonSerialCOM3.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM3Up));
                this.buttonSerialCOM4.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM4Disable));
                this.buttonSerialCOM4.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM4Down));
                this.buttonSerialCOM4.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM4Up));
                this.buttonEthernet.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpEthernetDisable));
                this.buttonEthernet.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpEthernetDown));
                this.buttonEthernet.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpEthernetUp));
                this.buttonOptionBoard.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpOptionBoardDisable));
                this.buttonOptionBoard.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpOptionBoardDown));
                this.buttonOptionBoard.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpOptionBoardUp));
            }
        }
        private void DefaultSetting()
        {
            this.CurrentMenu = Define.E_MenuBottomConfiguration.Help;
        }

        public void OptionBoardVisible()
        {
            int value;

            value = int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter9507.OptionBoard);
            if (value == 0)
                this.buttonOptionBoard.Visible = false;
            else
                this.buttonOptionBoard.Visible = true;
        }

        public void DisplayRefresh(SystemStatus status)
        {
            this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = Define.E_DisplayStore.ConfiHelp;
            this.ParentForm.ParentForm.SetDisplayMode(Define.E_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.buttonSerialCOM1)
                this.CurrentMenu = Define.E_MenuBottomConfiguration.SerialCOM1;
            else if (button == this.buttonSerialCOM3)
                this.CurrentMenu = Define.E_MenuBottomConfiguration.SerialCOM3;
            else if (button == this.buttonSerialCOM4)
                this.CurrentMenu = Define.E_MenuBottomConfiguration.SerialCOM4;
            else if (button == this.buttonEthernet)
                this.CurrentMenu = Define.E_MenuBottomConfiguration.Ethernet;
            else if (button == this.buttonOptionBoard)
                this.CurrentMenu = Define.E_MenuBottomConfiguration.OptionBoard;
            else
                this.CurrentMenu = Define.E_MenuBottomConfiguration.Help;

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