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 out 하시겠습니까?";
                        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 = "바코드 기능 사용을 중지하시겠습니까?";
                        break;
                    case 19:
                        this.smartGroupBox1.Text = "소거";
                        this.labelMessage1.Text = "전체 품번 카운트 데이터를 소거 하시겠습니까?";
                        break;
                    case 20:
                        this.smartGroupBox1.Text = "초기화";
                        this.labelMessage1.Text = "카운터출력 카운트 데이터를 소거 하시겠습니까?";
                        break;
                    case 21:
                        this.smartGroupBox1.Text = "이더넷";
                        this.labelMessage1.Text = "로컬IP주소 수동으로 설정하시겠습니까?";
                        break;
                    case 22:
                        this.smartGroupBox1.Text = "이더넷";
                        this.labelMessage1.Text = "로컬IP주소 자동으로 설정하시겠습니까?";
                        break;
                    case 23:
                        this.smartGroupBox1.Text = "백업";
                        this.labelMessage1.Text = "현재 데이터를 백업하시겠습니까?";
                        break;
                    case 24:
                        this.smartGroupBox1.Text = "랜덤모드 설정값 초기화";
                        this.labelMessage1.Text = "소수점을 변경하면 랜덤모드 설정값이 초기화됩니다.";
                        this.labelMessage2.Text = "소수점을 변경하시겠습니까?";
                        break;
                    case 25:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "기능을 사용하시겠습니까?";
                        this.labelMessage2.Text = "";
                        break;
                    case 26:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "기능 사용을 중지하시겠습니까?";
                        this.labelMessage2.Text = "관련 항목들이 초기화 상태로 변경됩니다.";
                        break;
                    case 27:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "해당 값을 기준값으로 설정하시겠습니까?";
                        this.labelMessage2.Text = "";
                        break;
                    case 28:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "파일을 삭제하시겠습니까?";
                        this.labelMessage2.Text = "";
                        break;
                    case 29:
                        this.smartGroupBox1.Text = "Login";
                        this.labelMessage1.Text = "비밀번호를 초기화 하시겠습니까?";
                        this.labelMessage2.Text = "";
                        break;
                    case 30:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "현재 장비 타입을 변경하시겠습니까?";
                        this.labelMessage2.Text = "재부팅이 필요합니다.";
                        break;
                    case 31:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "BLDC 모터 모드로 변경하기 위해";
                        this.labelMessage2.Text = "재부팅이 필요합니다.";
                        break;
                    case 32:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "초기화 하시겠습니까?";
                        this.labelMessage2.Text = "";
                        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 proceed with the 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 = "";
                        this.labelMessage1.Text = "Would you like to use that feature?";
                        break;
                    case 16:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "Would you like to stop using that function?";
                        break;
                    case 17:
                        this.smartGroupBox1.Text = "Barcode";
                        this.labelMessage1.Text = "Are you sure you want to use the Barcode function?";
                        break;
                    case 18:
                        this.smartGroupBox1.Text = "Barcode";
                        this.labelMessage1.Text = "Are you sure you want to cancel the Barcode function?";
                        break;
                    case 19:
                        this.smartGroupBox1.Text = "Initialization";
                        this.labelMessage1.Text = "Do you want to Initialize all data?";
                        break;
                    case 20:
                        this.smartGroupBox1.Text = "Initialization";
                        this.labelMessage1.Text = "Do you want to Initalize Counting Output's count data?";
                        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;
                    case 23:
                        this.smartGroupBox1.Text = "Backup";
                        this.labelMessage1.Text = "Would you like to back up your current data?";
                        break;
                    case 24:
                        this.smartGroupBox1.Text = "Initialize random mode setting";
                        this.labelMessage1.Text = "Changing the decimal point resets the random mode";
                        this.labelMessage2.Text = "settings. Do you want to change the decimal point?";
                        break;
                    case 25:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "Are you sure you want to use the function?";
                        this.labelMessage2.Text = "";
                        break;
                    case 26:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "Are you sure you want to cancel the function?";
                        this.labelMessage2.Text = "Related items will be changed to the initialization state.";
                        break;
                    case 27:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "Do you want to set that value as the 'Pass' value?";
                        this.labelMessage2.Text = "";
                        break;
                    case 28:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "Are you sure you want to delete the file?";
                        this.labelMessage2.Text = "";
                        break;
                    case 29:
                        this.smartGroupBox1.Text = "Login";
                        this.labelMessage1.Text = "Do you want to reset your password?";
                        this.labelMessage2.Text = "";
                        break;
                    case 30:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "Would you like to change the current equipment type?";
                        this.labelMessage2.Text = "A reboot is required.";
                        break;
                    case 31:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "A reboot is required to change to BLDC motor mode.";
                        this.labelMessage2.Text = "";
                        break;
                    case 32:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "Do you want to initialize?";
                        this.labelMessage2.Text = "";
                        break;
                    default:
                        break;
                }
                #endregion
            }
            else if (language == Define.E_LanguageID.Chinese)
            {
                this.buttonYes.ButtonText = "是";
                this.buttonNo.ButtonText = "否";

                #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 = "您确定登出吗？";
                        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 = "您确定中断使用条形码功能？";
                        break;
                    case 19:
                        this.smartGroupBox1.Text = "消除";
                        this.labelMessage1.Text = "您确定清除全部品目计数值吗？";
                        break;
                    case 20:
                        this.smartGroupBox1.Text = "初期化";
                        this.labelMessage1.Text = "计数输出 : 您要清除计数数据吗？";
                        break;
                    case 21:
                        this.smartGroupBox1.Text = "以太网";
                        this.labelMessage1.Text = "您要手动设置IP地址吗？";
                        break;
                    case 22:
                        this.smartGroupBox1.Text = "以太网";
                        this.labelMessage1.Text = "您要自动设置IP地址吗？";
                        break;
                    case 23:
                        this.smartGroupBox1.Text = "备份";
                        this.labelMessage1.Text = "您要备份当前数据吗？";
                        break;
                    case 24:
                        this.smartGroupBox1.Text = "随机模式初期化";
                        this.labelMessage1.Text = "更改小数点将重置随机模式设置。";
                        this.labelMessage2.Text = "您要更改小数点吗？";
                        break;
                    case 25:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "你确定要使用功能吗？";
                        this.labelMessage2.Text = "";
                        break;
                    case 26:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "您确定中断使用功能？";
                        this.labelMessage2.Text = "相关项目将更改为初始化状态。。";
                        break;
                    case 27:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "您想将该值设置为“通过”值吗？";
                        this.labelMessage2.Text = "";
                        break;
                    case 28:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "您确定要删除该文件吗？";
                        this.labelMessage2.Text = "";
                        break;
                    case 29:
                        this.smartGroupBox1.Text = "登录";
                        this.labelMessage1.Text = "您想重置密码吗？";
                        this.labelMessage2.Text = "";
                        break;
                    case 30:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "您想更改当前的设备类型吗？";
                        this.labelMessage2.Text = "需要重新启动。";
                        break;
                    case 31:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "需要重新启动才能更改为 BLDC 电机模式。";
                        this.labelMessage2.Text = "";
                        break;
                    case 32:
                        this.smartGroupBox1.Text = "";
                        this.labelMessage1.Text = "您想要初始化吗？";
                        this.labelMessage2.Text = "";
                        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 1:
                            this.smartGroupBox1.Text = "파일";
                            this.labelMessage1.Text = string.Format("{0} 파일이 이미 있습니다. 바꾸시겠습니까?", msg);
                            break;
                        case 2:
                            this.smartGroupBox1.Text = "비밀번호 만료";
                            if (int.Parse(msg) == 0)
                                this.labelMessage1.Text = "비밀번호 만료일입니다.";
                            else
                                this.labelMessage1.Text = string.Format("비밀번호 만료 {0}일 전입니다.", msg);
                            this.labelMessage2.Text = "비밀번호를 변경하시겠습니까?";
                            break;
                        default:
                            break;
                    }
                    break;
                case Define.E_LanguageID.English:
                    switch (ok)
                    {
                        case 1:
                            this.smartGroupBox1.Text = "File";
                            this.labelMessage1.Text = string.Format("{0} already exists. Do you change the file?", msg);
                            break;
                        case 2:
                            this.smartGroupBox1.Text = "Password expiration";
                            if (int.Parse(msg) == 0)
                                this.labelMessage1.Text = "Today is the password expiration date.";
                            else
                                this.labelMessage1.Text = string.Format("{0} days before password expires", msg);
                            this.labelMessage2.Text = "Do you want to change the password?";
                            break;
                        default:
                            break;
                    }
                    break;
                case Define.E_LanguageID.Chinese:
                    switch (ok)
                    {
                        case 1:
                            this.smartGroupBox1.Text = "文件";
                            this.labelMessage1.Text = string.Format("{0} 已经存在。 你改文件了吗？", msg);
                            break;
                        case 2:
                            this.smartGroupBox1.Text = "密码过期";
                            if (int.Parse(msg) == 0)
                                this.labelMessage1.Text = "今天是密码过期日期.";
                            else
                                this.labelMessage1.Text = string.Format("密码过期前{0}天", msg);
                            this.labelMessage2.Text = "您要更改密码吗？";
                            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;
                case Define.E_LanguageID.Chinese:
                    switch (ok)
                    {
                        case 3:
                            this.smartGroupBox1.Text = "更新";
                            this.labelMessage1.Text = string.Format("前 : {0}, 后 : {1}", before, after);
                            this.labelMessage2.Text = "您要运行更新吗？";
                            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
    }
}