Esempio n. 1
0
        private void PreviousButton(Object sender, RoutedEventArgs e)
        {
            _questionsPanel.Show();

            ResumePanelLocation();

            this.Hide();
        }
        private void nextButton(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(usernameTextbox.Text) ||
                String.IsNullOrEmpty(confirmPassBox.Password) ||
                String.IsNullOrEmpty(passwordBox.Password) ||
                String.IsNullOrEmpty(emailTextbox.Text))
            {
                CreateNotification("One or more fields are empty!", "warning");
            }
            else if (!util.IsValidEmail(emailTextbox.Text))
            {
                CreateNotification("Invalid email format!", "warning");
            }
            else if (!util.StrongPass(passwordBox.Password))
            {
                CreateNotification("Password is too weak!", "warning");
            }
            else
            {
                if (new AccountController().GetAccountByUsername(usernameTextbox.Text).username == null)
                {
                    if (passwordBox.Password.Equals(confirmPassBox.Password))
                    {
                        _newAccount.username = usernameTextbox.Text;
                        _newAccount.password = passwordBox.Password;
                        _newAccount.email    = emailTextbox.Text;
                        _newAccount.balance  = 0;

                        QuestionsPanel questionsPanel = new QuestionsPanel(this, _newAccount);
                        questionsPanel.Show();

                        this.Hide();
                    }
                    else
                    {
                        CreateNotification("Passwords must match!", "warning");
                    }
                }
                else
                {
                    CreateNotification("Username is already in use!", "warning");
                }
            }
        }