예제 #1
0
        private void btn_NoAccn_Click(object sender, EventArgs e)
        {
            Frm_Cleaner cleaner = new Frm_Cleaner(this.connector);

            cleaner.FormClosed += (s, argv) => this.Close();
            this.Hide();
            cleaner.Show();
        }
예제 #2
0
        private async void btn_Login_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tb_ID.Text))
            {
                tb_ID.Focus();
                this.lbl_Error.Text = "ID를 입력해주세요.";
                return;
            }
            if (string.IsNullOrWhiteSpace(tb_PW.Text))
            {
                tb_PW.Focus();
                this.lbl_Error.Text = "비밀번호를 입력해주세요.";
                return;
            }

            string id = tb_ID.Text.Trim().ToLower();
            string pw = tb_PW.Text.Trim();

            tb_ID.Enabled      = false;
            tb_PW.Enabled      = false;
            btn_Login.Enabled  = false;
            btn_NoAccn.Enabled = false;

            bool result = false;

            this.lbl_Error.Text = "로그인중입니다.";

            try
            {
                result = await connector.Login(id, pw);
            }
            catch
            {
                tb_ID.Enabled       = true;
                tb_PW.Enabled       = true;
                btn_Login.Enabled   = true;
                btn_NoAccn.Enabled  = true;
                this.lbl_Error.Text = "서버 오류로 로그인에 실패하였습니다.";
            }

            if (result)
            {
                Frm_Cleaner cleaner = new Frm_Cleaner(this.connector);
                cleaner.FormClosed += (s, argv) => this.Close();
                this.Hide();
                cleaner.Show();
            }
            else
            {
                tb_ID.Enabled      = true;
                tb_PW.Enabled      = true;
                btn_Login.Enabled  = true;
                btn_NoAccn.Enabled = true;
                lbl_Error.Text     = connector.LoginInfo.ErrorMessage;
                btn_Login.Focus();
            }
        }
예제 #3
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tb_ID.Text))
            {
                tb_ID.Focus();
                this.lbl_Error.Text = "ID를 입력해주세요.";
                return;
            }
            if (string.IsNullOrWhiteSpace(tb_PW.Text))
            {
                tb_PW.Focus();
                this.lbl_Error.Text = "비밀번호를 입력해주세요.";
                return;
            }

            if (loginThread != null && loginThread.IsAlive)
            {
                return;
            }

            string id = tb_ID.Text.Trim();
            string pw = tb_PW.Text.Trim();

            loginThread = new Thread(new ThreadStart(delegate()
            {
                bool result = false;

                try
                {
                    result = connector.LoginDCInside(id, pw);
                }
                catch (ThreadAbortException) { throw; }
                catch
                {
                    this.Invoke(new Action(() =>
                    {
                        this.lbl_Error.Text = "서버 오류로 로그인에 실패하였습니다.";
                    }));

                    return;
                }

                this.Invoke(new Action(() =>
                {
                    if (result)
                    {
                        Frm_Cleaner cleaner = new Frm_Cleaner(this.connector);
                        cleaner.FormClosed += (s, argv) => this.Close();
                        this.Hide();
                        cleaner.Show();
                    }
                    else
                    {
                        lbl_Error.Text = connector.LoginErrorMessage;
                    }
                }));
            }));

            this.lbl_Error.Text = "로그인중입니다.";

            loginThread.Start();
        }