Beispiel #1
0
 private void TxtPassword_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == '\r') // 엔터
     {
         BtnLogin.Focus();
     }
 }
Beispiel #2
0
 private void txtPassword_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         BtnLogin.Focus();
     }
 }
Beispiel #3
0
 private void txtpassword_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyData == Keys.Enter)
     {
         BtnLogin.Focus();
         BtnLogin_Click(null, null);
     }
 }
Beispiel #4
0
 private void enter(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == Convert.ToChar(Keys.Enter))
     {
         BtnLogin.Focus();
         BtnLogin_Click(sender, e);
     }
 }
Beispiel #5
0
 /// <summary>
 /// PasswordBox回车事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Password_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if (e.Key == Key.Enter && IsValidate())
     {
         BtnLogin.Focus();
         BtnLogin.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
     }
 }
Beispiel #6
0
 private void txtpassword_KeyDown(object sender, KeyEventArgs e)
 {
     if (txtusername.Text.Trim().Length != 0 && txtpassword.Text.Trim().Length != 0 && e.KeyCode == Keys.Enter)
     {
         BtnLogin.Focus();
         BtnLogin.PerformClick();
     }
 }
Beispiel #7
0
 private void UserPasswordControl_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         BtnLogin.Focus();
         BtnLogin_Click(sender, e);
     }
 }
Beispiel #8
0
 // LOGIN処理
 private void Key_login(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         e.Handled = true;
         //Login();
         BtnLogin.Focus();
         //this.User.SelectAll();
     }
 }
Beispiel #9
0
        private async void BtnLogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(TxtLoginUserName.Text.Trim()) || string.IsNullOrWhiteSpace(TxtLoginPassword.Text.Trim()))
            {
                lblMsgBox.Text      = ClsAppMsgs.EmptyFielsAlertMsg;
                lblMsgBox.BackColor = ColorTranslator.FromHtml("#ffedf6");
                lblMsgBox.ForeColor = ColorTranslator.FromHtml("#d20051");
                BtnLogin.Focus();
                lblMsgBox.Visible = true;
                await Task.Delay(3000);

                lblMsgBox.Visible = false;
                return;
            }
            else
            {
                String      TxtBoxUserEmailValue = TxtLoginUserName.Text.Trim();
                String      TxtBoxPasswordValue  = TxtLoginPassword.Text.Trim();
                UserAccount userAccountObj       = new UserAccount
                {
                    UserEmailAddress = TxtBoxUserEmailValue,
                    Password         = TxtBoxPasswordValue,
                };
                try
                {
                    // ClsUserAccountsServices.Insert(userAccountObj);
                    ClsUserAccountsServices.UserAccountExist(userAccountObj);
                }
                catch
                {
                    lblMsgBox.Text      = ClsAppMsgs.LoginErrorOccurredMsg;
                    lblMsgBox.BackColor = ColorTranslator.FromHtml("#ffedf6");
                    lblMsgBox.ForeColor = ColorTranslator.FromHtml("#d20051");
                    lblMsgBox.Visible   = true;
                    BtnLogin.Focus();
                    await Task.Delay(3000);

                    lblMsgBox.Visible = false;
                }
            }
            if (!ClsUserAccountsServices.EmailAlreadyExists)
            {
                // UserEmailNotExistsMsg
                lblMsgBox.Text      = ClsAppMsgs.UserEmailNotExistsMsg;
                lblMsgBox.BackColor = ColorTranslator.FromHtml("#fff5cc");
                lblMsgBox.ForeColor = ColorTranslator.FromHtml("#856404");
                lblMsgBox.Visible   = true;
                BtnLogin.Focus();
                await Task.Delay(3000);

                lblMsgBox.Visible = false;
                ClsUserAccountsServices.EmailAlreadyExists = false;
                return;
            }
            else
            {
                if (ClsUserAccountsServices.UserCanLogin == true)
                {
                    ClsUserAccountsServices.UserCanLogin = false;
                    lblMsgBox.Text      = "دخــــــول";
                    lblMsgBox.BackColor = ColorTranslator.FromHtml("#deffef");
                    lblMsgBox.ForeColor = ColorTranslator.FromHtml("#009e52");
                    lblMsgBox.Visible   = true;
                    BtnLogin.Focus();
                    await Task.Delay(3000);

                    lblMsgBox.Visible = false;
                    //return;
                    Form frmMain = new FrmMainApp();
                    frmMain.Show();
                    this.Visible = false;
                    this.Hide();
                    //this.Close();
                    //this.Dispose();
                }
                else
                {
                    lblMsgBox.Text      = ClsAppMsgs.UserCanNotLoginMsg;
                    lblMsgBox.BackColor = ColorTranslator.FromHtml("#fff5cc");
                    lblMsgBox.ForeColor = ColorTranslator.FromHtml("#856404");
                    lblMsgBox.Visible   = true;
                    BtnLogin.Focus();
                    await Task.Delay(3000);

                    lblMsgBox.Visible = false;
                    ClsUserAccountsServices.EmailAlreadyExists = false;
                    ClsUserAccountsServices.UserCanLogin       = false;
                    return;
                }
            }
        }