﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Media;

namespace Alpha
{
    public partial class frmKataGame : Form
    {
        string aseries = "アイウエオ";
        string kaseries = "カキクケコ";
        string saseries = "サシスセソ";
        string taseries = "タチツテト";
        string naseries = "ナニヌネノ";
        string haseries = "ハヒフヘホ";
        string maseries = "マミムメモ";
        string yaseries = "ヤユヨ";
        string raseries = "ラリルレロ";
        string waseries = "ワヲ";
        string nseries = "ン";

        string gaseries = "ガギグゲゴ";
        string zaseries = "ザジズゼぞ";
        string daseries = "ダヂヅデド";
        string baseries = "バビブべボ";
        string paseries = "パピプペポ";

        int mode = 0;
        int withAudio = 0;
        int withTimer = 0;
        int withSession = 0;

        string curChar = "";
        Random random = new Random();
        string chosenseries;

        int corScore = 0;
        int totScore = 0;
        int timeLeft = 0;

        static System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer();

        string ChooseSeries()
        {
            if (!cbxA.Checked)
            {
                chosenseries = "";
            }
            if (!cbxKA.Checked)
            {
                chosenseries = "";
            }
            if (!cbxSA.Checked)
            {
                chosenseries = "";
            }
            if (!cbxTA.Checked)
            {
                chosenseries = "";
            }
            if (!cbxNA.Checked)
            {
                chosenseries = "";
            }
            if (!cbxHA.Checked)
            {
                chosenseries = "";
            }
            if (!cbxMA.Checked)
            {
                chosenseries = "";
            }
            if (!cbxYA.Checked)
            {
                chosenseries = "";
            }
            if (!cbxRA.Checked)
            {
                chosenseries = "";
            }
            if (!cbxWA.Checked)
            {
                chosenseries = "";
            }
            if (!cbxN.Checked)
            {
                chosenseries = "";
            }

            if (cbxA.Checked)
            {
                chosenseries += aseries;
            }
            if (cbxKA.Checked)
            {
                if (mode == 0) chosenseries += kaseries;
                else if (mode == 1) chosenseries += gaseries;
            }
            if (cbxSA.Checked)
            {
                if (mode == 0) chosenseries += saseries;
                else if (mode == 1) chosenseries += zaseries;
            }
            if (cbxTA.Checked)
            {
                if (mode == 0) chosenseries += taseries;
                else if (mode == 1) chosenseries += daseries;
            }
            if (cbxNA.Checked)
            {
                chosenseries += naseries;
            }
            if (cbxHA.Checked)
            {
                if (mode == 0) chosenseries += haseries;
                else if (mode == 1) chosenseries += baseries;
                else if (mode == 2) chosenseries += paseries;
            }
            if (cbxMA.Checked)
            {
                chosenseries += maseries;
            }
            if (cbxYA.Checked)
            {
                chosenseries += yaseries;
            }
            if (cbxRA.Checked)
            {
                chosenseries += raseries;
            }
            if (cbxWA.Checked)
            {
                chosenseries += waseries;
            }
            if (cbxN.Checked)
            {
                chosenseries += nseries;
            }

            return chosenseries;
        }

        void CharacterButton(string letter, string sound)
        {
            if (!cbxA.Checked && !cbxKA.Checked && !cbxSA.Checked && !cbxTA.Checked && !cbxMA.Checked && !cbxHA.Checked && !cbxNA.Checked && !cbxYA.Checked && !cbxRA.Checked && !cbxWA.Checked && !cbxN.Checked)
            {
                MessageBox.Show("Please enable at least 1 checkbox.");
            }
            else
            {
                if (curChar == letter)
                {
                    lblScoreHira.Text = "CORRECT!";
                    lblScoreHira.BackColor = Color.Green;
                    corScore++;
                    totScore++;
                    if (withAudio == 1) (new SoundPlayer(@"sounds\Kana\" + sound + ".wav")).PlaySync();
                }
                else
                {
                    lblScoreHira.Text = "WRONG!";
                    lblScoreHira.BackColor = Color.Red;
                    totScore++;
                }

                lblScore.Text = "Score: " + corScore + "/" + totScore;
                timeLeft = withTimer;
                if (withTimer != 0) lblTimer.Text = "Timer: " + timeLeft;
                if (withSession != 0) lblSession.Text = "Session: " + totScore + "/" + withSession;
                curChar = Convert.ToString(CharGen.GetChar(ChooseSeries(), random));
                lblQuestionHira.Text = curChar;

                if (totScore == withSession && withSession != 0)
                {
                    MessageBox.Show("Good, we're done for now! :)");
                    Close();
                }
            }
        }

        void TimerEventProcessor(Object sender, EventArgs e)
        {
            Check();
        }

        public void Check()
        {
            try
            {
                if (timeLeft != 0) timeLeft--;
                else CharacterButton("Z", "a");
                lblTimer.Text = "Timer: " + timeLeft;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public frmKataGame(int au, int tm, int ss)
        {
            curChar = Convert.ToString(CharGen.GetChar(aseries, random));
            InitializeComponent();
            withAudio = au;
            withTimer = tm;
            timeLeft = tm;
            withSession = ss;
            lblScore.Text = "Score: 0/0";

            if (withTimer != 0) lblTimer.Text = "Timer: " + timeLeft;
            else lblTimer.Text = "";

            if (withSession != 0) lblSession.Text = "Session: 0/" + ss;
            else lblSession.Text = "";

            lblQuestionHira.Text = curChar;

            if (withTimer != 0)
            {
                myTimer.Tick += TimerEventProcessor;
                myTimer.Interval = 1000;
                myTimer.Enabled = true;
            }
        }

        private void btnHiraA_Click(object sender, EventArgs e)
        {
            CharacterButton("ア", "a");
        }

        private void btnHiraI_Click(object sender, EventArgs e)
        {
            CharacterButton("イ", "i");
        }

        private void btnHiraU_Click(object sender, EventArgs e)
        {
            CharacterButton("ウ", "u");
        }

        private void btnHiraE_Click(object sender, EventArgs e)
        {
            CharacterButton("エ", "e");
        }

        private void btnHiraO_Click(object sender, EventArgs e)
        {
            CharacterButton("オ", "o");
        }

        private void btnHiraKA_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("カ", "ka");
            }
            else if (mode == 1)
            {
                CharacterButton("ガ", "ga");

            }
        }

        private void btnHiraKI_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("キ", "ki");
            }
            else if (mode == 1)
            {
                CharacterButton("ギ", "gi");
            }
        }

        private void btnHiraKU_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("ク", "ku");
            }
            else if (mode == 1)
            {
                CharacterButton("グ", "gu");
            }
        }

        private void btnHiraKE_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("ケ", "ke");
            }
            else if (mode == 1)
            {
                CharacterButton("ゲ", "ge");
            }
        }

        private void btnHiraKO_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("コ", "ko");
            }
            else if (mode == 1)
            {
                CharacterButton("ゴ", "go");
            }
        }

        private void btnHiraSA_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("サ", "sa");
            }
            else if (mode == 1)
            {
                CharacterButton("ザ", "za");
            }
        }

        private void btnHiraSHi_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("シ", "shi");
            }
            else if (mode == 1)
            {
                CharacterButton("ジ", "ji");
            }
        }

        private void btnHiraSU_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("ス", "su");
            }
            else if (mode == 1)
            {
                CharacterButton("ズ", "zu");
            }
        }

        private void btnHiraSE_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("セ", "se");
            }
            else if (mode == 1)
            {
                CharacterButton("ゼ", "ze");
            }
        }

        private void btnHiraSO_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("ソ", "so");
            }
            else if (mode == 1)
            {
                CharacterButton("ゾ", "zo");
            }
        }

        private void btnHiraTA_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("タ", "ta");
            }
            else if (mode == 1)
            {
                CharacterButton("ダ", "da");
            }
        }

        private void btnHiraCHI_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("チ", "chi");
            }
            else if (mode == 1)
            {
                CharacterButton("ヂ", "ji");
            }
        }

        private void btnHiraTSU_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("ツ", "tsu");
            }
            else if (mode == 1)
            {
                CharacterButton("ヅ", "dzu");
            }
        }

        private void btnHiraTE_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("テ", "te");
            }
            else if (mode == 1)
            {
                CharacterButton("デ", "de");
            }
        }

        private void btnHiraTO_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("ト", "to");
            }
            else if (mode == 1)
            {
                CharacterButton("ド", "do");
            }
        }

        private void btnHiraNA_Click(object sender, EventArgs e)
        {
            CharacterButton("ナ", "na");
        }

        private void btnHiraNI_Click(object sender, EventArgs e)
        {
            CharacterButton("ニ", "ni");
        }

        private void btnHiraNU_Click(object sender, EventArgs e)
        {
            CharacterButton("ヌ", "nu");
        }

        private void btnHiraNE_Click(object sender, EventArgs e)
        {
            CharacterButton("ネ", "ne");
        }

        private void btnHiraNO_Click(object sender, EventArgs e)
        {
            CharacterButton("ノ", "no");
        }

        private void btnHiraHA_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("ハ", "pa");
            }
            else if (mode == 1)
            {
                CharacterButton("バ", "ba");
            }
            else if (mode == 2)
            {
                CharacterButton("パ", "ha");
            }
        }

        private void btnHiraHI_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("ヒ", "hi");
            }
            else if (mode == 1)
            {
                CharacterButton("ビ", "bi");
            }
            else if (mode == 2)
            {
                CharacterButton("ピ", "pi");
            }
        }

        private void btnHiraFU_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("フ", "fu");
            }
            else if (mode == 1)
            {
                CharacterButton("ブ", "bu");
            }
            else if (mode == 2)
            {
                CharacterButton("プ", "pu");
            }
        }

        private void btnHiraHE_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("へ", "he");
            }
            else if (mode == 1)
            {
                CharacterButton("ベ", "be");
            }
            else if (mode == 2)
            {
                CharacterButton("ペ", "pe");
            }
        }

        private void HO_Click(object sender, EventArgs e)
        {
            if (mode == 0)
            {
                CharacterButton("ホ", "ho");
            }
            else if (mode == 1)
            {
                CharacterButton("ボ", "bo");
            }
            else if (mode == 2)
            {
                CharacterButton("ポ", "po");
            }
        }

        private void btnHiraMA_Click(object sender, EventArgs e)
        {
            CharacterButton("マ", "ma");
        }

        private void btnHiraMI_Click(object sender, EventArgs e)
        {
            CharacterButton("ミ", "mi");
        }

        private void btnHiraMU_Click(object sender, EventArgs e)
        {
            CharacterButton("ム", "mu");
        }

        private void btnHiraME_Click(object sender, EventArgs e)
        {
            CharacterButton("メ", "me");
        }

        private void btnHiraMO_Click(object sender, EventArgs e)
        {
            CharacterButton("モ", "mo");
        }

        private void btnHiraYA_Click(object sender, EventArgs e)
        {
            CharacterButton("ヤ", "ya");
        }

        private void btnHiraYU_Click(object sender, EventArgs e)
        {
            CharacterButton("ユ", "yu");
        }

        private void btnHiraYO_Click(object sender, EventArgs e)
        {
            CharacterButton("ヨ", "yo");
        }

        private void btnHiraRA_Click(object sender, EventArgs e)
        {
            CharacterButton("ラ", "ra");
        }

        private void btnHiraRI_Click(object sender, EventArgs e)
        {
            CharacterButton("リ", "ri");
        }

        private void btnHiraRU_Click(object sender, EventArgs e)
        {
            CharacterButton("ル", "ru");
        }

        private void btnHiraRE_Click(object sender, EventArgs e)
        {
            CharacterButton("レ", "re");
        }

        private void btnHiraRO_Click(object sender, EventArgs e)
        {
            CharacterButton("ロ", "ro");
        }

        private void btnHiraWA_Click(object sender, EventArgs e)
        {
            CharacterButton("ワ", "wa");
        }

        private void btnHiraWO_Click(object sender, EventArgs e)
        {
            CharacterButton("ヲ", "wo");
        }

        private void btnHiraN_Click(object sender, EventArgs e)
        {
            CharacterButton("ン", "n");
        }

        private void btnChangeMode_Click(object sender, EventArgs e)
        {
            if (!cbxA.Checked && !cbxKA.Checked && !cbxSA.Checked && !cbxTA.Checked && !cbxMA.Checked && !cbxHA.Checked && !cbxNA.Checked && !cbxYA.Checked && !cbxRA.Checked && !cbxWA.Checked && !cbxN.Checked)
            {
                MessageBox.Show("Please enable at least 1 checkbox.");
            }
            else
            {
                mode++;

                if (mode > 2) mode = 0;

                btnHiraA.Text = "A";
                btnHiraI.Text = "I";
                btnHiraU.Text = "U";
                btnHiraE.Text = "E";
                btnHiraO.Text = "O";
                btnHiraNA.Text = "NA";
                btnHiraNI.Text = "NI";
                btnHiraNU.Text = "NU";
                btnHiraNE.Text = "NE";
                btnHiraNO.Text = "NO";
                btnHiraMA.Text = "MA";
                btnHiraMI.Text = "MI";
                btnHiraMU.Text = "MU";
                btnHiraME.Text = "ME";
                btnHiraMO.Text = "MO";
                btnHiraYA.Text = "YA";
                btnHiraYU.Text = "YU";
                btnHiraYO.Text = "YO";
                btnHiraRA.Text = "RA";
                btnHiraRI.Text = "RI";
                btnHiraRU.Text = "RU";
                btnHiraRE.Text = "RE";
                btnHiraRO.Text = "RO";
                btnHiraWA.Text = "WA";
                btnHiraWO.Text = "WO";
                btnHiraN.Text = "N";

                if (mode == 0)
                {
                    cbxA.Enabled = true;
                    cbxKA.Enabled = true;
                    cbxSA.Enabled = true;
                    cbxTA.Enabled = true;
                    cbxNA.Enabled = true;
                    cbxHA.Enabled = true;
                    cbxMA.Enabled = true;
                    cbxYA.Enabled = true;
                    cbxRA.Enabled = true;
                    cbxWA.Enabled = true;
                    cbxN.Enabled = true;

                    btnHiraKA.Text = "KA";
                    btnHiraKI.Text = "KI";
                    btnHiraKU.Text = "KU";
                    btnHiraKE.Text = "KE";
                    btnHiraKO.Text = "KO";
                    btnHiraSA.Text = "SA";
                    btnHiraSHI.Text = "SHI";
                    btnHiraSU.Text = "SU";
                    btnHiraSE.Text = "SE";
                    btnHiraSO.Text = "SO";
                    btnHiraTA.Text = "TA";
                    btnHiraCHI.Text = "CHI";
                    btnHiraTSU.Text = "TSU";
                    btnHiraTE.Text = "TE";
                    btnHiraTO.Text = "TO";
                    btnHiraHA.Text = "HA";
                    btnHiraHI.Text = "HI";
                    btnHiraFU.Text = "FU";
                    btnHiraHE.Text = "HE";
                    btnHiraHO.Text = "HO";
                }

                else if (mode == 1)
                {
                    cbxA.Enabled = false;
                    cbxKA.Enabled = true;
                    cbxSA.Enabled = true;
                    cbxTA.Enabled = true;
                    cbxNA.Enabled = false;
                    cbxHA.Enabled = true;
                    cbxMA.Enabled = false;
                    cbxYA.Enabled = false;
                    cbxRA.Enabled = false;
                    cbxWA.Enabled = false;
                    cbxN.Enabled = false;

                    cbxA.Checked = false;
                    cbxNA.Checked = false;
                    cbxMA.Checked = false;
                    cbxYA.Checked = false;
                    cbxRA.Checked = false;
                    cbxWA.Checked = false;
                    cbxN.Checked = false;

                    cbxKA.Checked = true;

                    btnHiraKA.Text = "GA";
                    btnHiraKI.Text = "GI";
                    btnHiraKU.Text = "GU";
                    btnHiraKE.Text = "GE";
                    btnHiraKO.Text = "GO";
                    btnHiraSA.Text = "ZA";
                    btnHiraSHI.Text = "JI";
                    btnHiraSU.Text = "ZU";
                    btnHiraSE.Text = "ZE";
                    btnHiraSO.Text = "ZO";
                    btnHiraTA.Text = "DA";
                    btnHiraCHI.Text = "JI";
                    btnHiraTSU.Text = "DZU";
                    btnHiraTE.Text = "DE";
                    btnHiraTO.Text = "DO";
                    btnHiraHA.Text = "BA";
                    btnHiraHI.Text = "BI";
                    btnHiraFU.Text = "BU";
                    btnHiraHE.Text = "BE";
                    btnHiraHO.Text = "BO";
                }

                else if (mode == 2)
                {
                    cbxA.Enabled = false;
                    cbxKA.Enabled = false;
                    cbxSA.Enabled = false;
                    cbxTA.Enabled = false;
                    cbxNA.Enabled = false;
                    cbxHA.Enabled = false;
                    cbxMA.Enabled = false;
                    cbxYA.Enabled = false;
                    cbxRA.Enabled = false;
                    cbxWA.Enabled = false;
                    cbxN.Enabled = false;

                    cbxA.Checked = false;
                    cbxKA.Checked = false;
                    cbxSA.Checked = false;
                    cbxTA.Checked = false;
                    cbxNA.Checked = false;
                    cbxMA.Checked = false;
                    cbxYA.Checked = false;
                    cbxRA.Checked = false;
                    cbxWA.Checked = false;
                    cbxN.Checked = false;

                    cbxHA.Checked = true;

                    btnHiraHA.Text = "PA";
                    btnHiraHI.Text = "PI";
                    btnHiraFU.Text = "PU";
                    btnHiraHE.Text = "PE";
                    btnHiraHO.Text = "PO";
                }

                curChar = Convert.ToString(CharGen.GetChar(ChooseSeries(), random));
                lblQuestionHira.Text = curChar;
            }
        }

        private void cbxA_CheckedChanged(object sender, EventArgs e)
        {
            if (cbxA.Checked)
            {
                btnHiraA.Enabled = true;
                btnHiraI.Enabled = true;
                btnHiraU.Enabled = true;
                btnHiraE.Enabled = true;
                btnHiraO.Enabled = true;
            }
            else
            {
                btnHiraA.Enabled = false;
                btnHiraI.Enabled = false;
                btnHiraU.Enabled = false;
                btnHiraE.Enabled = false;
                btnHiraO.Enabled = false;
            }
        }

        private void cbxKA_CheckedChanged(object sender, EventArgs e)
        {
            if (cbxKA.Checked)
            {
                btnHiraKA.Enabled = true;
                btnHiraKI.Enabled = true;
                btnHiraKU.Enabled = true;
                btnHiraKE.Enabled = true;
                btnHiraKO.Enabled = true;
            }
            else
            {
                btnHiraKA.Enabled = false;
                btnHiraKI.Enabled = false;
                btnHiraKU.Enabled = false;
                btnHiraKE.Enabled = false;
                btnHiraKO.Enabled = false;
            }
        }

        private void cbxSA_CheckedChanged(object sender, EventArgs e)
        {
            if (cbxSA.Checked)
            {
                btnHiraSA.Enabled = true;
                btnHiraSHI.Enabled = true;
                btnHiraSU.Enabled = true;
                btnHiraSE.Enabled = true;
                btnHiraSO.Enabled = true;
            }
            else
            {
                btnHiraSA.Enabled = false;
                btnHiraSHI.Enabled = false;
                btnHiraSU.Enabled = false;
                btnHiraSE.Enabled = false;
                btnHiraSO.Enabled = false;
            }
        }

        private void cbxTA_CheckedChanged(object sender, EventArgs e)
        {
            if (cbxTA.Checked)
            {
                btnHiraTA.Enabled = true;
                btnHiraCHI.Enabled = true;
                btnHiraTSU.Enabled = true;
                btnHiraTE.Enabled = true;
                btnHiraTO.Enabled = true;
            }
            else
            {
                btnHiraTA.Enabled = false;
                btnHiraCHI.Enabled = false;
                btnHiraTSU.Enabled = false;
                btnHiraTE.Enabled = false;
                btnHiraTO.Enabled = false;
            }
        }

        private void cbxNA_CheckedChanged(object sender, EventArgs e)
        {
            if (cbxNA.Checked)
            {
                btnHiraNA.Enabled = true;
                btnHiraNI.Enabled = true;
                btnHiraNU.Enabled = true;
                btnHiraNE.Enabled = true;
                btnHiraNO.Enabled = true;
            }
            else
            {
                btnHiraNA.Enabled = false;
                btnHiraNI.Enabled = false;
                btnHiraNU.Enabled = false;
                btnHiraNE.Enabled = false;
                btnHiraNO.Enabled = false;
            }
        }

        private void cbxHA_CheckedChanged(object sender, EventArgs e)
        {
            if (cbxHA.Checked)
            {
                btnHiraHA.Enabled = true;
                btnHiraHI.Enabled = true;
                btnHiraFU.Enabled = true;
                btnHiraHE.Enabled = true;
                btnHiraHO.Enabled = true;
            }
            else
            {
                btnHiraHA.Enabled = false;
                btnHiraHI.Enabled = false;
                btnHiraFU.Enabled = false;
                btnHiraHE.Enabled = false;
                btnHiraHO.Enabled = false;
            }
        }

        private void cbxMA_CheckedChanged(object sender, EventArgs e)
        {
            if (cbxMA.Checked)
            {
                btnHiraMA.Enabled = true;
                btnHiraMI.Enabled = true;
                btnHiraMU.Enabled = true;
                btnHiraME.Enabled = true;
                btnHiraMO.Enabled = true;
            }
            else
            {
                btnHiraMA.Enabled = false;
                btnHiraMI.Enabled = false;
                btnHiraMU.Enabled = false;
                btnHiraME.Enabled = false;
                btnHiraMO.Enabled = false;
            }
        }

        private void cbxYA_CheckedChanged(object sender, EventArgs e)
        {
            if (cbxYA.Checked)
            {
                btnHiraYA.Enabled = true;
                btnHiraYU.Enabled = true;
                btnHiraYO.Enabled = true;
            }
            else
            {
                btnHiraYA.Enabled = false;
                btnHiraYU.Enabled = false;
                btnHiraYO.Enabled = false;
            }
        }

        private void cbxRA_CheckedChanged(object sender, EventArgs e)
        {
            if (cbxRA.Checked)
            {
                btnHiraRA.Enabled = true;
                btnHiraRI.Enabled = true;
                btnHiraRU.Enabled = true;
                btnHiraRE.Enabled = true;
                btnHiraRO.Enabled = true;
            }
            else
            {
                btnHiraRA.Enabled = false;
                btnHiraRI.Enabled = false;
                btnHiraRU.Enabled = false;
                btnHiraRE.Enabled = false;
                btnHiraRO.Enabled = false;
            }
        }

        private void cbxWA_CheckedChanged(object sender, EventArgs e)
        {
            if (cbxWA.Checked)
            {
                btnHiraWA.Enabled = true;
                btnHiraWO.Enabled = true;
            }
            else
            {
                btnHiraWA.Enabled = false;
                btnHiraWO.Enabled = false;
            }
        }

        private void cbxN_CheckedChanged(object sender, EventArgs e)
        {
            if (cbxN.Checked)
            {
                btnHiraN.Enabled = true;
            }
            else
            {
                btnHiraN.Enabled = false;
            }
        }
    }
}
