Example #1
0
        private void MM_QuitStartMenu_Click(object sender, EventArgs e)
        {
            UpdateHeroInfo();
            save.UpdateSaved();

            this.Hide();
            StartMenu starmenu = new StartMenu();

            starmenu.ShowDialog();
            this.Close();
        }
Example #2
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (sizeOfTable == 0)
                {
                    MessageBox.Show("Please register first!");
                    throw new Exception("No users");
                }

                if (UsernameBox.Text.Length == 0)
                {
                    MessageBox.Show("Enter a username!");
                }
                else if (users.Any(o => o.Name == UsernameBox.Text))
                {
                    string pass   = "";
                    string heroes = "";

                    foreach (var c in users)
                    {
                        if (c.Name == UsernameBox.Text)
                        {
                            pass += c.Password;
                            if (c.Heroes != null)
                            {
                                heroes += c.Heroes;
                            }
                            break;
                        }
                    }
                    if (pass == PasswordBox.Text)
                    {
                        CreateHeroes(heroes);
                        username = UsernameBox.Text;
                        this.Hide();
                        StartMenu startM = new StartMenu();
                        startM.ShowDialog();
                        this.Close();
                    }
                    else if (!(pass == PasswordBox.Text))
                    {
                        MessageBox.Show("Not a valid password!");
                    }
                }
                else if (!users.Any(o => o.Name == UsernameBox.Text))
                {
                    MessageBox.Show("Not a valid username!");
                }
            }
            catch {}
        }
Example #3
0
        private void Cancel_Click(object sender, EventArgs e)
        {
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;
            DialogResult      result  = MessageBox.Show("Do you wish to cancel?", "", buttons);

            if (result == DialogResult.Yes)
            {
                this.Hide();
                StartMenu startmenu = new StartMenu();
                startmenu.ShowDialog();
                this.Close();
            }
        }