Пример #1
0
        private void CreateAccount_btn_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (CreateAccount_btn.IsEnabled)
            {
                //Create a new account
                if (!Properties.Settings.Default.FirstTime)
                {
                    System.Windows.Forms.MessageBox.Show("PCC Student Database System does not allow you to configure multiple accounts on the same computer / server. Please use the 'Login' option to log in to your current account. If you're having problems signing to your account, please contact the Ultra Admin from the link given in the bottom right corner.", "Does not allow multiple accounts", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
                }
                else
                {
                    CreateAccountGrid.Margin = new Thickness(405, 0, 0, 0);

                    DoubleAnimation da = new DoubleAnimation();
                    da.From           = 0;
                    da.To             = 1;
                    da.Duration       = TimeSpan.FromSeconds(1);
                    da.EasingFunction = new QuinticEase();

                    SignUpCancelButton.IsEnabled = true;

                    CreateUserName.Focus();

                    CreateAccountGrid.BeginAnimation(OpacityProperty, da);
                }
            }
        }
Пример #2
0
 private void AlreadyHaveAccount_Clicked(object sender, EventArgs e)
 {
     CreateAccountGrid.FadeTo(0, 1000);
     CreateAccountGrid.IsVisible = false;
     SignInGrid.IsVisible        = true;
     SignInGrid.FadeTo(1, 1000);
 }
Пример #3
0
        private async void SignUp_Clicked(object sender, EventArgs e)
        {
            CreateAccountError.IsVisible = false;
            if (string.IsNullOrEmpty(NewEmailEntry.Text) || string.IsNullOrEmpty(NewPasswordEntry.Text) || string.IsNullOrEmpty(NewPasswordConfirmEntry.Text))
            {
                CreateAccountError.Text      = "Please fill in all fields.";
                CreateAccountError.IsVisible = true;
                return;
            }
            else if (!RegexHelper.IsValidEmail(NewEmailEntry.Text))
            {
                CreateAccountError.Text      = "Please enter a valid email address.";
                CreateAccountError.IsVisible = true;
                return;
            }
            else if (string.Compare(NewPasswordEntry.Text, NewPasswordConfirmEntry.Text) != 0)
            {
                CreateAccountError.Text      = "The two passwords do not match. Please try Again.";
                CreateAccountError.IsVisible = true;
                return;
            }
            else if (NewPasswordEntry.Text.Length < 8 || !NewPasswordEntry.Text.Any(char.IsDigit) || !NewPasswordEntry.Text.Any(char.IsUpper) || !NewPasswordEntry.Text.Any(char.IsLower))
            {
                CreateAccountError.Text      = "Your password must be at least 8 characters with an upercase letter, lowercase letter and a number";
                CreateAccountError.IsVisible = true;
                return;
            }
            Loading.IsVisible = true;
            CognitoContext context = await _cognitoHelper.SignUp(NewEmailEntry.Text.ToLower(), NewPasswordEntry.Text);

            switch (context.Result)
            {
            case CognitoResult.PasswordRequirementsFailed:
                CreateAccountError.Text      = "Your password must be at least 8 characters with an upercase letter, lowercase letter and a number";
                CreateAccountError.IsVisible = true;
                Loading.IsVisible            = false;
                break;

            case CognitoResult.UserNameAlreadyUsed:
                CreateAccountError.Text      = "There is already an account using that email address.";
                CreateAccountError.IsVisible = true;
                Loading.IsVisible            = false;
                break;

            case CognitoResult.SignupOk:
                Loading.IsVisible = false;
                CreateAccountGrid.FadeTo(0, 1000);
                CreateAccountGrid.IsVisible = false;
                ConfirmEmailGrid.IsVisible  = true;
                ConfirmEmailGrid.FadeTo(1, 1000);
                break;

            default:
                CreateAccountError.Text      = "Something went wrong. Please try again later.";
                CreateAccountError.IsVisible = true;
                Loading.IsVisible            = false;
                break;
            }
        }
Пример #4
0
        private void SignUpCancelButton_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            DoubleAnimation da = new DoubleAnimation();

            da.From           = 1;
            da.To             = 0;
            da.Duration       = TimeSpan.FromSeconds(1);
            da.EasingFunction = new QuinticEase();
            da.Completed     += Da_Completed;

            SignUpCancelButton.IsEnabled = false;

            CreateAccountGrid.BeginAnimation(OpacityProperty, da);
        }