Esempio n. 1
0
        private void Create_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(UsernameBox.Text) || string.IsNullOrWhiteSpace(PasswordBox.Password) ||
                string.IsNullOrWhiteSpace(PasswordBox2.Password) || PasswordBox2.Password == "Account" ||
                PasswordBox.Password == "Account" || UsernameBox.Text == "Username")
            {
                allData.Visibility                  = Visibility.Visible;
                checkPasswords.Visibility           = Visibility.Collapsed;
                checkUsernameAndPassword.Visibility = Visibility.Collapsed;
                accountCreated.Visibility           = Visibility.Collapsed;
                userExists.Visibility               = Visibility.Collapsed;
            }
            else if (PasswordBox.Password != PasswordBox2.Password)
            {
                allData.Visibility                  = Visibility.Collapsed;
                checkPasswords.Visibility           = Visibility.Visible;
                checkUsernameAndPassword.Visibility = Visibility.Collapsed;
                accountCreated.Visibility           = Visibility.Collapsed;
                userExists.Visibility               = Visibility.Collapsed;
            }
            else
            {
                if (!read.ThatUserExist(UsernameBox.Text))
                {
                    write.AddUser(UsernameBox.Text, PasswordBox.Password);

                    allData.Visibility                  = Visibility.Collapsed;
                    checkPasswords.Visibility           = Visibility.Collapsed;
                    checkUsernameAndPassword.Visibility = Visibility.Collapsed;
                    accountCreated.Visibility           = Visibility.Visible;
                    userExists.Visibility               = Visibility.Collapsed;
                }
                else
                {
                    allData.Visibility                  = Visibility.Collapsed;
                    checkPasswords.Visibility           = Visibility.Collapsed;
                    checkUsernameAndPassword.Visibility = Visibility.Collapsed;
                    accountCreated.Visibility           = Visibility.Collapsed;
                    userExists.Visibility               = Visibility.Visible;
                }

                UsernameBox.Text      = "Username";
                PasswordBox.Password  = "******";
                PasswordBox2.Password = PasswordBox.Password;
            }
        }