Beispiel #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
            AuthWindow authWindow = new AuthWindow();

            authWindow.Show();
        }
Beispiel #2
0
        private void Button_Reg_Click(object sender, RoutedEventArgs e)
        {
            string log   = LoginLabel.Text.Trim();
            string pass  = PassLabel.Password.Trim();
            string pass2 = PassLabel2.Password.Trim();
            string email = EmailLabel.Text.Trim().ToLower();

            if (log.Length < 5)
            {
                LoginLabel.ToolTip    = "Login must be more than 5 characters!";
                LoginLabel.Background = Brushes.MediumPurple;
            }
            else if (pass.Length < 5)
            {
                PassLabel.ToolTip    = "Password must be more than 5 characters!";
                PassLabel.Background = Brushes.MediumPurple;
            }
            else
            if (pass != pass2)
            {
                PassLabel2.ToolTip    = "Password mismatch!";
                PassLabel2.Background = Brushes.MediumPurple;
            }
            else
            if (email.Length < 5 || !email.Contains("@") || !email.Contains("."))
            {
                EmailLabel.ToolTip    = "Incorrect email!";
                EmailLabel.Background = Brushes.MediumPurple;
            }
            else
            {
                LoginLabel.ToolTip    = "";
                LoginLabel.Background = Brushes.Transparent;
                PassLabel.ToolTip     = "";
                PassLabel.Background  = Brushes.Transparent;
                PassLabel2.ToolTip    = "";
                PassLabel2.Background = Brushes.Transparent;
                EmailLabel.ToolTip    = "";
                EmailLabel.Background = Brushes.Transparent;
                MessageBox.Show("All is good!");

                User user = new User(log, email, pass);
                db.Users.Add(user);
                db.SaveChanges();
                AuthWindow authWindow = new AuthWindow();
                authWindow.Show();
                this.Hide();
            }
        }