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 INT_LKD_2.DataStore;

namespace INT_LKD_2.DialogForms
{
    public partial class DialogFormYesNo : Form
    {
        #region Field

        #endregion

        #region Constructor
        public DialogFormYesNo()
        {
            InitializeComponent();
        }

        public DialogFormYesNo(Define.E_LanguageID language, int ok)
        {
            InitializeComponent();

            this.smartGroupBox1.Text = "";
            this.labelMessage1.Text = "";
            this.labelMessage2.Text = "";

            if (language == Define.E_LanguageID.Korean)
            {
                this.buttonYes.ButtonText = "Yes";
                this.buttonNo.ButtonText = "No";

                #region 한글
                switch (ok)
                {
                    case 1:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "예전 DLL로 되돌리시겠습니까?";
                        break;
                    case 2:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "언어를 변경하시겠습니까?";
                        break;
                    case 3:
                        this.smartGroupBox1.Text = "업데이트";
                        this.labelMessage1.Text = "새 버전으로 업데이트하시겠습니까?";
                        break;
                    case 4:
                        this.smartGroupBox1.Text = "스타일러스";
                        this.labelMessage1.Text = "화면 보정을 실행하시겠습니까?";
                        break;
                    case 5:
                        this.smartGroupBox1.Text = "공장초기화";
                        this.labelMessage1.Text = "설정된 모든 데이터가 초기화됩니다.";
                        break;
                    case 6:
                        this.smartGroupBox1.Text = "LCD초기화";
                        this.labelMessage1.Text = "LCD에 설정된 데이터가 초기화됩니다.";
                        break;
                    case 7:
                        this.smartGroupBox1.Text = "메인보드초기화";
                        this.labelMessage1.Text = "메인보드에 설정된 데이터가 초기화됩니다.";
                        break;
                    case 8:
                        this.smartGroupBox1.Text = "소거";
                        this.labelMessage1.Text = "현재 품번 카운트 데이터를 소거 하시겠습니까?";
                        break;
                    case 9:
                        this.smartGroupBox1.Text = "모터 다운로드";
                        this.labelMessage1.Text = "현재 값을 다운로드 하시겠습니까?";
                        break;
                    case 10:
                        this.smartGroupBox1.Text = "모터 다운로드";
                        this.labelMessage1.Text = "새 모터에 다운로드 하시겠습니까?";
                        break;
                    case 11:
                        this.smartGroupBox1.Text = "모터 다운로드";
                        this.labelMessage1.Text = "현재 라인번호로 변경하시겠습니까?";
                        break;
                    case 12:
                        this.smartGroupBox1.Text = "로그인";
                        this.labelMessage1.Text = "Log Off 하시겠습니까?";
                        break;
                    case 13:
                        this.smartGroupBox1.Text = "로그인";
                        this.labelMessage1.Text = "유저 등록 하시겠습니까?";
                        break;
                    case 14:
                        this.smartGroupBox1.Text = "로그인";
                        this.labelMessage1.Text = "유저 삭제 하시겠습니까?";
                        break;
                    case 15:
                        this.smartGroupBox1.Text = "유저설정";
                        this.labelMessage1.Text = "유저 등록 하시겠습니까?";
                        break;
                    case 16:
                        this.smartGroupBox1.Text = "유저설정";
                        this.labelMessage1.Text = "선택 된 유저를 삭제 하시겠습니까?";
                        break;
                    case 17:
                        this.smartGroupBox1.Text = "유저설정";
                        this.labelMessage1.Text = "신규 유저 등록 하시겠습니까?";
                        break;
                    case 18:
                        this.smartGroupBox1.Text = "로그인";
                        this.labelMessage1.Text = "비밀번호를 초기화 하시겠습니까?";
                        this.labelMessage2.Text = "";
                        break;
                    case 21:
                        this.smartGroupBox1.Text = "이더넷";
                        this.labelMessage1.Text = "로컬IP주소 수동으로 설정하시겠습니까?";
                        break;
                    case 22:
                        this.smartGroupBox1.Text = "이더넷";
                        this.labelMessage1.Text = "로컬IP주소 자동으로 설정하시겠습니까?";
                        break;
                    default:
                        break;
                }
                #endregion
            }
            else if (language == Define.E_LanguageID.English)
            {
                this.buttonYes.ButtonText = "Yes";
                this.buttonNo.ButtonText = "No";

                #region 영문
                switch (ok)
                {
                    case 1:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "Do you want to revert to the previous DLL?";
                        break;
                    case 2:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "Do you change the language?";
                        break;
                    case 3:
                        this.smartGroupBox1.Text = "Update";
                        this.labelMessage1.Text = "Would you like to update?";
                        break;
                    case 4:
                        this.smartGroupBox1.Text = "Stylus";
                        this.labelMessage1.Text = "To re-calibrate the screen, press the YES button.";
                        break;
                    case 5:
                        this.smartGroupBox1.Text = "Initialization";
                        this.labelMessage1.Text = "All datas will be initialized";
                        break;
                    case 6:
                        this.smartGroupBox1.Text = "LCD Initialization";
                        this.labelMessage1.Text = "All datas in LCD will be initialized";
                        break;
                    case 7:
                        this.smartGroupBox1.Text = "Mainboard Initialization";
                        this.labelMessage1.Text = "All datas in Mainboard will be initialized";
                        break;
                    case 8:
                        this.smartGroupBox1.Text = "Initialize";
                        this.labelMessage1.Text = "Do you want to Initialize current data?";
                        break;
                    case 9:
                        this.smartGroupBox1.Text = "Motor download";
                        this.labelMessage1.Text = "Do you want to download the current value?";
                        break;
                    case 10:
                        this.smartGroupBox1.Text = "Motor download";
                        this.labelMessage1.Text = "Do you want to download the new motor?";
                        break;
                    case 11:
                        this.smartGroupBox1.Text = "Motor download";
                        this.labelMessage1.Text = "Do you want to change with the device number to current line?";
                        break;
                    case 12:
                        this.smartGroupBox1.Text = "Login";
                        this.labelMessage1.Text = "Do you want to log out?";
                        break;
                    case 13:
                        this.smartGroupBox1.Text = "Login";
                        this.labelMessage1.Text = "Do you want to register the user?";
                        break;
                    case 14:
                        this.smartGroupBox1.Text = "Login";
                        this.labelMessage1.Text = "Do you want to delete this user?";
                        break;
                    case 15:
                        this.smartGroupBox1.Text = "User Setting";
                        this.labelMessage1.Text = "Do you want to register the user?";
                        break;
                    case 16:
                        this.smartGroupBox1.Text = "User Setting";
                        this.labelMessage1.Text = "Do you want to delete this user?";
                        break;
                    case 17:
                        this.smartGroupBox1.Text = "User Setting";
                        this.labelMessage1.Text = "Do you want to register the new user?";
                        break;
                    case 18:
                        this.smartGroupBox1.Text = "Login";
                        this.labelMessage1.Text = "Do you want to reset your password?";
                        this.labelMessage2.Text = "";
                        break;
                    case 21:
                        this.smartGroupBox1.Text = "Ethernet";
                        this.labelMessage1.Text = "Do you want to set the local IP address static?";
                        break;
                    case 22:
                        this.smartGroupBox1.Text = "Ethernet";
                        this.labelMessage1.Text = "Do you want to set the local IP address to DHCP?";
                        break;
                    default:
                        break;
                }
                #endregion
            }        
            else
            {
            }
        }
        public DialogFormYesNo(Define.E_LanguageID language, int ok, string msg)
        {
            InitializeComponent();

            this.smartGroupBox1.Text = "";
            this.labelMessage1.Text = "";
            this.labelMessage2.Text = "";

            switch (language)
            {
                case Define.E_LanguageID.Korean:
                    switch (ok)
                    {
                        case 31:
                            this.smartGroupBox1.Text = "파일";
                            this.labelMessage1.Text = string.Format("{0} 파일이 이미 있습니다. 바꾸시겠습니까?", msg);
                            break;
                        default:
                            break;
                    }
                    break;
                case Define.E_LanguageID.English:
                    switch (ok)
                    {
                        case 31:
                            this.smartGroupBox1.Text = "File";
                            this.labelMessage1.Text = string.Format("{0} already exists. Do you change the file?", msg);
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    break;
            }
        }
        public DialogFormYesNo(Define.E_LanguageID language, int ok, string before, string after)
        {
            InitializeComponent();

            this.smartGroupBox1.Text = "";
            this.labelMessage1.Text = "";
            this.labelMessage2.Text = "";

            switch (language)
            {
                case Define.E_LanguageID.Korean:
                    switch (ok)
                    {
                        case 3:
                            this.smartGroupBox1.Text = "업데이트";
                            this.labelMessage1.Text = string.Format("이전 : {0}, 이후 : {1}", before, after);
                            this.labelMessage2.Text = "업데이트를 진행하시겠습니까?";
                            break;
                        default:
                            break;
                    }
                    break;
                case Define.E_LanguageID.English:
                    switch (ok)
                    {
                        case 3:
                            this.smartGroupBox1.Text = "Update";
                            this.labelMessage1.Text = string.Format("Before : {0}, After : {1}", before, after);
                            this.labelMessage2.Text = "Do you want to run the update?";
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    break;
            }
        }
        public DialogFormYesNo(Define.E_MessageBoxIcon icon, string code, string message1, string message2)
        {
            InitializeComponent();

            switch (icon)
            {
                case Define.E_MessageBoxIcon.None:
                    this.pictureBoxAsterisk.Visible = false;
                    this.pictureBoxExclamation.Visible = false;
                    this.pictureBoxHand.Visible = false;
                    this.pictureBoxQuestion.Visible = false;
                    break;
                case Define.E_MessageBoxIcon.Hand:
                    this.pictureBoxAsterisk.Visible = false;
                    this.pictureBoxExclamation.Visible = false;
                    this.pictureBoxHand.Visible = true;
                    this.pictureBoxQuestion.Visible = false;
                    break;
                case Define.E_MessageBoxIcon.Question:
                    this.pictureBoxAsterisk.Visible = false;
                    this.pictureBoxExclamation.Visible = false;
                    this.pictureBoxHand.Visible = false;
                    this.pictureBoxQuestion.Visible = true;
                    break;
                case Define.E_MessageBoxIcon.Exclamation:
                    this.pictureBoxAsterisk.Visible = false;
                    this.pictureBoxExclamation.Visible = true;
                    this.pictureBoxHand.Visible = false;
                    this.pictureBoxQuestion.Visible = false;
                    break;
                case Define.E_MessageBoxIcon.Asterisk:
                    this.pictureBoxAsterisk.Visible = true;
                    this.pictureBoxExclamation.Visible = false;
                    this.pictureBoxHand.Visible = false;
                    this.pictureBoxQuestion.Visible = false;
                    break;
                default:
                    break;
            }

            this.smartGroupBox1.Text = code;
            this.labelMessage1.Text = message1;
            this.labelMessage2.Text = message2;
        }
        #endregion

        #region Property

        #endregion

        #region Method
        private void InitializeControl()
        {
            int x = 0, y = 0;

            x = Screen.PrimaryScreen.Bounds.Width / 2 - this.Size.Width / 2;
            y = Screen.PrimaryScreen.Bounds.Height / 2 - this.Size.Height / 2;

            this.Location = new Point(x, y);
            this.Size = new Size(452, 157);
        }
        #endregion

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

            this.InitializeControl();
        }
        #endregion

        #region Event Handler
        private void buttonYes_Click(object sender, EventArgs e)
        {
            this.Close();

            this.DialogResult = DialogResult.Yes;
        }

        private void buttonNo_Click(object sender, EventArgs e)
        {
            this.Close();

            this.DialogResult = DialogResult.No;
        }
        #endregion
    }
}