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

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

        public ControlConfiOptionBoard1 ControlOPT1;
        #endregion

        #region Constructor
        public ControlCenterConfiOptionBoard(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()
        {
            int value = 0;

            value = int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter9507.OptionBoard);
            if (value == 1)
                this.ControlOPT1.InitializeDesign();
            //else if (value == 2)
            //    this.ControlOPT2.InitializeDesign();

            this.ParentForm.ParentForm.ChildFormMainDisplay.CurrentBottomMenuControlEnable();
        }
        private void DefaultSetting()
        {
            this.ControlOPT1 = new ControlConfiOptionBoard1(this.ParentForm);

            this.Controls.Add(this.ControlOPT1);

            this.ControlOPT1.Location = new Point(0, 0);

            this.ControlOPT1.Visible = false;
        }

        private void UpdateDisplay(SystemStatus status)
        {
            int value = 0;

            try
            {
                value = int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter9507.OptionBoard);
            }
            catch
            {
                value = 0;
            }

            if (value == 1)
            {
                this.ControlOPT1.Visible = true;

                this.ControlOPT1.BringToFront();
                this.ControlOPT1.DisplayRefresh(status);
            }
            else
            {
                this.ControlOPT1.Visible = false;
            }
        }

        public void DisplayRefresh(SystemStatus status)
        {
            this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = Define.E_DisplayStore.ConfiOptionBoard;
            this.ParentForm.ParentForm.SetDisplayMode(Define.E_DisplayMode.Menu);
            this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);

            this.UpdateDisplay(status);
        }
        #endregion
    }
}
