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;

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

        #endregion

        #region Constructor
        public DialogFormYesNo(DataStore.LanguageID language, int ok)
        {
            InitializeComponent();

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

            if (language == DataStore.LanguageID.Korean)
            {
                #region 한글
                switch (ok)
                {
                    case 1:
                        this.labelErrorCode.Text = "";
                        this.labelMessage1.Text = "예전 DLL로 되돌리시겠습니까?";
                        break;
                    case 2:
                        this.labelErrorCode.Text = "";
                        this.labelMessage1.Text = "언어를 변경하시겠습니까?";
                        break;
                    case 3:
                        this.labelErrorCode.Text = "업데이트";
                        this.labelMessage1.Text = "새 버전으로 업데이트됩니다.";
                        break;
                    case 4:
                        break;
                    case 5:
                        this.labelErrorCode.Text = "공장초기화";
                        this.labelMessage1.Text = "설정된 모든 데이터가 초기화됩니다.";
                        break;
                    case 6:
                        break;
                    case 7:
                        break;
                    case 8:
                        this.labelErrorCode.Text = "소거";
                        this.labelMessage1.Text = "카운트 값을 소거 하시겠습니까?";
                        break;
                    case 9:
                        this.labelErrorCode.Text = "모터 다운로드";
                        this.labelMessage1.Text = "현재 값을 다운로드 하시겠습니까?";
                        break;
                    case 10:
                        this.labelErrorCode.Text = "모터 다운로드";
                        this.labelMessage1.Text = "새 모터에 다운로드 하시겠습니까?";
                        break;
                    case 11:
                        this.labelErrorCode.Text = "모터 다운로드";
                        this.labelMessage1.Text = "모터에 프로그램을 다운로드 하시겠습니까?";
                        break;
                    case 12:
                        this.labelErrorCode.Text = "로그인";
                        this.labelMessage1.Text = "Log out 하시겠습니까?";
                        break;
                    case 13:
                        this.labelErrorCode.Text = "로그인";
                        this.labelMessage1.Text = "유저 등록 하시겠습니까?";
                        break;
                    case 14:
                        this.labelErrorCode.Text = "로그인";
                        this.labelMessage1.Text = "유저 삭제 하시겠습니까?";
                        break;
                    case 15:
                        this.labelErrorCode.Text = "이더넷";
                        this.labelMessage1.Text = "로컬IP주소 수동으로 설정하시겠습니까?";
                        break;
                    case 16:
                        this.labelErrorCode.Text = "이더넷";
                        this.labelMessage1.Text = "로컬IP주소 자동으로 설정하시겠습니까?";
                        break;
                    case 17:
                        this.labelErrorCode.Text = "로그인";
                        this.labelMessage1.Text = "비밀번호를 초기화 하시겠습니까?";
                        break;
                    default:
                        break;
                }
                #endregion
            }
            else if (language == DataStore.LanguageID.English)
            {
                #region 영문
                switch (ok)
                {
                    case 1:
                        this.labelErrorCode.Text = "";
                        this.labelMessage1.Text = "Do you want to revert to the previous DLL?";
                        break;
                    case 2:
                        this.labelErrorCode.Text = "";
                        this.labelMessage1.Text = "Do you change the language?";
                        break;
                    case 3:
                        this.labelErrorCode.Text = "Update";
                        this.labelMessage1.Text = "Now appilcation program update";
                        break;
                    case 4:
                        break;
                    case 5:
                        this.labelErrorCode.Text = "Initialization";
                        this.labelMessage1.Text = "All datas will be initialized";
                        break;
                    case 6:
                        break;
                    case 7:
                        break;
                    case 8:
                        this.labelErrorCode.Text = "Clear";
                        this.labelMessage1.Text = "Erase all count?";
                        break;
                    case 9:
                        this.labelErrorCode.Text = "Motor download";
                        this.labelMessage1.Text = "Do you want to download the current value?";
                        break;
                    case 10:
                        this.labelErrorCode.Text = "Motor download";
                        this.labelMessage1.Text = "Do you want to download the new motor?";
                        break;
                    case 11:
                        this.labelErrorCode.Text = "Motor download";
                        this.labelMessage1.Text = "Do you want to change";
                        this.labelMessage2.Text = "with the device number to current line?";
                        break;
                    case 12:
                        this.labelErrorCode.Text = "Login";
                        this.labelMessage1.Text = "Do you want to log out?";
                        break;
                    case 13:
                        this.labelErrorCode.Text = "Login";
                        this.labelMessage1.Text = "Do you want to register the user?";
                        break;
                    case 14:
                        this.labelErrorCode.Text = "Login";
                        this.labelMessage1.Text = "Do you want to Delete the user?";
                        break;
                    case 15:
                        this.labelErrorCode.Text = "Ethernet";
                        this.labelMessage1.Text = "Do you want to set the local IP address static?";
                        break;
                    case 16:
                        this.labelErrorCode.Text = "Ethernet";
                        this.labelMessage1.Text = "Do you want to set the local IP address to DHCP?";
                        break;
                    case 17:
                        this.labelErrorCode.Text = "Login";
                        this.labelMessage1.Text = "Do you want to reset your password?";
                        break;
                    default:
                        break;
                }
                #endregion
            }
            else if (language == DataStore.LanguageID.Chinese)
            {
                this.buttonYes.Text = "是";
                this.buttonNo.Text = "否";

                #region 중문
                switch (ok)
                {
                    case 1:
                        this.labelErrorCode.Text = "";
                        this.labelMessage1.Text = "你想转变到之前的DLL吗";
                        break;
                    case 2:
                        this.labelErrorCode.Text = "";
                        this.labelMessage1.Text = "想更换语言吗？";
                        break;
                    case 3:
                        this.labelErrorCode.Text = "更新";
                        this.labelMessage1.Text = "现在应用程序更新";
                        break;
                    case 4:
                        break;
                    case 5:
                        this.labelErrorCode.Text = "回复出厂设置";
                        this.labelMessage1.Text = "所有数据初始化";
                        break;
                    case 6:
                        this.labelErrorCode.Text = "LCD初始化";
                        this.labelMessage1.Text = "所有LCD数据初始化";
                        break;
                    case 7:
                        this.labelErrorCode.Text = "主板初始化";
                        this.labelMessage1.Text = "所有主板数据初始化";
                        break;
                    case 8:
                        this.labelErrorCode.Text = "消除";
                        this.labelMessage1.Text = "您确定清除计数值吗？";
                        break;
                    case 9:
                        this.labelErrorCode.Text = "下载";
                        this.labelMessage1.Text = "您确定下载当前值吗？";
                        break;
                    case 10:
                        break;
                    case 11:
                        this.labelErrorCode.Text = "下载";
                        this.labelMessage1.Text = "你想下载程序吗？";
                        break;
                    case 12:
                        this.labelErrorCode.Text = "登录";
                        this.labelMessage1.Text = "你想注销吗？";
                        break;
                    case 13:
                        this.labelErrorCode.Text = "登录";
                        this.labelMessage1.Text = "你想注册用户吗？";
                        break;
                    case 14:
                        this.labelErrorCode.Text = "登录";
                        this.labelMessage1.Text = "要删除用户吗？";
                        break;
                    case 15:
                        this.labelErrorCode.Text = "以太网";
                        this.labelMessage1.Text = "是否要将本地 IP 地址设置为静态？";
                        break;
                    case 16:
                        this.labelErrorCode.Text = "以太网";
                        this.labelMessage1.Text = "是否要将本地 IP 地址设置为 DHCP？";
                        break;
                    case 17:
                        this.labelErrorCode.Text = "登录";
                        this.labelMessage1.Text = "您想重置密码吗？";
                        break;
                    default:
                        break;
                }
                #endregion
            }
            else if (language == DataStore.LanguageID.Japanese)
            {
                #region 일본어
                switch (ok)
                {
                    case 1:
                        this.labelErrorCode.Text = "";
                        this.labelMessage1.Text = "古いDLLに戻りますか？";
                        break;
                    case 2:
                        this.labelErrorCode.Text = "";
                        this.labelMessage1.Text = "言語を変更しますか？";
                        break;
                    case 3:
                        this.labelErrorCode.Text = "更新";
                        this.labelMessage1.Text = "アップデㅡトを続行しますか？";
                        break;
                    case 4:
                        break;
                    case 5:
                        this.labelErrorCode.Text = "初期化";
                        this.labelMessage1.Text = "設定されたすべてのデㅡタが初期化されます。";
                        break;
                    case 6:
                        break;
                    case 7:
                        break;
                    case 8:
                        this.labelErrorCode.Text = "クリア";
                        this.labelMessage1.Text = "数量値を消去しますか？";
                        break;
                    case 9:
                        this.labelErrorCode.Text = "モㅡタㅡダウンロㅡド";
                        this.labelMessage1.Text = "現在の値をダウンロㅡドしますか？";
                        break;
                    case 10:
                        this.labelErrorCode.Text = "モㅡタㅡダウンロㅡド";
                        this.labelMessage1.Text = "新しいモㅡタㅡにダウンロㅡドしますか？";
                        break;
                    case 11:
                        this.labelErrorCode.Text = "モㅡタㅡダウンロㅡド";
                        this.labelMessage1.Text = "モㅡタㅡにダウンロㅡドしますか？";
                        break;
                    case 12:
                        this.labelErrorCode.Text = "ログイン";
                        this.labelMessage1.Text = "ログアウトしますか？";
                        break;
                    case 13:
                        this.labelErrorCode.Text = "ログイン";
                        this.labelMessage1.Text = "ユㅡザㅡ登録しますか？";
                        break;
                    case 14:
                        this.labelErrorCode.Text = "ログイン";
                        this.labelMessage1.Text = "ユㅡザㅡを削除しますか？";
                        break;
                    case 15:
                        this.labelErrorCode.Text = "イㅡサネット";
                        this.labelMessage1.Text = "ロㅡカルIPアドレスを手動で設定しますか？";
                        break;
                    case 16:
                        this.labelErrorCode.Text = "イㅡサネット";
                        this.labelMessage1.Text = "ロㅡカルIPアドレスを自動的に設定しますか？";
                        break;
                    case 17:
                        this.labelErrorCode.Text = "ログイン";
                        this.labelMessage1.Text = "パスワㅡドを初期化しますか？";
                        break;
                    default:
                        break;
                }
                #endregion
            }
            else if (language == DataStore.LanguageID.Czech)
            {
                #region 체코어
                switch (ok)
                {
                    case 1:
                        this.labelErrorCode.Text = "";
                        this.labelMessage1.Text = "Chcete se vrátit k předchozí DLL?";
                        break;
                    case 2:
                        this.labelErrorCode.Text = "";
                        this.labelMessage1.Text = "Chcete změnit jazyk?";
                        break;
                    case 3:
                        this.labelErrorCode.Text = "Aktualizace";
                        this.labelMessage1.Text = "Program byl aktualizován";
                        break;
                    case 4:
                        break;
                    case 5:
                        this.labelErrorCode.Text = "Tovární nastavení";
                        this.labelMessage1.Text = "Budou inicializována všechna data";
                        break;
                    case 6:
                        break;
                    case 7:
                        break;
                    case 8:
                        this.labelErrorCode.Text = "Smazat";
                        this.labelMessage1.Text = "Smazat všechny počty?";
                        break;
                    case 9:
                        this.labelErrorCode.Text = "Stažení";
                        this.labelMessage1.Text = "Chcete stáhnout aktuální hodnotu?";
                        break;
                    case 10:
                        this.labelErrorCode.Text = "Stažení";
                        this.labelMessage1.Text = "Chcete stáhnout nový motor?";
                        break;
                    case 11:
                        this.labelErrorCode.Text = "Stažení";
                        this.labelMessage1.Text = "Chcete provést změnu na aktuální počet zařízení  linky?";
                        break;
                    case 12:
                        this.labelErrorCode.Text = "Přihlásit se";
                        this.labelMessage1.Text = "Chcete se odhlásit?";
                        break;
                    case 13:
                        this.labelErrorCode.Text = "Přihlásit se";
                        this.labelMessage1.Text = "Chcete zaregistrovat uživatele?";
                        break;
                    case 14:
                        this.labelErrorCode.Text = "Přihlásit se";
                        this.labelMessage1.Text = "Chcete smazat uživatele?";
                        break;
                    case 15:
                        this.labelErrorCode.Text = "Ethernet";
                        this.labelMessage1.Text = "Do you want to set the local IP address static?";
                        break;
                    case 16:
                        this.labelErrorCode.Text = "Ethernet";
                        this.labelMessage1.Text = "Do you want to set the local IP address to DHCP?";
                        break;
                    case 17:
                        this.labelErrorCode.Text = "Přihlásit se";
                        this.labelMessage1.Text = "Chcete obnovit své heslo?";
                        break;
                    default:
                        break;
                }
                #endregion
            }
            else
            { 
            }
        }
        public DialogFormYesNo(DataStore.LanguageID language, int ok, string msg)
        {
            InitializeComponent();

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

            switch (language)
            {
                case DataStore.LanguageID.Korean:
                    switch (ok)
                    {
                        case 2:
                            this.labelErrorCode.Text = "비밀번호 만료";
                            if (int.Parse(msg) == 0)
                                this.labelMessage1.Text = "비밀번호 만료일입니다.";
                            else
                                this.labelMessage1.Text = string.Format("비밀번호 만료 {0}일 전입니다.", msg);
                            this.labelMessage2.Text = "비밀번호를 변경하시겠습니까?";
                            break;
                        case 31:
                            this.labelErrorCode.Text = "파일";
                            this.labelMessage1.Text = string.Format("{0} 파일이 이미 있습니다. 바꾸시겠습니까?", msg);
                            break;
                        default:
                            break;
                    }
                    break;
                case DataStore.LanguageID.English:
                    switch (ok)
                    {
                        case 2:
                            this.labelErrorCode.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;
                        case 31:
                            this.labelErrorCode.Text = "File";
                            this.labelMessage1.Text = string.Format("{0} already exists. Do you change the file?", msg);
                            break;
                        default:
                            break;
                    }
                    break;
                    break;
                case DataStore.LanguageID.Chinese:
                    switch (ok)
                    {
                        case 2:
                            this.labelErrorCode.Text = "密码过期";
                            if (int.Parse(msg) == 0)
                                this.labelMessage1.Text = "今天是密码过期日期.";
                            else
                                this.labelMessage1.Text = string.Format("密码过期前{0}天", msg);
                            this.labelMessage2.Text = "您要更改密码吗？";
                            break;
                        case 31:
                            this.labelErrorCode.Text = "文件";
                            this.labelMessage1.Text = string.Format("{0} 已经存在。 你改文件了吗？", msg);
                            break;
                        default:
                            break;
                    }
                    break;
                case DataStore.LanguageID.Japanese:
                    switch (ok)
                    {
                        case 2:
                            this.labelErrorCode.Text = "パスワㅡドの有効期限";
                            if (int.Parse(msg) == 0)
                                this.labelMessage1.Text = "パスワㅡドの有効期限です";
                            else
                                this.labelMessage1.Text = string.Format("パスワㅡドの有効期限{0}日前です", msg);
                            this.labelMessage2.Text = "パスワㅡドを変更しますか？";
                            break;
                        case 31:
                            this.labelErrorCode.Text = "ファイル";
                            this.labelMessage1.Text = string.Format("ファイル {0} は既に存在します。交換してもよろしいですか？", msg);
                            break;
                        default:
                            break;
                    }
                    break;
                case DataStore.LanguageID.Czech:
                    break;
                case DataStore.LanguageID.German:
                    break;
                default:
                    break;
            }
        }
        public DialogFormYesNo(DataStore.MessageBoxIcon icon, string code, string message1, string message2)
        {
            InitializeComponent();

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

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

        #region Property

        #endregion

        #region Method
        private void InitializeContnrol()
        {
            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(450, 170);
        }
        #endregion

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

            this.InitializeContnrol();
        }
        #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
    }
}