Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int check = 0;

            //txtID: username/email
            if (txtID.Text != "" && txtPass.Text != "")
            {
                //Loading_Bar(check);

                LoginObject loginObject = new LoginObject(txtID.Text, txtPass.Text);
                string      rs          = AuthsControllerShould.LoginController(loginObject);
                if (rs.Equals("user"))
                {
                    check = 1;
                    //Loading_Bar(check);
                    MessageBox.Show("Account does not exist!\nYou should register it!", "Error");
                }
                else if (rs.Equals("pass"))
                {
                    check = 2;
                    //Loading_Bar(check);
                    MessageBox.Show("Password incorrect!", "Error");
                }
                else // login correctly, received token, id
                {
                    string id = rs;
                    MyHome a  = new MyHome(id, txtPass.Text); //pass: //add wishgame

                    check = 3;
                    //Loading_Bar(check);

                    a.Show();
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Information is not enough!");
            }
        }
Example #2
0
        private void txtPass_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                //txtID: username/email
                if (txtID.Text != "" && txtPass.Text != "")
                {
                    LoginObject loginObject = new LoginObject(txtID.Text, txtPass.Text);
                    string      rs          = AuthsControllerShould.LoginController(loginObject);
                    //if (rs.Equals("user"))
                    //{
                    //    MessageBox.Show("Account does not exist!\nYou should register it!", "Error");
                    //}
                    //else if (rs.Equals("pass"))
                    //{
                    //    MessageBox.Show("Password incorrect!", "Error");
                    //}
                    //else // login correctly, received token, id
                    //{
                    //    string id = rs;
                    //    MyHome a = new MyHome(id);
                    //    a.Show();
                    //    this.Hide();
                    //}

                    if (!rs.Equals("user") && !rs.Equals("pass"))
                    {
                        string id = rs;
                        MyHome a  = new MyHome(id, txtPass.Text);
                        a.Show();
                        this.Hide();
                    }
                }
                //else MessageBox.Show("Information is not enough!");
            }
        }