コード例 #1
0
        private void CreateAccountsButton_Click(object sender, EventArgs e)
        {
            bool create = true;

            while (create)
            {
                CreateAccountView createacctView = new CreateAccountView(true);
                //Need to add more to this view to return information about what went wrong for the user.
                //It will probably handle the showing of the reason why within itself, but I'm doing it here for now.

                DialogResult result     = createacctView.ShowDialog(); //Will answer 'Was account created?'
                DialogResult additional = DialogResult.No;

                if (result == DialogResult.Yes)
                {
                    additional = MessageBox.Show("Account created!\nCreate another?", "Account Created", MessageBoxButtons.YesNo);
                }
                else
                {
                    additional = MessageBox.Show("Username already taken.\nCreate another?", "Duplicate Username", MessageBoxButtons.YesNo);
                }

                if (additional != DialogResult.Yes)
                {
                    create = false;
                }
            }
        }
コード例 #2
0
        private void createButton_Click(object sender, EventArgs e)
        {
            CreateAccountView createacctView = new CreateAccountView();
            //Need to add more to this view to return information about what went wrong for the user.
            //It will probably handle the showing of the reason why within itself, but I'm doing it here for now.

            DialogResult result = createacctView.ShowDialog(); //Will answer 'Was account created?'

            if (result == DialogResult.Yes)
            {
                loginBox.Text = createacctView.Username;
            }
        }