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

        #endregion

        #region Constructor
        public DialogFormMessage()
        {
            InitializeComponent();
        }
        public DialogFormMessage(string str, DataStore.LanguageID language)
        {
            InitializeComponent();

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

            if (language == DataStore.LanguageID.Korean)
            {
                this.labelErrorCode.Text = "Notice";
                this.labelMessage1.Text = str + "개의 파일이 백업되었습니다.";
            }
            else if (language == DataStore.LanguageID.English)
            {
                this.labelErrorCode.Text = "Notice";
                this.labelMessage1.Text = str + " files are backed up";
            }
            else if (language == DataStore.LanguageID.Chinese)
            {

            }
            else if (language == DataStore.LanguageID.Czech)
            {

            }
            else
            {

            }
        }
        public DialogFormMessage(int code, DataStore.LanguageID language)
        {
            InitializeComponent();

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

            if (language == DataStore.LanguageID.Korean)
            {
                #region 한글
                switch (code)
                {
                    case 1:
                        this.labelErrorCode.Text = "Error 01";
                        this.labelMessage1.Text = "입력범위를 확인하세요.";
                        this.labelMessage2.Text = "";
                        break;
                    case 2:
                        this.labelErrorCode.Text = "Error 02";
                        this.labelMessage1.Text = "최신 프로그램입니다.";
                        this.labelMessage2.Text = "";
                        break;
                    case 3:
                        this.labelErrorCode.Text = "Error 03";
                        this.labelMessage1.Text = "연속으로 불량이 발생했습니다";
                        this.labelMessage2.Text = "";
                        break;
                    case 4:
                        this.labelErrorCode.Text = "Error 04";
                        this.labelMessage1.Text = "백업할 파일이 없습니다";
                        this.labelMessage2.Text = "";
                        break;
                    case 5:
                        this.labelErrorCode.Text = "Error 05";
                        this.labelMessage1.Text = "USB메모리가 장착되지 않았습니다";
                        this.labelMessage2.Text = "";
                        break;
                    case 6:
                        this.labelErrorCode.Text = "Error 06";
                        this.labelMessage1.Text = "제조사에 문의하세요";
                        this.labelMessage2.Text = "";
                        break;
                    case 7:
                        this.labelErrorCode.Text = "Error 07";
                        this.labelMessage1.Text = "USB에 업데이트 할 파일이 없습니다";
                        this.labelMessage2.Text = "";
                        break;
                    case 8:
                        this.labelErrorCode.Text = "Error 08";
                        this.labelMessage1.Text = "업데이트 할 실행파일 개수가 많습니다";
                        this.labelMessage2.Text = "";
                        break;
                    case 9:
                        this.labelErrorCode.Text = "Error 09";
                        this.labelMessage1.Text = "USB에 업데이트 폴더가 없습니다";
                        this.labelMessage2.Text = "";
                        break;
                    case 10:
                        this.labelErrorCode.Text = "Error 10";
                        this.labelMessage1.Text = "해당 메모리가 장착되지 않았습니다";
                        this.labelMessage2.Text = "";
                        break;
                    case 11:
                        this.labelErrorCode.Text = "Error 11";
                        this.labelMessage1.Text = "이미지 폴더가 없습니다";
                        this.labelMessage2.Text = "";
                        break;
                    case 12:
                        this.labelErrorCode.Text = "Error 12";
                        this.labelMessage1.Text = "적체박스를 비워 주세요.";
                        this.labelMessage2.Text = "";
                        break;
                    case 13:
                        this.labelErrorCode.Text = "시스템 백업";
                        this.labelMessage1.Text = "백업 완료";
                        this.labelMessage2.Text = "";
                        break;
                    case 14:
                        this.labelErrorCode.Text = "시스템 백업";
                        this.labelMessage1.Text = "백업 실패 !!";
                        this.labelMessage2.Text = "";
                        break;
                    case 15:
                        this.labelErrorCode.Text = "Error 15";
                        this.labelMessage1.Text = "가져올 파일이 없습니다";
                        this.labelMessage2.Text = "";
                        break;
                    case 16:
                        this.labelErrorCode.Text = "Error 16";
                        this.labelMessage1.Text = "에러 발생! 다시 시도해주세요";
                        this.labelMessage2.Text = "";
                        break;
                    case 17:
                        this.labelErrorCode.Text = "Error 17";
                        this.labelMessage1.Text = "초기화를 실행해 주세요";
                        this.labelMessage2.Text = "";
                        break;
                    case 18:
                        this.labelErrorCode.Text = "Error 18";
                        this.labelMessage1.Text = "전원을 끄고 다시 켜주세요";
                        this.labelMessage2.Text = "";
                        break;
                    case 19:
                        this.labelErrorCode.Text = "Error 19";
                        this.labelMessage1.Text = "COM2 통신 포트 연결 에러.";
                        this.labelMessage1.Text = "제조사에 문의하세요.";
                        break;
                    case 20:
                        this.labelErrorCode.Text = "Error 20";
                        this.labelMessage1.Text = "MASCA 통신 전송이 실패했습니다";
                        this.labelMessage2.Text = "";
                        break;
                    case 21:
                        this.labelErrorCode.Text = "Error 21";
                        this.labelMessage1.Text = "서보 오프 후에 다시 시도해주세요";
                        this.labelMessage2.Text = "";
                        break;
                    case 22:
                        this.labelErrorCode.Text = "Error 22";
                        this.labelMessage1.Text = "메인보드 통신 상태 확인해주세요";
                        this.labelMessage2.Text = "";
                        break;
                    case 23:
                        this.labelErrorCode.Text = "Error 23";
                        this.labelMessage1.Text = "COM1 통신 상태 확인해주세요";
                        this.labelMessage2.Text = "";
                        break;
                    default:
                        this.labelErrorCode.Text = "Error 99";
                        this.labelMessage1.Text = "제조사에 문의하세요";
                        this.labelMessage2.Text = "";
                        break;
                }
                #endregion
            }
            else if (language == DataStore.LanguageID.English)
            {
                #region 영문
                switch (code)
                {
                    case 1:
                        this.labelErrorCode.Text = "Error 01";
                        this.labelMessage1.Text = "Confirm input range";
                        this.labelMessage2.Text = "";
                        break;
                    case 2:
                        this.labelErrorCode.Text = "Error 02";
                        this.labelMessage1.Text = "Application is the lastest";
                        this.labelMessage2.Text = "";
                        break;
                    case 3:
                        this.labelErrorCode.Text = "Error 03";
                        this.labelMessage1.Text = "Detect Continuous N.G !!";
                        this.labelMessage2.Text = "";
                        break;
                    case 4:
                        this.labelErrorCode.Text = "Error 04";
                        this.labelMessage1.Text = "There are no Backup files";
                        this.labelMessage2.Text = "";
                        break;
                    case 5:
                        this.labelErrorCode.Text = "Error 05";
                        this.labelMessage1.Text = "No USB Memory";
                        this.labelMessage2.Text = "";
                        break;
                    case 6:
                        this.labelErrorCode.Text = "Error 06";
                        this.labelMessage1.Text = "Please contact a manufacturer";
                        this.labelMessage2.Text = "";
                        break;
                    case 7:
                        this.labelErrorCode.Text = "Error 07";
                        this.labelMessage1.Text = "There are no update files in USB";
                        this.labelMessage2.Text = "";
                        break;
                    case 8:
                        this.labelErrorCode.Text = "Error 08";
                        this.labelMessage1.Text = "Too much file for update";
                        this.labelMessage2.Text = "";
                        break;
                    case 9:
                        this.labelErrorCode.Text = "Error 09";
                        this.labelMessage1.Text = "There is no folder has update files in USB";
                        this.labelMessage2.Text = "";
                        break;
                    case 10:
                        this.labelErrorCode.Text = "Error 10";
                        this.labelMessage1.Text = "There is no MEMORY";
                        this.labelMessage2.Text = "";
                        break;
                    case 11:
                        this.labelErrorCode.Text = "Error 11";
                        this.labelMessage1.Text = "There is no folder has Image in USB";
                        this.labelMessage2.Text = "";
                        break;
                    case 12:
                        this.labelErrorCode.Text = "Error 12";
                        this.labelMessage1.Text = "Please load the box blank";
                        this.labelMessage2.Text = "";
                        break;
                    case 13:
                        this.labelErrorCode.Text = "System backup";
                        this.labelMessage1.Text = "Backup Complete";
                        this.labelMessage2.Text = "";
                        break;
                    case 14:
                        this.labelErrorCode.Text = "System backup";
                        this.labelMessage1.Text = "Backup Fail !!";
                        this.labelMessage2.Text = "";
                        break;
                    case 15:
                        this.labelErrorCode.Text = "Error 15";
                        this.labelMessage1.Text = "There are no files to be imported";
                        this.labelMessage2.Text = "";
                        break;
                    case 16:
                        this.labelErrorCode.Text = "Error 16";
                        this.labelMessage1.Text = "Error occured! Try again";
                        this.labelMessage2.Text = "";
                        break;
                    case 17:
                        this.labelErrorCode.Text = "Error 17";
                        this.labelMessage1.Text = "Please run the initialization";
                        this.labelMessage2.Text = "";
                        break;
                    case 18:
                        this.labelErrorCode.Text = "Error 18";
                        this.labelMessage1.Text = "Turn OFF the power and then turn ON the power.";
                        this.labelMessage2.Text = "";
                        break;
                    case 19:
                        this.labelErrorCode.Text = "Error 19";
                        this.labelMessage1.Text = "COM2 port problem.";
                        this.labelMessage1.Text = "Please contact a manufacturer.";
                        break;
                    case 20:
                        this.labelErrorCode.Text = "Error 20";
                        this.labelMessage1.Text = "Transmission failed to MASCA";
                        this.labelMessage2.Text = "";
                        break;
                    case 21:
                        this.labelErrorCode.Text = "Error 21";
                        this.labelMessage1.Text = "After th servo-off,";
                        this.labelMessage2.Text = "please try again.";
                        break;
                    case 22:
                        this.labelErrorCode.Text = "Error 22";
                        this.labelMessage1.Text = "Please check the communication status ";
                        this.labelMessage2.Text = "with the main board.";
                        break;
                    case 23:
                        this.labelErrorCode.Text = "Error 23";
                        this.labelMessage1.Text = "COM1 port problem.";
                        this.labelMessage2.Text = "";
                        break;
                    default:
                        this.labelErrorCode.Text = "Error 99";
                        this.labelMessage1.Text = "Please contact a manufacturer";
                        break;
                }
                #endregion
            }
            else if (language == DataStore.LanguageID.Chinese)
            {

            }
            else if (language == DataStore.LanguageID.Czech)
            {

            }
            else
            {

            }
        }
        public DialogFormMessage(int code, DataStore.LanguageID language, string message)
        {
            InitializeComponent();

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

            switch (language)
            {
                case DataStore.LanguageID.Korean:
                    #region Korean
                    switch (code)
                    {
                        case 1:
                            this.labelErrorCode.Text = "Error 01";
                            this.labelMessage1.Text = "입력범위를 확인하세요.";
                            this.labelMessage2.Text = message;
                            break;
                        default:
                            break;
                    } 
                    #endregion
                    break;
                case DataStore.LanguageID.English:
                    #region English
                    switch (code)
                    {
                        case 1:
                            this.labelErrorCode.Text = "Error 01";
                            this.labelMessage1.Text = "Confirm input range";
                            this.labelMessage2.Text = message;
                            break;
                        default:
                            break;
                    } 
                    #endregion
                    break;
                case DataStore.LanguageID.Chinese:
                    break;
                case DataStore.LanguageID.Czech:
                    break;
                default:
                    break;
            }

        }
        #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 buttonOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        #endregion
    }
}