/// <summary> /// Changed the pin. /// </summary> /// <param name="newPin">The pin.</param> private async void ChangePin(IWrappedValue <string> newPin) { if (string.IsNullOrWhiteSpace(newPin.Value) || newPin.Value.Length != 4) { ErrorMessage = "Invalid PIN code specified"; } var result = await _service.ChangePin(_provider.GetBankCardNumber(), _provider.CurrentPin, newPin.Value); _dispatcherAccessor.Dispatcher.Invoke( () => { if (result) { // store in context _provider.CurrentPin = newPin.Value; // reset on UI newPin.Value = null; // navigate to actions _regionManager.RequestNavigate(RegionName.MainRegion, ViewName.ActionsView); ErrorMessage = null; newPin.Value = null; } else { ErrorMessage = "PIN was not changed."; newPin.Value = null; } }); }