Пример #1
0
        private async void PwdSignInOkButton_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            if (this.PwdSignInTextBox.Password.Trim().Length < 8 || this.PwdSignInTextBox.Password.Trim().Length > 24)
            {
                messageDialog.Content = "Sorry, password match failed!\n\nFurthermore, password length must be between 8 and 24 characters.\nIn practical application I may not tell you this other than prompting invalid password.\n\nNote also that leading and trailing white spaces will be truncated.";
                await messageDialog.ShowAsync();

                return;
            }

            if (secretHelper.ReadSecret("demo") == string.Empty)
            {
                messageDialog.Content          = messageDialog.Content = "Sorry, password match failed!\n\nIn fact, there is no stored password and in practical application I won't tell you this.";
                this.PwdSignInTextBox.Password = string.Empty;
            }
            else if (secretHelper.ReadSecret("demo") == this.PwdSignInTextBox.Password.Trim())
            {
                messageDialog.Content          = "Password matched! Consider that you've signed in!";
                this.PwdSignInTextBox.Password = string.Empty;
            }
            else
            {
                messageDialog.Content = messageDialog.Content = "Sorry, password match failed!\n\nYou know already that, with this simplistic demo, you can reset your password in the step above ;-)";
            }

            await messageDialog.ShowAsync();
        }