public override void ViewDidLoad() { base.ViewDidLoad(); var validator = new XForm<UITextField> { Inputs = new [] { new XUITextField { Name = I18n.FieldEmail, FieldView = inputEmail, Validators = new [] { new XValidatorRequired { Message = I18n.ValidationRequired } }, } } }; skipButton.TouchUpInside += (sender, e) => DismissViewController(true, null); forgotPasswordButton.TouchUpInside += (sender, e) => { if ( validator.Validate() ) { ShowHud(); ServiceProviderUser.Instance.ForgotPassword( inputEmail.Text, result => { HideHud(); DismissViewController(true, null); ShowAlert(I18n.SuccessMessageForgotPassword); }, errorMessage => { HideHud(); ShowAlert(errorMessage); } ); } else { ShowAlert(string.Join("\n",validator.Errors)); } }; }
bool ValidateField(UITextField field) { validator = new XForm<UITextField> { Inputs = new [] { new XUITextField { Name = I18n.FieldPassword, FieldView = field, Validators = new [] { new XValidatorLengthMinimum(5) { Message = I18n.ValidationLengthMinimum } }, } } }; return validator.Validate(); }