public void Confirm() { if (_changePhoneNumber) { ConfirmChangePhoneNumber(); return; } IsWorking = true; StateService.PhoneCode = new TLString(Code); MTProtoService.ConfirmPhoneAsync( StateService.PhoneCodeHash, StateService.PhoneCode, auth => BeginOnUIThread(() => { var currentUser = CacheService.GetUser(new TLInt(StateService.CurrentUserId)); if (currentUser != null) { MessageBox.Show(string.Format(AppResources.CancelAccountResetSuccess, "+" + currentUser.Phone), AppResources.Success, MessageBoxButton.OK); } IsWorking = false; NavigationService.GoBack(); }), error => BeginOnUIThread(() => { _lastError = error; IsWorking = false; if (error.TypeEquals(ErrorType.PHONE_NUMBER_UNOCCUPIED)) { _callTimer.Stop(); StateService.ClearNavigationStack = true; StateService.SentCode = _sentCode; NavigationService.UriFor <SignUpViewModel>().Navigate(); } else if (error.TypeEquals(ErrorType.PHONE_CODE_INVALID)) { MessageBox.Show(AppResources.PhoneCodeInvalidString, AppResources.Error, MessageBoxButton.OK); } else if (error.TypeEquals(ErrorType.PHONE_CODE_EMPTY)) { MessageBox.Show(AppResources.PhoneCodeEmpty, AppResources.Error, MessageBoxButton.OK); } else if (error.TypeEquals(ErrorType.PHONE_CODE_EXPIRED)) { MessageBox.Show(AppResources.PhoneCodeExpiredString, AppResources.Error, MessageBoxButton.OK); OnBackKeyPress(); NavigationService.GoBack(); } else if (error.CodeEquals(ErrorCode.FLOOD)) { MessageBox.Show(AppResources.FloodWaitString + Environment.NewLine + "(" + error.Message + ")", AppResources.Error, MessageBoxButton.OK); } else { Telegram.Api.Helpers.Execute.ShowDebugMessage("account.signIn error " + error); } })); }