Exemplo n.º 1
0
 private void Login_Click(object sender, RoutedEventArgs e)
 {
     if (String.IsNullOrEmpty(TextBox1.Text))
     {
         this.Snack.IsActive        = false;
         this.Snack.Message.Content = "Insert a Valid Username";
         this.Snack.IsActive        = true;
     }
     else if (String.IsNullOrEmpty(PasswordBox1.Password))
     {
         this.Snack.IsActive        = false;
         this.Snack.Message.Content = "Insert a Valid Password";
         this.Snack.IsActive        = true;
     }
     else if (!Local_db.user_exists(TextBox1.Text))
     {
         this.Snack.IsActive        = false;
         this.Snack.Message.Content = "Invalid Username!";
         this.Snack.IsActive        = true;
     }
     else if (!Local_db.check_pass(TextBox1.Text, PasswordBox1.Password.ToString()))
     {
         this.Snack.IsActive        = false;
         this.Snack.Message.Content = "Invalid Password!";
         this.Snack.IsActive        = true;
     }
     else
     {
         AX_Loading loading = new AX_Loading();
         this.NavigationService.Navigate(loading);
     }
 }
Exemplo n.º 2
0
        private void Create_Click(object sender, RoutedEventArgs e)
        {
            Insert_user.username = TextBox2.Text;
            Insert_user.email = TextBox1.Text;
            Insert_user.password = PasswordBox1.Password.ToString();
            Regex sc = new Regex("@");

            if (String.IsNullOrEmpty(TextBox1.Text))
            {
                this.Snack.IsActive = false;
                this.Snack.Message.Content = "Insert a valid email!";
                this.Snack.IsActive = true;
            }
            else if (String.IsNullOrEmpty(TextBox2.Text))
            {
                this.Snack.IsActive = false;
                this.Snack.Message.Content = "Insert a valid username!";
                this.Snack.IsActive = true;
            }
            else if (String.IsNullOrEmpty(PasswordBox1.Password))
            {
                this.Snack.IsActive = false;
                this.Snack.Message.Content = "Insert a valid password!";
                this.Snack.IsActive = true;
            }
            else if (String.IsNullOrEmpty(PasswordBox2.Password))
            {
                this.Snack.IsActive = false;
                this.Snack.Message.Content = "Confirm password!";
                this.Snack.IsActive = true;
            }
            else if (PasswordBox1.Password.ToString() != PasswordBox2.Password.ToString())
            {
                this.Snack.IsActive = false;
                this.Snack.Message.Content = "Password must be equal!";
                this.Snack.IsActive = true;
            }
            else if (!sc.IsMatch(TextBox1.Text))
            {
                this.Snack.IsActive = false;
                this.Snack.Message.Content = "Insert a valid email!";
                this.Snack.IsActive = true;
            }
            else
            {
                Local_db.add_db(Insert_user.username, Insert_user.password, Insert_user.email);
                AX_Login login = new AX_Login();
                login.Snack.IsActive = false;
                login.Snack.Message.Content = "Account Created Successfully!";
                login.Snack.IsActive = true;
                this.NavigationService.Navigate(login);
            }
        }