/// <summary> /// Invokes when user type the PIN or text changes in the hidden textbox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PINView_TextChanged(object sender, TextChangedEventArgs e) { PINValue = e.NewTextValue; if (e.NewTextValue.Length == PINLength) { PINEntryCompleted?.Invoke(this, new PINCompletedEventArgs(PINValue)); PINEntryCompletedCommand?.Execute(PINValue); // Dismiss the keyboard, once entry is completed up to the defined length and if AutoDismissKeyboard property is true if (AutoDismissKeyboard == true) { (sender as Entry).Unfocus(); } } }
/// <summary> /// Invokes when user type the PIN or text changes in the hidden textbox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void PINView_TextChanged(object sender, TextChangedEventArgs e) { PINValue = e.NewTextValue; if (e.NewTextValue.Length == PINLength) { // Dismiss the keyboard, once entry is completed up to the defined length and if AutoDismissKeyboard property is true if (AutoDismissKeyboard == true) { (sender as Entry).Unfocus(); } // To have some delay, before invoking any Action, otherwise, (if) while navigation, it will be quick and you won't see your last entry. await Task.Delay(200); PINEntryCompleted?.Invoke(this, new PINCompletedEventArgs(PINValue)); PINEntryCompletedCommand?.Execute(PINValue); } }
/// <summary> /// Invokes when user type the PIN, Assignes value to PINValue property or Text changes in the hidden textbox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void PINView_TextChanged(object sender, TextChangedEventArgs e) { PINValue = e.NewTextValue; // To have some delay so that till the next execution all assigned values to the properties in XAML gets sets and we get the right value at the time after this delay // Otherwise due to sequence of calls, some properties gets their actual assigned value after the completion of this event // Also To have some delay, before invoking any Action, otherwise, (if) while navigation, it will be quick and you won't see your last entry / or animation. await Task.Delay(200); if (e.NewTextValue.Length >= PINLength) { // Dismiss the keyboard, once entry is completed up to the defined length and if AutoDismissKeyboard property is true if (AutoDismissKeyboard == true) { (sender as Entry).Unfocus(); } PINEntryCompleted?.Invoke(this, new PINCompletedEventArgs(PINValue)); PINEntryCompletedCommand?.Execute(PINValue); } }