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 INT63DC_2C.DialogForms
{
    public partial class DialogFormYesNo : Form
    {
        #region Field

        #endregion

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

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

            switch (language)
            {
                case DataStore.E_LanguageID.Korean:
                    #region Korean
                    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:
                            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
                    break;
                case DataStore.E_LanguageID.English:
                    #region English
                    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:
                            break;
                        case 11:
                            this.labelErrorCode.Text = "Motor download";
                            this.labelMessage1.Text = "Do you want to download the program?";
                            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
                    break;
                case DataStore.E_LanguageID.Chinese:
                    #region Chinese
                    this.buttonYes.Text = "是";
                    this.buttonNo.Text = "否";

                    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:
                            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
                    break;
                case DataStore.E_LanguageID.Czech:
                    #region Czech
                    this.buttonYes.Text = "Ano";
                    this.buttonNo.Text = "Ne";

                    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:
                            break;
                        case 11:
                            this.labelErrorCode.Text = "Stažení";
                            this.labelMessage1.Text = "Chcete program stáhnout na motor?";
                            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 = "Chcete nastavit lokální IP adresu statickou?";
                            break;
                        case 16:
                            this.labelErrorCode.Text = "Ethernet";
                            this.labelMessage1.Text = "Chcete nastavit lokální IP adresu na DHCP?";
                            break;
                        case 17:
                            this.labelErrorCode.Text = "Přihlásit se";
                            this.labelMessage1.Text = "Chcete obnovit své heslo?";
                            break;
                        default:
                            break;
                    }
                    #endregion
                    break;
                case DataStore.E_LanguageID.German:
                    #region German
                    switch (ok)
                    {
                        case 1:
                            this.labelErrorCode.Text = "";
                            this.labelMessage1.Text = "Möchten Sie die ursprüngliche";
                            this.labelMessage2.Text = "DDL-Bibliothek wirklich zurückgeben?";
                            break;
                        case 2:
                            this.labelErrorCode.Text = "";
                            this.labelMessage1.Text = "Möchten Sie die Sprache wirklich ändern?";
                            break;
                        case 3:
                            this.labelErrorCode.Text = "Aktualisierung";
                            this.labelMessage1.Text = "Programm wird aktualisiert";
                            break;
                        case 4:
                            break;
                        case 5:
                            this.labelErrorCode.Text = "Werkseinstellung";
                            this.labelMessage1.Text = "Alle Daten werden initialisiert";
                            break;
                        case 6:
                            break;
                        case 7:
                            break;
                        case 8:
                            this.labelErrorCode.Text = "Löschen";
                            this.labelMessage1.Text = "Wirklich die Zähler löschen? ";
                            break;
                        case 9:
                            this.labelErrorCode.Text = "Programm-Download zum Motor";
                            this.labelMessage1.Text = "Möchten Sie den aktuellen";
                            this.labelMessage2.Text = "Wert wirklich herunterladen?";
                            break;
                        case 10:
                            break;
                        case 11:
                            this.labelErrorCode.Text = "Programm-Download zum Motor";
                            this.labelMessage1.Text = "Möchten Sie wirklich einen Motor herunterladen?";
                            break;
                        case 12:
                            this.labelErrorCode.Text = "Einloggen";
                            this.labelMessage1.Text = "Möchten Sie sich abmelden?";
                            break;
                        case 13:
                            this.labelErrorCode.Text = "Einloggen";
                            this.labelMessage1.Text = "Möchten Sie den Benutzer registrieren?";
                            break;
                        case 14:
                            this.labelErrorCode.Text = "Einloggen";
                            this.labelMessage1.Text = "Möchten Sie einen Benutzer löschen?";
                            break;
                        case 15:
                            this.labelErrorCode.Text = "Ethernet";
                            this.labelMessage1.Text = "Möchten Sie die lokale IP-Adresse statisch festlegen?";
                            break;
                        case 16:
                            this.labelErrorCode.Text = "Ethernet";
                            this.labelMessage1.Text = "Möchten Sie die lokale IP-Adresse auf DHCP einstellen?";
                            break;
                        case 17:
                            this.labelErrorCode.Text = "Einloggen";
                            this.labelMessage1.Text = "Möchten Sie Ihr Passwort zurücksetzen?";
                            break;
                        default:
                            break;
                    }
                    #endregion
                    break;
                case DataStore.E_LanguageID.Japanese:
                    #region Japanese
                    this.buttonYes.Text = "はい";
                    this.buttonNo.Text = "いいえ";

                    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:
                            break;
                        case 10:
                            break;
                        case 11:
                            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
                    break;
                default:
                    break;
            }
        }
        public DialogFormYesNo(DataStore.E_LanguageID language, int ok, string msg)
        {
            InitializeComponent();

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

            switch (language)
            {
                case DataStore.E_LanguageID.Korean:
                    #region 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;
                    } 
                    #endregion
                    break;
                case DataStore.E_LanguageID.English:
                    #region English
                    switch (ok)
                    {
                        case 2:
                            this.labelErrorCode.Text = "Login";
                            if (int.Parse(msg) == 0)
                                this.labelMessage1.Text = "Your password has expired.";
                            else
                                this.labelMessage1.Text = string.Format("Your password expires {0} days ago.", msg);
                            this.labelMessage2.Text = "Do you want to change your 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;
                    } 
                    #endregion
                    break;
                case DataStore.E_LanguageID.Chinese:
                    #region Chinese
                    this.buttonYes.Text = "是";
                    this.buttonNo.Text = "否";

                    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;
                    } 
                    #endregion
                    break;
                case DataStore.E_LanguageID.Czech:
                    #region Czech
                    switch (ok)
                    {
                        case 2:
                            this.labelErrorCode.Text = "Přihlášení";
                            if (int.Parse(msg) == 0)
                                this.labelMessage1.Text = "Platnost vašeho hesla vypršela.";
                            else
                                this.labelMessage1.Text = string.Format("{0} dní před vypršením platnosti hesla.", msg);
                            this.labelMessage2.Text = "Chcete změnit heslo?";
                            break;
                        case 31:
                            this.labelErrorCode.Text = "soubor";
                            this.labelMessage1.Text = string.Format("{0} již existuje. Chcete soubor změnit?", msg);
                            break;
                        default:
                            break;
                    }
                    #endregion
                    break;
                case DataStore.E_LanguageID.German:
                    #region German
                    switch (ok)
                    {
                        case 2:
                            this.labelErrorCode.Text = "Login";
                            if (int.Parse(msg) == 0)
                                this.labelMessage1.Text = "Ihr Passwort ist abgelaufen.";
                            else
                                this.labelMessage1.Text = string.Format("{0} days before password expiration.", msg);
                            this.labelMessage2.Text = "Möchten Sie Ihr Passwort ändern?";
                            break;
                        case 31:
                            this.labelErrorCode.Text = "Datei";
                            this.labelMessage1.Text = string.Format("{0} existiert bereits. Ändern Sie die Datei?", msg);
                            break;
                        default:
                            break;
                    }
                    #endregion
                    break;
                case DataStore.E_LanguageID.Japanese:
                    #region 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;
                    }
                    #endregion
                    break;
                default:
                    break;
            }
        }
        public DialogFormYesNo(DataStore.MessageBoxIcon icon, string code, string message1, string message2, DataStore.E_LanguageID language)
        {
            InitializeComponent();

            this.pictureBoxAsterisk.Visible = false;
            this.pictureBoxExclamation.Visible = false;
            this.pictureBoxHand.Visible = false;
            this.pictureBoxQuestion.Visible = false;

            switch (language)
            {
                case DataStore.E_LanguageID.Chinese:
                    this.buttonYes.Text = "是";
                    this.buttonNo.Text = "否";
                    break;
                default:
                    this.buttonYes.Text = "Yes";
                    this.buttonNo.Text = "No";
                    break;
            }

            switch (icon)
            {
                case DataStore.MessageBoxIcon.Hand:
                    this.pictureBoxHand.Visible = true;
                    this.pictureBoxHand.BringToFront();
                    break;
                case DataStore.MessageBoxIcon.Question:
                    this.pictureBoxQuestion.Visible = true;
                    this.pictureBoxQuestion.BringToFront();
                    break;
                case DataStore.MessageBoxIcon.Exclamation:
                    this.pictureBoxExclamation.Visible = true;
                    this.pictureBoxExclamation.BringToFront();
                    break;
                case DataStore.MessageBoxIcon.Asterisk:
                    this.pictureBoxAsterisk.Visible = true;
                    this.pictureBoxAsterisk.BringToFront();
                    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);
        }
        #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
    }
}