//ライセンス情報はAgeOnフォルダのLISENCEフォルダを参照してください
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

using nispi.controlclass;

namespace nispi.OptionControl
{
    //●ログインのＩＤとパス、Ｂｅログインのログインとパス、自動ログインするかどうかをチェックボックスで
    class LogInOption:LogInOptionData
    {
        TabPageExParts tabPageParts;
        //浪人
        GroupBoxParts maruGBoxParts;
        public CheckBoxParts maruAutoLoginCBoxParts;
        LabelParts maruIdLabelParts;
        public TextBoxParts maruIdTBoxParts;
        LabelParts maruPassLabelParts;
        public TextBoxParts maruPassTBoxParts;
        //2ch.net
        GroupBoxParts beGBoxParts;
        public CheckBoxParts beAutoLoginCBoxParts;
        LabelParts beIdLabelParts;
        public TextBoxParts beIdTBoxParts;
        LabelParts bePassLabelParts;
        public TextBoxParts bePassTBoxParts;
        //sc
        GroupBoxParts scBeGBoxParts;
        public CheckBoxParts scBeAutoLoginCBoxParts;
        LabelParts scBeIdLabelParts;
        public TextBoxParts scBeIdTBoxParts;
        LabelParts scBePassLabelParts;
        public TextBoxParts scBePassTBoxParts;

        public LogInOptionEvent logInOptionEvent;
        public OptionMainForm optionTabMain;

        public LogInOption(OptionMainForm optionTabMain)
        {
            this.optionTabMain = optionTabMain;

            float scaledFloat = Scale.GetScaledFloat(optionTabMain.fontSize);

            maruGBoxParts = new GroupBoxParts();
            maruAutoLoginCBoxParts = new CheckBoxParts();
            maruIdLabelParts = new LabelParts();
            maruIdTBoxParts = new TextBoxParts();
            maruPassLabelParts = new LabelParts();
            maruPassTBoxParts = new TextBoxParts();

            tabPageParts = new TabPageExParts();
            tabPageParts.SetFont(optionTabMain.fontName, scaledFloat);
            tabPageParts.Text = "ﾛｸﾞｲﾝ ";
            tabPageParts.BorderStyle = System.Windows.Forms.BorderStyle.None;

            maruGBoxParts.Location = new Point(10, 10);
            maruGBoxParts.Size = new Size(optionTabMain.optionFormParts.ClientSize.Width - 24, 130);
            maruGBoxParts.SetFont(optionTabMain.fontName, scaledFloat);
            maruGBoxParts.Text = "浪人ログイン";

            maruAutoLoginCBoxParts.Location = new Point(20, 30);
            maruAutoLoginCBoxParts.Size = new Size(160, 25);
            maruAutoLoginCBoxParts.SetFont(optionTabMain.fontName, scaledFloat);
            //maruAutoLoginCBoxParts.control.TextAlign = ContentAlignment.MiddleLeft;
            //maruAutoLoginCBoxParts.control.CheckAlign = ContentAlignment.MiddleRight;
            maruAutoLoginCBoxParts.Text = "自動的にログインする";

            maruIdLabelParts.Location = new Point(20, 60);
            maruIdLabelParts.Size = new Size(50, 20);
            maruIdLabelParts.SetFont(optionTabMain.fontName, scaledFloat);
            maruIdLabelParts.Text = "ID：";

            maruIdTBoxParts.Location = new Point(80, 60);
            maruIdTBoxParts.Size = new Size(150, 16);
            maruIdTBoxParts.SetFont(optionTabMain.fontName, scaledFloat);

            maruPassLabelParts.Location = new Point(20, 90);
            maruPassLabelParts.Size = new Size(120, 20);
            maruPassLabelParts.SetFont(optionTabMain.fontName, scaledFloat);
            maruPassLabelParts.Text = "パスワード：";

            maruPassTBoxParts.Location = new Point(150, 90);
            maruPassTBoxParts.Size = new Size(150, 16);
            maruPassTBoxParts.SetFont(optionTabMain.fontName, scaledFloat);
            maruPassTBoxParts.UseSystemPasswordChar = true;

            tabPageParts.AddControl(maruGBoxParts);

            maruGBoxParts.AddControl(maruAutoLoginCBoxParts);
            maruGBoxParts.AddControl(maruIdLabelParts);
            maruGBoxParts.AddControl(maruIdTBoxParts);
            maruGBoxParts.AddControl(maruPassLabelParts);
            maruGBoxParts.AddControl(maruPassTBoxParts);

            ///BE
            beGBoxParts = new GroupBoxParts();
            beAutoLoginCBoxParts = new CheckBoxParts();
            beIdLabelParts = new LabelParts();
            beIdTBoxParts = new TextBoxParts();
            bePassLabelParts = new LabelParts();
            bePassTBoxParts = new TextBoxParts();

            beGBoxParts.Location = new Point(10, 150);
            beGBoxParts.Size = new Size(optionTabMain.optionFormParts.ClientSize.Width - 24, 130);
            beGBoxParts.SetFont(optionTabMain.fontName, scaledFloat);
            beGBoxParts.Text = "Beログイン";

            beAutoLoginCBoxParts.Location = new Point(20, 30);
            beAutoLoginCBoxParts.Size = new Size(160, 25);
            beAutoLoginCBoxParts.SetFont(optionTabMain.fontName, scaledFloat);
            //beAutoLoginCBoxParts.control.TextAlign = ContentAlignment.MiddleLeft;
            //beAutoLoginCBoxParts.control.CheckAlign = ContentAlignment.MiddleRight;
            beAutoLoginCBoxParts.Text = "自動的にログインする";

            beIdLabelParts.Location = new Point(20, 60);
            beIdLabelParts.Size = new Size(50, 20);
            beIdLabelParts.SetFont(optionTabMain.fontName, scaledFloat);
            beIdLabelParts.Text = "ID：";

            beIdTBoxParts.Location = new Point(80, 60);
            beIdTBoxParts.Size = new Size(150, 16);
            beIdTBoxParts.SetFont(optionTabMain.fontName, scaledFloat);

            bePassLabelParts.Location = new Point(20, 90);
            bePassLabelParts.Size = new Size(120, 20);
            bePassLabelParts.SetFont(optionTabMain.fontName, scaledFloat);
            bePassLabelParts.Text = "パスワード：";

            bePassTBoxParts.Location = new Point(150, 90);
            bePassTBoxParts.Size = new Size(150, 16);
            bePassTBoxParts.SetFont(optionTabMain.fontName, scaledFloat);
            bePassTBoxParts.UseSystemPasswordChar = true;

            tabPageParts.AddControl(beGBoxParts);

            beGBoxParts.AddControl(beAutoLoginCBoxParts);
            beGBoxParts.AddControl(beIdLabelParts);
            beGBoxParts.AddControl(beIdTBoxParts);
            beGBoxParts.AddControl(bePassLabelParts);
            beGBoxParts.AddControl(bePassTBoxParts);


            ///SC
            scBeGBoxParts = new GroupBoxParts();
            scBeAutoLoginCBoxParts = new CheckBoxParts();
            scBeIdLabelParts = new LabelParts();
            scBeIdTBoxParts = new TextBoxParts();
            scBePassLabelParts = new LabelParts();
            scBePassTBoxParts = new TextBoxParts();

            scBeGBoxParts.Location = new Point(10, 290);
            scBeGBoxParts.Size = new Size(optionTabMain.optionFormParts.ClientSize.Width - 24, 130);
            scBeGBoxParts.SetFont(optionTabMain.fontName, scaledFloat);
            scBeGBoxParts.Text = "SC Beログイン";

            scBeAutoLoginCBoxParts.Location = new Point(20, 30);
            scBeAutoLoginCBoxParts.Size = new Size(160, 25);
            scBeAutoLoginCBoxParts.SetFont(optionTabMain.fontName, scaledFloat);
            //beAutoLoginCBoxParts.control.TextAlign = ContentAlignment.MiddleLeft;
            //beAutoLoginCBoxParts.control.CheckAlign = ContentAlignment.MiddleRight;
            scBeAutoLoginCBoxParts.Text = "自動的にログインする";

            scBeIdLabelParts.Location = new Point(20, 60);
            scBeIdLabelParts.Size = new Size(50, 20);
            scBeIdLabelParts.SetFont(optionTabMain.fontName, scaledFloat);
            scBeIdLabelParts.Text = "ID：";

            scBeIdTBoxParts.Location = new Point(80, 60);
            scBeIdTBoxParts.Size = new Size(150, 16);
            scBeIdTBoxParts.SetFont(optionTabMain.fontName, scaledFloat);

            scBePassLabelParts.Location = new Point(20, 90);
            scBePassLabelParts.Size = new Size(120, 20);
            scBePassLabelParts.SetFont(optionTabMain.fontName, scaledFloat);
            scBePassLabelParts.Text = "パスワード：";

            scBePassTBoxParts.Location = new Point(150, 90);
            scBePassTBoxParts.Size = new Size(150, 16);
            scBePassTBoxParts.SetFont(optionTabMain.fontName, scaledFloat);
            scBePassTBoxParts.UseSystemPasswordChar = true;

            tabPageParts.AddControl(scBeGBoxParts);

            scBeGBoxParts.AddControl(scBeAutoLoginCBoxParts);
            scBeGBoxParts.AddControl(scBeIdLabelParts);
            scBeGBoxParts.AddControl(scBeIdTBoxParts);
            scBeGBoxParts.AddControl(scBePassLabelParts);
            scBeGBoxParts.AddControl(scBePassTBoxParts);

            optionTabMain.optionTabControlParts.AddControl(tabPageParts);

            logInOptionEvent = new LogInOptionEvent(this);
        }


        public void SetDataToGUI()
        {
            logInOptionEvent.ResetEvent();

            this.maruAutoLoginCBoxParts.Checked = bool.Parse(this.IsMaruAutoLogIn);
            this.maruIdTBoxParts.Text = this.MaruID;
            this.maruPassTBoxParts.Text = this.MaruPassWord;

            this.beAutoLoginCBoxParts.Checked = bool.Parse(this.IsBeAutoLogIn);
            this.beIdTBoxParts.Text = this.BeID;
            this.bePassTBoxParts.Text = this.BePassWord;

            this.scBeAutoLoginCBoxParts.Checked = bool.Parse(this.IsSCBeAutoLogIn);
            this.scBeIdTBoxParts.Text = this.SCBeID;
            this.scBePassTBoxParts.Text = this.SCBePassWord;

            logInOptionEvent.SetEvent();

        }
    }
}