コード例 #1
0
        private void signOnBtn_Click(object sender, EventArgs e)
        {
            tmpLocation = selectLocation.Text;

            Properties.Settings.Default.connType = tmpLocation;
            Properties.Settings.Default.Save();

            if (screenName.Text == "New User" || screenName.Text == "Existing Member")
            {
                signup_form suf = new signup_form();
                suf.Owner     = this;
                suf.MdiParent = MdiParent;
                suf.Show();
            }
            else if (screenName.Text == "Guest")
            {
                tmpUsername = "******";
                Close();
            }
            else
            {
                if (RestAPI.loginAccount(screenName.Text, passBox.Text))
                {
                    Close();
                }
                else
                {
                    MessageBox.Show("Account either doesn't exist, or incorrect password.");
                }
            }
        }
コード例 #2
0
ファイル: signup_form.cs プロジェクト: swordstyle/AOL_4.0_Emu
        private void nextBtn_Click(object sender, EventArgs e)
        {
            if (newAOL.Checked)
            {
                panel2.SendToBack();
                panel3.BringToFront();
            }
            else // recover acc from DB API
            {
                string user = recoverUser.Text;
                string pass = recoverPass.Text;
                if (RestAPI.loginAccount(user, pass))
                {
                    string        fn         = RestAPI.getAccInfo("fullname", user, pass);
                    int           code       = sqlite_accounts.createAcc(user, fn);
                    List <string> tmpBuddies = sqlite_accounts.getBuddyList(user, pass);

                    if (code == 0)
                    {
                        foreach (var t in RestAPI.getBuddyList(user, pass))
                        {
                            if (!tmpBuddies.Contains(t)) // if we deleted an account to re-create it, but we had our buddy list still there, prevent a crash
                            {
                                sqlite_accounts.addBuddy(t.ToString());
                            }
                        }
                        MessageBox.Show("Account has been added. Welcome back!", "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Close();
                    }
                    else
                    {
                        if (code == 19)
                        {
                            MessageBox.Show("Account already exists.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            MessageBox.Show("SQLite error " + code.ToString() + " on account creation.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Account not found.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }