public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            UITextFieldCondition firstCondition = new UITextFieldCondition (delegate {
                txtFirstName.ResignFirstResponder();
                return false;
            });
            txtFirstName.ShouldReturn = firstCondition;

            UITextFieldCondition secondCondition = new UITextFieldCondition (delegate {
                txtSurname.ResignFirstResponder();
                return false;
            });
            txtSurname.ShouldReturn = secondCondition;

            UITextFieldCondition emailCondition = new UITextFieldCondition (delegate {
                txtEMail.ResignFirstResponder();
                return false;
            });
            txtEMail.ShouldReturn = emailCondition;

            UITextFieldCondition mobileCondition = new UITextFieldCondition (delegate {
                txtMobile.ResignFirstResponder();
                return false;
            });
            txtMobile.ShouldReturn = mobileCondition;

            btnUpdate.TouchUpInside += (object sender, EventArgs e) => {
                DataLayer dl = new DataLayer();
                string gender = "Female";
                if (segGender.SelectedSegment == 1)
                    gender = "Male";
                if (PersonID == 0)
                {
                    List<Person> duplicates = dl.getPersonByName(txtFirstName.Text, txtSurname.Text);
                    if (duplicates.Count > 0)
                        PersonID = duplicates[0].ID;
                }
                PersonID = dl.updatePerson(PersonID, dl.GetCampusID(), txtFirstName.Text, txtSurname.Text, gender, dpDoB.Date,txtMobile.Text, txtEMail.Text, 0);
                if (Relationship != 0)
                {
                    switch (Relationship)
                    {
                    case 1:
                        dl.updateSpouse1(MarriedRelionshipID, PersonID);
                        break;
                    case 2:
                        dl.updateSpouse2(MarriedRelionshipID, PersonID);
                        break;
                    default:
                        dl.createParentRelationship(MarriedRelionshipID, PersonID, false);
                        break;
                    }
                }

                UINavigationController parent = this.NavigationController;
                parent.PopViewControllerAnimated(true);
            };
        }
示例#2
0
            public bool ShouldReturn(UITextField textField)
            {
                UITextFieldCondition handler = shouldReturn;

                if (handler != null)
                {
                    return(handler(textField));
                }
                return(true);
            }
        public BareMvvmUIViewController()
        {
            base.View.BackgroundColor = UIColorCompat.SystemBackgroundColor;

            _shouldReturnCondition = new UITextFieldCondition(ShouldReturn);

#if DEBUG
            ActiveViewControllers.Track(this);
#endif
        }
        /// <summary>
        /// Method to override when the behavior is attached to the view.
        /// </summary>
        /// <exception cref="System.InvalidOperationException">ApplicationContext property needs to be set in order to use this behavior.</exception>
        protected override void OnAttached()
        {
            _hideKeyboardCondition = sender =>
            {
                sender.ResignFirstResponder();

                return(false);
            };

            this.AssociatedObject.ShouldReturn = _hideKeyboardCondition;
        }
示例#5
0
        public override void ViewDidLoad()
        {
            UITextFieldCondition shouldReturnLambda = (UITextField textField) =>
            {
                textField.ResignFirstResponder();
                return(true);
            };

            ServerIPTextField.ShouldReturn   += shouldReturnLambda;
            ServerPortTextField.ShouldReturn += shouldReturnLambda;
            PackageCount.ShouldReturn        += shouldReturnLambda;
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
        }
示例#6
0
        public static IObservable <Unit> ShouldReturn(this IReactive <UITextField> reactive, bool shouldResignFirstResponder = true)
        {
            return(Observable.Create <Unit>(observer =>
            {
                UITextFieldCondition shouldReturn = (UITextField textField) =>
                {
                    if (shouldResignFirstResponder)
                    {
                        textField.ResignFirstResponder();
                    }

                    observer.OnNext(Unit.Default);
                    return true;
                };

                reactive.Base.ShouldReturn += shouldReturn;

                return Disposable.Create(() =>
                {
                    reactive.Base.ShouldReturn -= shouldReturn;
                });
            }));
        }