async void RegisterPin(object sender, EventArgs e) { progress.IsVisible = true; FrameBtnLogin.IsVisible = false; //код var code = EntryCode.Text; if (string.IsNullOrWhiteSpace(code)) { await DisplayAlert(AppResources.ErrorTitle, AppResources.EnterCode, "OK"); progress.IsVisible = false; FrameBtnLogin.IsVisible = true; return; } int c0; var isInt0 = int.TryParse(code, out c0); if (!isInt0) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorOSSAuthNotNumber, "OK"); progress.IsVisible = false; FrameBtnLogin.IsVisible = true; return; } if (c0 < 0) { await DisplayAlert(AppResources.ErrorTitle, $"{AppResources.ErrorOSSAuthPositive} \"{AppResources.CodeField}\"", "OK"); progress.IsVisible = false; FrameBtnLogin.IsVisible = true; return; } int c; var isInt = int.TryParse(EntryPin0.Text, out c); if (!isInt) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorOSSAuthNotNumber, "OK"); progress.IsVisible = false; FrameBtnLogin.IsVisible = true; return; } if (c < 0) { await DisplayAlert(AppResources.ErrorTitle, $"{AppResources.ErrorOSSAuthPositive} \"{AppResources.PinField}\"", "OK"); progress.IsVisible = false; FrameBtnLogin.IsVisible = true; return; } int c1; var isInt1 = int.TryParse(EntryPin.Text, out c1); if (!isInt1) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorOSSAuthNotNumber, "OK"); progress.IsVisible = false; FrameBtnLogin.IsVisible = true; return; } if (c1 < 0) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorOSSAuthPositive, "OK"); progress.IsVisible = false; FrameBtnLogin.IsVisible = true; return; } if (string.IsNullOrWhiteSpace(EntryPin0.Text) || string.IsNullOrWhiteSpace(EntryPin.Text)) { //пин не введен await DisplayAlert(AppResources.ErrorTitle, AppResources.EnterBothPins, "OK"); progress.IsVisible = false; FrameBtnLogin.IsVisible = true; return; } if (EntryPin0.Text != EntryPin.Text) { //введенный пин не совпадает await DisplayAlert(AppResources.ErrorTitle, AppResources.PinsDifferent, "OK"); progress.IsVisible = false; FrameBtnLogin.IsVisible = true; return; } //сохраняем пин на сервер, вместе с проверочным кодом var rez = await rc.OSSSavePin(Settings.Person.Phone, code, EntryPin0.Text); if (!string.IsNullOrWhiteSpace(rez.Error)) { await DisplayAlert(AppResources.ErrorTitle, rez.Error, "OK"); progress.IsVisible = false; FrameBtnLogin.IsVisible = true; return; } progress.IsVisible = false; FrameBtnLogin.IsVisible = true; //далее переход на форму голосования, или на форму ввода пина OpenPage(new OSSAuth()); }