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");
                }
            }
        }
Example #2
0
        public SuggestionsPanel(QuestionsPanel questionsPanel, Account newAccount)
        {
            InitializeComponent();

            this._questionsPanel = questionsPanel;
            this._newAccount     = newAccount;

            this.Left = _questionsPanel.Left;
            this.Top  = _questionsPanel.Top;

            this.accountController = new();
            this.gameController    = new();

            this.selectedCategories = new();
            this.suggestedGames     = new();
            this.favoriteGameIds    = new();
            this._availableGames    = new();

            initSuggestedGames();
        }