private void ConfirmOrCompletePasscode() { if (PasscodeBox.IsFocused) { if (PasscodeBox.Length > 0) { ConfirmPasscodeBox.Focus(); } } else if (ConfirmPasscodeBox.IsFocused) { ViewModel.ChangePassword(); } }
private void Passcode_OnKeyDown(object sender, KeyEventArgs e) { if (ViewModel.SelectedPasscodeType != null) { if (ViewModel.SelectedPasscodeType.Type == PasscodeType.Pin) { if (e.Key >= Key.D0 && e.Key <= Key.D9 || e.Key == Key.Back || e.Key == Key.Enter) { if (e.Key >= Key.D0 && e.Key <= Key.D9) { if (PasscodeBox.IsFocused && PasscodeBox.Length == 4 && ConfirmPasscodeBox.Length < 4) { ConfirmPasscodeBox.Focus(); } } } else { e.Handled = true; return; } } if (e.Key == Key.Enter) { ConfirmOrCompletePasscode(); } else if (e.Key == Key.Back) { if (ConfirmPasscodeBox.IsFocused && ConfirmPasscodeBox.Length == 0) { PasscodeBox.Focus(); } } } }