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

using INT69DB_2A.DialogForms;
using INT69DB_2A_ImageDll;
using SmartX;
using INT69DB_2A.Part11_UserManager;

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

        #endregion

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

            this.ParentForm = parent;

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

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

        #region Method
        private void InitializeDesign()
        {
            ImageDll images = new ImageDll();

            if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.English)
            {
                this.labelTitle.Text = "Equipment";

                this.labelStaticEquipmentType.Text = "Type";
                this.radioButtonEquipmentModeStick1.Text = "Stick-I";
                this.radioButtonEquipmentModeStick2.Text = "Stick-II";
                this.radioButtonEquipmentModeStick3.Text = "Stick-III";
                this.labelStaticEquipmentLine.Text = "Line";
                this.labelStaticEmergencyStopEntrySensorError.Text = "Emergency stop due to entry sensor error";
                this.labelStaticWeightCheck.Text = "Order";
                this.labelStaticIndividualNG.Text = "Individual NG";
                this.labelStaticSelectSensor.Text = "Select Entry sensor";
                this.labelStaticRejectConveyor.Text = "Reject conveyor";
                this.labelStaticFeedingConveyor.Text = "Feeding conveyor";
                this.labelStaticEquipmentID.Text = "Equipment ID";
                this.labelStaticDataStoragePeriod.Text = "Data storage period";
                this.labelStaticImpellerBaudrate.Text = "Impeller:baudrate";
                this.labelStaticImpellerRotationDirection.Text = "Impeller:Direction";
                this.labelStaticLanguage.Text = "Language";
                this.labelStaticLogin.Text = "Login";
                this.labelTitleStepMotorType.Text = "Step Motor Type";
                this.labelStaticIntegratedTransmission.Text = "Integrated transmission";

                this.labelBuadrateWarning.Text = "※ After changing setting, Turn OFF the power and then turn ON the power";
                this.labelBuadrateWarning2.Text = "※ Do not change the value except engineer";
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
            {
                this.labelTitle.Text = "设备设置";

                this.groupBoxSpecialMenu.Text = "设备设置";
                this.labelStaticEquipmentType.Text = "设备类型";
                this.radioButtonEquipmentModeStick1.Text = "球杆-I";
                this.radioButtonEquipmentModeStick2.Text = "球杆-II";
                this.radioButtonEquipmentModeStick3.Text = "球杆-III";
                this.labelStaticEquipmentLine.Text = "列";
                this.labelStaticEmergencyStopEntrySensorError.Text = "由于进入传感器错误导致紧急停止";
                this.labelStaticWeightCheck.Text = "重量标示";
                this.labelStaticIndividualNG.Text = "单独NG";
                this.labelStaticSelectSensor.Text = "选择输入传感器";
                this.labelStaticRejectConveyor.Text = "排放输送带";
                this.labelStaticFeedingConveyor.Text = "进料输送带";
                this.labelStaticEquipmentID.Text = "设备编号";
                this.labelStaticDataStoragePeriod.Text = "数据保存期限";
                this.labelStaticImpellerBaudrate.Text = "波特率";
                this.labelStaticImpellerRotationDirection.Text = "排放输送机旋转方向";
                this.labelStaticLanguage.Text = "语言";
                this.labelStaticLogin.Text = "登錄";
                this.labelTitleStepMotorType.Text = "步进电机类型";
                this.labelStaticIntegratedTransmission.Text = "综合传输";

                this.smartLabel2.Text = "球杆-II";
                this.smartLabel12.Text = "球杆-I";
                this.smartLabel14.Text = "球杆-I";

                this.radioButtonWeightViewForward.Text = "正向(1~6)";
                this.radioButtonWeightViewReverse.Text = "反向(6~1)";

                this.labelBuadrateWarning.Text = "※ 电源重启后，设置会自动更新";
                this.labelBuadrateWarning2.Text = "※ 除了工程师之外，不要改变这个值";

                //this.buttonEachNG.DownImage = this.buttonLogin.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnEnable));
                //this.buttonEachNG.UpImage = this.buttonLogin.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnDisable));
                //this.buttonFeedingConveyor.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnEnable));
                //this.buttonFeedingConveyor.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnDisable));
                //this.buttonDischargeConveyor.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnEnable));
                //this.buttonDischargeConveyor.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnDisable));
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Japanese)
            {
                this.labelTitle.Text = "装置設定";

                this.groupBoxSpecialMenu.Text = "装置設定";
                this.labelStaticEquipmentType.Text = "装置タイプ";
                this.radioButtonEquipmentModeStick1.Text = "スティック-I";
                this.radioButtonEquipmentModeStick2.Text = "スティック-II";
                this.radioButtonEquipmentModeStick3.Text = "スティック-III";
                this.labelStaticEquipmentLine.Text = "ライン";
                this.labelStaticEmergencyStopEntrySensorError.Text = "入力センサエラー時に停止";
                this.labelStaticWeightCheck.Text = "重量表示";
                this.labelStaticIndividualNG.Text = "個別NG";
                this.labelStaticSelectSensor.Text = "入力センサㅡの選択";
                this.labelStaticRejectConveyor.Text = "排出コンベア";
                this.labelStaticFeedingConveyor.Text = "供給コンベア";
                this.labelStaticEquipmentID.Text = "装置ID";
                this.labelStaticDataStoragePeriod.Text = "保管期間";
                this.labelStaticImpellerBaudrate.Text = "インペラㅡ:baudrate";
                this.labelStaticImpellerRotationDirection.Text = "インペラㅡ:方向";
                this.labelStaticLanguage.Text = "言語";
                this.labelStaticLogin.Text = "ログイン";
                this.labelTitleStepMotorType.Text = "モㅡタㅡタイプ";
                this.labelStaticIntegratedTransmission.Text = "統合搬送";

                this.smartLabel2.Text = "スティック-II";
                this.smartLabel12.Text = "スティック-I";
                this.smartLabel14.Text = "スティック-I";

                this.radioButtonWeightViewForward.Text = "順方向(1~6)";
                this.radioButtonWeightViewReverse.Text = "逆方向(6~1)";

                this.labelBuadrateWarning.Text = "※ 設定を変更したら、電源を入れ直してください。";
                this.labelBuadrateWarning2.Text = "※ エンジニア以外に絶対に変更しないでください。";
            }
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech)
            {

            }
            else
            {

            }
        }
        private void InitializeControl()
        {
            // 장비 열
            this.comboBoxEquipmentColumn.Items.Clear();
            this.comboBoxEquipmentColumn.Items.Add(2);
            this.comboBoxEquipmentColumn.Items.Add(3);
            this.comboBoxEquipmentColumn.Items.Add(4);
            this.comboBoxEquipmentColumn.Items.Add(5);
            this.comboBoxEquipmentColumn.Items.Add(6);
            this.comboBoxEquipmentColumn.Items.Add(7);
            this.comboBoxEquipmentColumn.Items.Add(8);
            this.comboBoxEquipmentColumn.Items.Add(10);

            // 입력센서 선택
            this.comboBoxInputSensorSelect.Items.Clear();
            this.comboBoxInputSensorSelect.Items.Add(1);
            this.comboBoxInputSensorSelect.Items.Add(2);
            this.comboBoxInputSensorSelect.Items.Add(3);
            this.comboBoxInputSensorSelect.Items.Add(4);
            this.comboBoxInputSensorSelect.Items.Add(5);
            this.comboBoxInputSensorSelect.Items.Add(6);
            this.comboBoxInputSensorSelect.Items.Add(7);
            this.comboBoxInputSensorSelect.Items.Add(8);
            this.comboBoxInputSensorSelect.Items.Add(9);
            this.comboBoxInputSensorSelect.Items.Add(10);

            // 스텝모터 종류
            this.comboBoxStepMotorType.Items.Clear();
            this.comboBoxStepMotorType.Items.Add("MDrive");
            this.comboBoxStepMotorType.Items.Add("EDB_ALL_P");
            this.comboBoxStepMotorType.Items.Add("Moons");
        }

        private void UpdateDisplay()
        {
            // 장비타입
            if (this.ParentForm.SystemConfig.EquipmentMode == 1)
                this.radioButtonEquipmentModeStick1.Checked = true;
            else if (this.ParentForm.SystemConfig.EquipmentMode == 2)
                this.radioButtonEquipmentModeStick2.Checked = true;
            else
                this.radioButtonEquipmentModeStick3.Checked = true;

            // 장비 열
            this.comboBoxEquipmentColumn.SelectedItem = this.ParentForm.SystemConfig.EquipmentColumns;

            // 중량표시
            if (this.ParentForm.SystemConfig.IsWeightViewForward == true)
                this.radioButtonWeightViewForward.Checked = true;
            else
                this.radioButtonWeightViewReverse.Checked = true;

            // 통합 전송
            if (this.ParentForm.SystemConfig.IsIntegratedTransmission == true)
                this.buttonIntegratedTransmission.ButtonDown();
            else
                this.buttonIntegratedTransmission.ButtonUp();

            // 개별 NG
            if (this.ParentForm.SystemConfig.IsEachNG == true)
                this.buttonEachNG.ButtonDown();
            else
                this.buttonEachNG.ButtonUp();

            // 입력센서 선택
            this.comboBoxInputSensorSelect.SelectedItem = this.ParentForm.SystemConfig.InputSensorSelect;

            // 입력센서 연속입력 시 정지
            if (this.ParentForm.SystemConfig.IsEmergencyStopEntrySensorError == true)
                this.buttonEmergencyStopEntrySensorError.ButtonDown();
            else
                this.buttonEmergencyStopEntrySensorError.ButtonUp();

            // 배출 컨베어
            if (this.ParentForm.SystemConfig.IsDischargeConveyor == true)
                this.buttonDischargeConveyor.ButtonDown();
            else
                this.buttonDischargeConveyor.ButtonUp();

            // 배출 컨베어 회전방향
            if (this.ParentForm.SystemConfig.DischargeConveyorDirectionCW == DataStore.DischargeConveyorDirection.CW)
                this.radioButtonDischargeConveyorDirectionCW.Checked = true;
            else if (this.ParentForm.SystemConfig.DischargeConveyorDirectionCW == DataStore.DischargeConveyorDirection.CCW)
                this.radioButtonDischargeConveyorDirectionCCW.Checked = true;
            else
                this.radioButtonDischargeConveyorDirectionCWCCW.Checked = true;

            // Feeding 컨베어
            if (this.ParentForm.SystemConfig.IsFeedingConveyor == true)
                this.buttonFeedingConveyor.ButtonDown();
            else
                this.buttonFeedingConveyor.ButtonUp();

            // Feeding 컨베어 구동
            if (this.ParentForm.SystemConfig.IsFeedingConveyorRunPass == true)
                this.radioButtonFeedingConveyorRunPass.Checked = true;
            else
                this.radioButtonFeedingConveyorRunNg.Checked = true;

            // 장비 ID
            if (this.labelEquipmentID.Text != this.ParentForm.SystemConfig.EquipmentID.ToString())
                this.labelEquipmentID.Text = this.ParentForm.SystemConfig.EquipmentID.ToString();

            // 데이터 저장기간
            if (this.labelDataStoragePeriod.Text != this.ParentForm.SystemConfig.DataStoragePeriod.ToString())
                this.labelDataStoragePeriod.Text = this.ParentForm.SystemConfig.DataStoragePeriod.ToString();

            // 임펠러모터 통신속도
            if (this.ParentForm.SystemConfig.ImpellerMotorBaudrate == 1)
                this.radioButtonImpellerMotorBaudrate9600.Checked = true;
            else if (this.ParentForm.SystemConfig.ImpellerMotorBaudrate == 2)
                this.radioButtonImpellerMotorBaudrate19200.Checked = true;
            else if (this.ParentForm.SystemConfig.ImpellerMotorBaudrate == 3)
                this.radioButtonImpellerMotorBaudrate38400.Checked = true;
            else
                this.radioButtonImpellerMotorBaudrate115200.Checked = true;

            // 임펠러모터 회전방향
            if (this.ParentForm.SystemConfig.IsImpellerMotorDirectionCW == true)
                this.radioButtonImpellerMotorDirectionCW.Checked = true;
            else
                this.radioButtonImpellerMotorDirectionCCW.Checked = true;

            // 언어
            if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Korean)
                this.radioButtonKorean.Checked = true;
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.English)
                this.radioButtonEnglish.Checked = true;
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
                this.radioButtonChinese.Checked = true;
            else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Japanese)
                this.radioButtonJapanese.Checked = true;
            else
                this.radioButtonChinese.Checked = true;

            // 로그인
            if (this.ParentForm.SystemConfig.IsLogin == true)
                this.buttonLogin.ButtonDown();
            else
                this.buttonLogin.ButtonUp();

            // 스텝모터 종류
            if (this.ParentForm.SystemConfig.StepMotorType == (int)DataStore.StepMotorType.EDB_ALL_P)
                this.comboBoxStepMotorType.SelectedIndex = 1;
            else if (this.ParentForm.SystemConfig.StepMotorType == (int)DataStore.StepMotorType.Moons)
                this.comboBoxStepMotorType.SelectedIndex = 2;
            else
                this.comboBoxStepMotorType.SelectedIndex = 0;

            // Ping Timer
            if (this.ParentForm.SystemConfig.IsPingTimer == true)
                this.buttonPingTimer.ButtonDown();
            else
                this.buttonPingTimer.ButtonUp();

            this.buttonSave.Visible = false;
        }

        public void DisplayRefresh()
        {
            this.UpdateDisplay();

            this.ParentForm.SystemConfig.CurrentForm = DataStore.FormStore.FormEquipmentSetting;
        }
        #endregion

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

            this.InitializeDesign();
        }
        #endregion

        #region Event Handler
        private void buttonPingTimer_Click(object sender, EventArgs e)
        {
            // Ping Timer
            if (this.buttonPingTimer.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
                this.ParentForm.SystemConfig.IsPingTimer = true;
            else
                this.ParentForm.SystemConfig.IsPingTimer = false;

            this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig);
        }

        private void labelEquipmentID_Click(object sender, EventArgs e)
        {
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelEquipmentID.Text, 3, 0, false, this.ParentForm.SystemConfig.Language);

            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (this.labelEquipmentID.Text != myKeyPad.StringValue)
                {
                    this.labelEquipmentID.Text = myKeyPad.StringValue;

                    if (this.buttonSave.Visible != true)
                        this.buttonSave.Visible = true;
                }
            }
        }
        private void labelDataStoragePeriod_Click(object sender, EventArgs e)
        {
            DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelDataStoragePeriod.Text, 2, 0, false, this.ParentForm.SystemConfig.Language);
            if (myKeyPad.ShowDialog() == DialogResult.OK)
            {
                if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 99)
                {
                    // 입력범위를 확인하세요
                    DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
                    myMsg.ShowDialog();
                }
                else
                {
                    this.labelDataStoragePeriod.Text = myKeyPad.StringValue;

                    if (this.buttonSave.Visible != true)
                        this.buttonSave.Visible = true;
                }
            }
        }

        private void control_Click(object sender, EventArgs e)
        {
            if (this.buttonSave.Visible != true)
                this.buttonSave.Visible = true;
            
            SmartX.SmartButton button = sender as SmartX.SmartButton;
            if (button == this.buttonLogin)
            {
                if (this.ParentForm.SystemConfig.IsPart11 == true)
                    this.buttonLogin.ButtonDown();
            }
        }

        private void buttonSave_Click(object sender, EventArgs e)
        {
            // 장비 타입
            if (this.radioButtonEquipmentModeStick1.Checked == true)
                this.ParentForm.SystemConfig.EquipmentMode = 1;
            else if (this.radioButtonEquipmentModeStick2.Checked == true)
                this.ParentForm.SystemConfig.EquipmentMode = 2;
            else
                this.ParentForm.SystemConfig.EquipmentMode = 3;

            // 장비 열
            if (this.comboBoxEquipmentColumn.SelectedIndex == 0)
                this.ParentForm.SystemConfig.EquipmentColumns = 2;
            else if (this.comboBoxEquipmentColumn.SelectedIndex == 1)
                this.ParentForm.SystemConfig.EquipmentColumns = 3;
            else if (this.comboBoxEquipmentColumn.SelectedIndex == 2)
                this.ParentForm.SystemConfig.EquipmentColumns = 4;
            else if (this.comboBoxEquipmentColumn.SelectedIndex == 3)
                this.ParentForm.SystemConfig.EquipmentColumns = 5;
            else if (this.comboBoxEquipmentColumn.SelectedIndex == 4)
                this.ParentForm.SystemConfig.EquipmentColumns = 6;
            else if (this.comboBoxEquipmentColumn.SelectedIndex == 5)
                this.ParentForm.SystemConfig.EquipmentColumns = 7;
            else if (this.comboBoxEquipmentColumn.SelectedIndex == 6)
                this.ParentForm.SystemConfig.EquipmentColumns = 8;
            else
                this.ParentForm.SystemConfig.EquipmentColumns = 10;

            // 통합 전송
            if (this.buttonIntegratedTransmission.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
                this.ParentForm.SystemConfig.IsIntegratedTransmission = true;
            else
                this.ParentForm.SystemConfig.IsIntegratedTransmission = false;

            // 중량표시
            if (this.radioButtonWeightViewForward.Checked == true)
                this.ParentForm.SystemConfig.IsWeightViewForward = true;
            else
                this.ParentForm.SystemConfig.IsWeightViewForward = false;

            // 개별 NG
            if (this.buttonEachNG.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
                this.ParentForm.SystemConfig.IsEachNG = true;
            else
                this.ParentForm.SystemConfig.IsEachNG = false;

            // 입력센서 선택
            this.ParentForm.SystemConfig.InputSensorSelect = this.comboBoxInputSensorSelect.SelectedIndex + 1;

            // 입력센서 연속입력 시 정지
            if (this.buttonEmergencyStopEntrySensorError.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
                this.ParentForm.SystemConfig.IsEmergencyStopEntrySensorError = true;
            else
                this.ParentForm.SystemConfig.IsEmergencyStopEntrySensorError = false;

            // 배출 컨베어 
            if (this.buttonDischargeConveyor.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
                this.ParentForm.SystemConfig.IsDischargeConveyor = true;
            else
                this.ParentForm.SystemConfig.IsDischargeConveyor = false;

            // 배출 컨베어 회전방향
            if (this.radioButtonDischargeConveyorDirectionCW.Checked == true)
                this.ParentForm.SystemConfig.DischargeConveyorDirectionCW = DataStore.DischargeConveyorDirection.CW;
            else if (this.radioButtonDischargeConveyorDirectionCCW.Checked == true)
                this.ParentForm.SystemConfig.DischargeConveyorDirectionCW = DataStore.DischargeConveyorDirection.CCW;
            else
                this.ParentForm.SystemConfig.DischargeConveyorDirectionCW = DataStore.DischargeConveyorDirection.CW_CCW;

            // Feeding 컨베어
            if (this.buttonFeedingConveyor.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
                this.ParentForm.SystemConfig.IsFeedingConveyor = true;
            else
                this.ParentForm.SystemConfig.IsFeedingConveyor = false;

            // Feeding 컨베어 구동
            if (this.radioButtonFeedingConveyorRunPass.Checked == true)
                this.ParentForm.SystemConfig.IsFeedingConveyorRunPass = true;
            else
                this.ParentForm.SystemConfig.IsFeedingConveyorRunPass = false;

            // 장비 ID
            this.ParentForm.SystemConfig.EquipmentID = int.Parse(this.labelEquipmentID.Text);
            // 데이터 저장기간
            this.ParentForm.SystemConfig.DataStoragePeriod = int.Parse(this.labelDataStoragePeriod.Text);

            // 임펠러모터 통신속도
            if (this.radioButtonImpellerMotorBaudrate9600.Checked == true)
                this.ParentForm.SystemConfig.ImpellerMotorBaudrate = 1;
            else if (this.radioButtonImpellerMotorBaudrate19200.Checked == true)
                this.ParentForm.SystemConfig.ImpellerMotorBaudrate = 2;
            else if (this.radioButtonImpellerMotorBaudrate38400.Checked == true)
                this.ParentForm.SystemConfig.ImpellerMotorBaudrate = 3;
            else
                this.ParentForm.SystemConfig.ImpellerMotorBaudrate = 4;

            // 임펠러모터 회전방향
            if (this.radioButtonImpellerMotorDirectionCW.Checked == true)
                this.ParentForm.SystemConfig.IsImpellerMotorDirectionCW = true;
            else
                this.ParentForm.SystemConfig.IsImpellerMotorDirectionCW = false;

            // 언어
            if (this.radioButtonKorean.Checked == true)
                this.ParentForm.SystemConfig.Language = DataStore.LanguageID.Korean;
            else if (this.radioButtonChinese.Checked == true)
                this.ParentForm.SystemConfig.Language = DataStore.LanguageID.Chinese;
            else if (this.radioButtonJapanese.Checked == true)
                this.ParentForm.SystemConfig.Language = DataStore.LanguageID.Japanese;
            else
                this.ParentForm.SystemConfig.Language = DataStore.LanguageID.English;

            // 로그인
            if (this.buttonLogin.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
                this.ParentForm.SystemConfig.IsLogin = true;
            else
            {
                this.ParentForm.SystemConfig.IsLogin = false;

                // Delete user list
                UserManager.UserManager_UserAllDel();
            }

            // 스텝모터 종류
            if (this.comboBoxStepMotorType.SelectedIndex == 1)
                this.ParentForm.SystemConfig.StepMotorType = (int)DataStore.StepMotorType.EDB_ALL_P;
            else if (this.comboBoxStepMotorType.SelectedIndex == 2)
                this.ParentForm.SystemConfig.StepMotorType = (int)DataStore.StepMotorType.Moons;
            else
                this.ParentForm.SystemConfig.StepMotorType = (int)DataStore.StepMotorType.MDrive;

            // SystemConfig 파일 저장
            this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig);

            DialogFormMessage myMsg = new DialogFormMessage(18, this.ParentForm.SystemConfig.Language);
            myMsg.ShowDialog();

            this.groupBoxSpecialMenu.Enabled = false;
            this.buttonBack.Visible = false;
            this.buttonSave.Visible = false;
        }
        private void buttonBack_Click(object sender, EventArgs e)
        {
            this.ParentForm.ChildFormMenu.DisplayRefresh();
            ((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMenu);
        }
        #endregion
    }
}