コード例 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (!string.IsNullOrEmpty(_name))
            {
                Name.Text = _name;
            }
            if (!string.IsNullOrEmpty(_content))
            {
                Text.Text = _content;
            }

            Text.Changed += HandleChanged;
            UpdateScrollContentSize();

            var v = NameView as TappableView;

            if (v != null)
            {
                v.Tapped = () => {
                    Name.BecomeFirstResponder();
                };
            }
        }
コード例 #2
0
        private bool CheckFields()
        {
            if (DescriptionText.Text.Trim() == "")
            {
                checkFormMessage = LangEnglish.DescriptionEmpty;
                DescriptionText.BecomeFirstResponder();
                return(false);
            }
            if (DescriptionText.Text.Substring(DescriptionText.Text.Length - 1) == "\\")
            {
                checkFormMessage = LangEnglish.DescriptionBackslash;
                DescriptionText.BecomeFirstResponder();
                return(false);
            }

            if (AccountDataSection.Frame.Height != 0)
            {
                if (Email.Text.Trim() == "")
                {
                    checkFormMessage = LangEnglish.EmailEmpty;
                    Email.BecomeFirstResponder();
                    return(false);
                }
                //If the extension is long, the regex will freeze the app.
                int lastDotPos = Email.Text.LastIndexOf(".");
                if (lastDotPos < Email.Text.Length - 5)
                {
                    checkFormMessage = LangEnglish.EmailWrong;
                    return(false);
                }
                Regex regex = new Regex(Constants.EmailFormat); //when the email extension is long, it will take ages for the regex to finish
                if (!regex.IsMatch(Email.Text))
                {
                    checkFormMessage = LangEnglish.EmailWrong;
                    Email.BecomeFirstResponder();
                    return(false);
                }
                if (Username.Text.Trim() == "")
                {
                    checkFormMessage = LangEnglish.UsernameEmpty;
                    Username.BecomeFirstResponder();
                    return(false);
                }
                if (Username.Text.Trim().Substring(Username.Text.Trim().Length - 1) == "\\")
                {
                    checkFormMessage = LangEnglish.UsernameBackslash;
                    Username.BecomeFirstResponder();
                    return(false);
                }
                if (Name.Text.Trim() == "")
                {
                    checkFormMessage = LangEnglish.NameEmpty;
                    Name.BecomeFirstResponder();
                    return(false);
                }
                if (Name.Text.Trim().Substring(Name.Text.Trim().Length - 1) == "\\")
                {
                    checkFormMessage = LangEnglish.NameBackslash;
                    Name.BecomeFirstResponder();
                    return(false);
                }
            }

            if (ChangePasswordSection.Frame.Height != 0)
            {
                if (OldPassword.Text.Trim().Length < 6)
                {
                    checkFormMessage = LangEnglish.PasswordShort;
                    OldPassword.BecomeFirstResponder();
                    return(false);
                }
                if (NewPassword.Text.Trim().Length < 6)
                {
                    checkFormMessage = LangEnglish.PasswordShort;
                    NewPassword.BecomeFirstResponder();
                    return(false);
                }
                if (OldPassword.Text.Trim() == NewPassword.Text.Trim())
                {
                    checkFormMessage = LangEnglish.PasswordNotChanged;
                    NewPassword.BecomeFirstResponder();
                    return(false);
                }
                if (NewPassword.Text.Trim() != ConfirmPassword.Text.Trim())
                {
                    checkFormMessage = LangEnglish.ConfirmPasswordNoMatch;
                    ConfirmPassword.BecomeFirstResponder();
                    return(false);
                }
            }
            return(true);
        }
コード例 #3
0
 public override void ViewWillAppear(bool animated)
 {
     base.ViewWillAppear(animated);
     NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIKeyboardWillShowNotification"), KeyboardWillShow);
     Name.BecomeFirstResponder();
 }
コード例 #4
0
        private bool CheckFields() //need to resize window on keyboard appereance, otherwise Snackbar will be covered
        {
            if (Sex.SelectedRowInComponent(0) == 0)
            {
                checkFormMessage = LangEnglish.SexEmpty;
                Sex.BecomeFirstResponder();
                return(false);
            }
            if (Email.Text.Trim() == "")
            {
                checkFormMessage = LangEnglish.EmailEmpty;
                Email.BecomeFirstResponder();
                return(false);
            }
            int lastDotPos = Email.Text.LastIndexOf(".");

            if (lastDotPos < Email.Text.Length - 5)
            {
                checkFormMessage = LangEnglish.EmailWrong;
                Email.BecomeFirstResponder();
                return(false);
            }
            //If the extension is long, the regex will freeze the app.
            Regex regex = new Regex(Constants.EmailFormat);

            if (!regex.IsMatch(Email.Text))
            {
                checkFormMessage = LangEnglish.EmailWrong;
                Email.BecomeFirstResponder();
                return(false);
            }
            if (Password.Text.Trim().Length < 6)
            {
                checkFormMessage = LangEnglish.PasswordShort;
                Password.BecomeFirstResponder();
                return(false);
            }
            if (Password.Text.Trim() != ConfirmPassword.Text.Trim())
            {
                checkFormMessage = LangEnglish.ConfirmPasswordNoMatch;
                ConfirmPassword.BecomeFirstResponder();
                return(false);
            }
            if (Username.Text.Trim() == "")
            {
                checkFormMessage = LangEnglish.UsernameEmpty;
                Username.BecomeFirstResponder();
                return(false);
            }
            if (Username.Text.Trim().Substring(Username.Text.Trim().Length - 1) == "\\")
            {
                checkFormMessage = LangEnglish.UsernameBackslash;
                return(false);
            }
            if (Name.Text.Trim() == "")
            {
                checkFormMessage = LangEnglish.NameEmpty;
                Name.BecomeFirstResponder();
                return(false);
            }
            if (Name.Text.Trim().Substring(Name.Text.Trim().Length - 1) == "\\")
            {
                checkFormMessage = LangEnglish.NameBackslash;
                return(false);
            }
            if (rc.uploadedImages.Count == 0)
            {
                checkFormMessage = LangEnglish.ImagesEmpty;
                Images.BecomeFirstResponder();
                return(false);
            }
            if (DescriptionText.Text.Trim() == "")
            {
                checkFormMessage = LangEnglish.DescriptionEmpty;
                DescriptionText.BecomeFirstResponder();
                return(false);
            }
            if (DescriptionText.Text.Substring(DescriptionText.Text.Length - 1) == "\\")
            {
                checkFormMessage = LangEnglish.DescriptionBackslash;
                return(false);
            }
            return(true);
        }