public override void ViewDidLoad() { _didShowNotificationObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, KeyBoardDidShow, this); _willHideNotificationObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, KeyBoardWillHide, this); ActivityIndicator.StopAnimating(); this.LoginField.ShouldReturn += (textField) => textField.ResignFirstResponder(); this.PasswordField.ShouldReturn += (textField) => textField.ResignFirstResponder(); this.AdressField.ShouldReturn += (textField) => textField.ResignFirstResponder(); this.PhoneNumberField.ShouldReturn += (textField) => textField.ResignFirstResponder(); this.View.AddGestureRecognizer(new UITapGestureRecognizer(() => { LoginField.ResignFirstResponder(); PasswordField.ResignFirstResponder(); AdressField.ResignFirstResponder(); PhoneNumberField.ResignFirstResponder(); })); RegistrationButton.TouchUpInside += async(sender, e) => { Customers registrationFieldsForAsync = new Customers() { Name = LoginField.Text, Password = PasswordField.Text, Adress = AdressField.Text, PhoneNumber = PhoneNumberField.Text }; ActivityIndicator.StartAnimating(); try { RegistrationButton.Enabled = false; LoginAndPasswordCheck.LoginCheck(registrationFieldsForAsync.Name); LoginAndPasswordCheck.PasswordCheck(registrationFieldsForAsync.Password); LoginAndPasswordCheck.AdressCheck(registrationFieldsForAsync.Adress); LoginAndPasswordCheck.PhoneCheck(registrationFieldsForAsync.PhoneNumber); await UsersCheckClass.TryToRegister(registrationFieldsForAsync); AppDelegate.UserName = registrationFieldsForAsync.Name; PerformSegue("RegistrationSegue", null); } catch (FiledsCheckException e1) { ActivityIndicator.StopAnimating(); RegistrationButton.Enabled = true; PresentViewController(GetAlertsClass.GetAlert(e1.Message), true, null); } catch (UserCheckClassException e1) { ActivityIndicator.StopAnimating(); RegistrationButton.Enabled = true; PresentViewController(GetAlertsClass.GetAlert(e1.Message), true, null); } catch { ActivityIndicator.StopAnimating(); RegistrationButton.Enabled = true; PresentViewController(GetAlertsClass.GetAlert("Не удалось подключиться к серверу"), true, null); } }; }
void ReleaseDesignerOutlets() { if (ActivityIndicator != null) { ActivityIndicator.Dispose(); ActivityIndicator = null; } if (AdressField != null) { AdressField.Dispose(); AdressField = null; } if (LoginField != null) { LoginField.Dispose(); LoginField = null; } if (PasswordField != null) { PasswordField.Dispose(); PasswordField = null; } if (PhoneNumberField != null) { PhoneNumberField.Dispose(); PhoneNumberField = null; } if (RegistrationButton != null) { RegistrationButton.Dispose(); RegistrationButton = null; } }