예제 #1
0
        private void AddButtonClick(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(PassText.Password))
            {
                PassText.Focus(FocusState.Keyboard);
                VisualUtilities.ShakeView(PassText);

                return;
            }
            else if (string.IsNullOrEmpty(RePassText.Password))
            {
                RePassText.Focus(FocusState.Keyboard);
                VisualUtilities.ShakeView(RePassText);
                return;
            }
            if (PassText.Password.Length == 4)
            {
                if (PassText.Password.All(x => x >= '0' && x <= '9') && Helper.Passcode.Check(PassText.Password))
                {
                }
                else
                {
                    PassText.Focus(FocusState.Keyboard);
                    VisualUtilities.ShakeView(PassText);
                    Helper.ShowNotify("Enter 4-digits numbers");
                    return;
                }
            }
            if (RePassText.Password.Length == 4)
            {
                if (RePassText.Password.All(x => x >= '0' && x <= '9') && Helper.Passcode.Check(RePassText.Password))
                {
                }
                else
                {
                    RePassText.Focus(FocusState.Keyboard);
                    VisualUtilities.ShakeView(RePassText);
                    Helper.ShowNotify("Enter 4-digits numbers");
                    return;
                }
            }
            {
                if (PassText.Password == RePassText.Password)
                {
                    Helper.Passcode.Set(PassText.Password);

                    Hide();
                }
                else
                {
                    VisualUtilities.ShakeView(RePassText);

                    RePassText.Focus(FocusState.Keyboard);
                }
            }
        }
예제 #2
0
        public async void Load()
        {
            try
            {
                if (await KeyCredentialManager.IsSupportedAsync())
                {
                    var result = await KeyCredentialManager.OpenAsync(Helper.AppName);

                    if (result.Credential != null)
                    {
                        var signResult = await result.Credential.RequestSignAsync(CryptographicBuffer.ConvertStringToBinary(DeviceHelper.PackageName, BinaryStringEncoding.Utf8));

                        if (signResult.Status == KeyCredentialStatus.Success)
                        {
                            Unlock();
                        }
                        else
                        {
                            BiometricsButton.Visibility = Visibility.Visible;
                        }
                    }
                    else
                    {
                        var creationResult = await KeyCredentialManager.RequestCreateAsync(Helper.AppName, KeyCredentialCreationOption.ReplaceExisting);

                        if (creationResult.Status == KeyCredentialStatus.Success)
                        {
                            Unlock();
                        }
                        else
                        {
                            BiometricsButton.Visibility = Visibility.Visible;
                        }
                    }
                }
                else
                {
                    PassText.Focus(FocusState.Keyboard);
                }
            }
            catch { }
        }