Esempio n. 1
0
        private void GestureGecognizer()
        {
            var gestureRecognizer = new UITapGestureRecognizer(() =>
            {
                FirstNameTextField.ResignFirstResponder();
                LastNameTextField.ResignFirstResponder();
                EmailTextField.ResignFirstResponder();
                PasswordTextField.ResignFirstResponder();
                ConfirmPasswordTextField.ResignFirstResponder();
                PhoneNumberTextField.ResignFirstResponder();
            });

            View.AddGestureRecognizer(gestureRecognizer);
        }
        protected override bool ValidateAllFields()
        {
            string phoneNumber = StringUtils.RemoveNonIntegers(PhoneNumberTextField.Text.Trim());

            bool allFieldsValid = true;

            if (String.IsNullOrEmpty(phoneNumber) || phoneNumber.Length < 10 || phoneNumber.Length > 11)
            {
                PhoneNumberTextField.SetInvalid();
                allFieldsValid = false;
            }

            return(allFieldsValid);
        }
        void ReleaseDesignerOutlets()
        {
            if (ConfirmPasswordTextField != null)
            {
                ConfirmPasswordTextField.Dispose();
                ConfirmPasswordTextField = null;
            }

            if (EmailTextField != null)
            {
                EmailTextField.Dispose();
                EmailTextField = null;
            }

            if (FirstNameTextField != null)
            {
                FirstNameTextField.Dispose();
                FirstNameTextField = null;
            }

            if (LastNameTextField != null)
            {
                LastNameTextField.Dispose();
                LastNameTextField = null;
            }

            if (PasswordTextField != null)
            {
                PasswordTextField.Dispose();
                PasswordTextField = null;
            }

            if (PhoneNumberTextField != null)
            {
                PhoneNumberTextField.Dispose();
                PhoneNumberTextField = null;
            }

            if (RegistrationNavigationBar != null)
            {
                RegistrationNavigationBar.Dispose();
                RegistrationNavigationBar = null;
            }

            if (RegistrationNavigationItem != null)
            {
                RegistrationNavigationItem.Dispose();
                RegistrationNavigationItem = null;
            }
        }
 void ReleaseDesignerOutlets()
 {
     if (AddressLine1TextField != null)
     {
         AddressLine1TextField.Dispose();
         AddressLine1TextField = null;
     }
     if (AddressLine2TextField != null)
     {
         AddressLine2TextField.Dispose();
         AddressLine2TextField = null;
     }
     if (AddressLine3TextField != null)
     {
         AddressLine3TextField.Dispose();
         AddressLine3TextField = null;
     }
     if (AlternatePhoneNumberTextField != null)
     {
         AlternatePhoneNumberTextField.Dispose();
         AlternatePhoneNumberTextField = null;
     }
     if (CityTextField != null)
     {
         CityTextField.Dispose();
         CityTextField = null;
     }
     if (CountryTextField != null)
     {
         CountryTextField.Dispose();
         CountryTextField = null;
     }
     if (PhoneNumberTextField != null)
     {
         PhoneNumberTextField.Dispose();
         PhoneNumberTextField = null;
     }
     if (StateTextField != null)
     {
         StateTextField.Dispose();
         StateTextField = null;
     }
     if (ZipCodeTextField != null)
     {
         ZipCodeTextField.Dispose();
         ZipCodeTextField = null;
     }
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            RemoveBackBarButtonTitle();

            PhoneNumberTextField.KeyboardType       = UIKeyboardType.PhonePad;
            PhoneNumberTextField.Placeholder        = Strings.Basic.phone_placeholder;
            PhoneNumberTextField.AutocorrectionType = UITextAutocorrectionType.No;
            PhoneNumberTextField.BecomeFirstResponder();
            PhoneNumberTextField.EditingDidEndOnExit += (sender, e) =>
            {
                PhoneNumberTextField.ResignFirstResponder();
            };
            SetProgressButton(ValidateButton);
        }
        void ReleaseDesignerOutlets()
        {
            if (CreateAccountButton != null)
            {
                CreateAccountButton.Dispose();
                CreateAccountButton = null;
            }

            if (FirstNameTextField != null)
            {
                FirstNameTextField.Dispose();
                FirstNameTextField = null;
            }

            if (LastNameTextField != null)
            {
                LastNameTextField.Dispose();
                LastNameTextField = null;
            }

            if (PasswordTextField != null)
            {
                PasswordTextField.Dispose();
                PasswordTextField = null;
            }

            if (PhoneNumberTextField != null)
            {
                PhoneNumberTextField.Dispose();
                PhoneNumberTextField = null;
            }

            if (ServiceStartDateTextField != null)
            {
                ServiceStartDateTextField.Dispose();
                ServiceStartDateTextField = null;
            }

            if (UsernameTextField != null)
            {
                UsernameTextField.Dispose();
                UsernameTextField = null;
            }
        }
Esempio n. 7
0
        void ReleaseDesignerOutlets()
        {
            if (PhoneNumberTextField != null)
            {
                PhoneNumberTextField.Dispose();
                PhoneNumberTextField = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (ValidateButton != null)
            {
                ValidateButton.Dispose();
                ValidateButton = null;
            }
        }
        async partial void ValidateButtonClicked(Foundation.NSObject sender)
        {
            View.EndEditing(true);

            string phoneNumber = StringUtils.RemoveNonIntegers(PhoneNumberTextField.Text.Trim());

            phoneNumber = StringUtils.RemoveLeadingSymbol(phoneNumber, "1");

            bool allFieldsValid = ValidateAllFields();

            if (!allFieldsValid)
            {
                return;
            }

            ShowHud(Strings.Hud.please_wait);

            try
            {
                var result = await TwilioServices.StartPhoneVerificationAsync(phoneNumber);

                if (result != null && result.success && result.is_cellphone)
                {
                    var vc = new EnterPhoneNumberVerificationCodeViewController();
                    vc.PhoneNumber = phoneNumber;
                    NavigationController.PushViewController(vc, true);
                }
                else
                {
                    PhoneNumberTextField.SetInvalid();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }

            HideHud();
        }
        void ReleaseDesignerOutlets()
        {
            if (AboutButton != null)
            {
                AboutButton.Dispose();
                AboutButton = null;
            }

            if (btnPickerView != null)
            {
                btnPickerView.Dispose();
                btnPickerView = null;
            }

            if (CountryCodeLabel != null)
            {
                CountryCodeLabel.Dispose();
                CountryCodeLabel = null;
            }

            if (CountryCodeTextField != null)
            {
                CountryCodeTextField.Dispose();
                CountryCodeTextField = null;
            }

            if (CreditsFreeLabel != null)
            {
                CreditsFreeLabel.Dispose();
                CreditsFreeLabel = null;
            }

            if (CreditsUserLabel != null)
            {
                CreditsUserLabel.Dispose();
                CreditsUserLabel = null;
            }

            if (CustomViewScroll != null)
            {
                CustomViewScroll.Dispose();
                CustomViewScroll = null;
            }

            if (EmailTextField != null)
            {
                EmailTextField.Dispose();
                EmailTextField = null;
            }

            if (EmailTitleLabel != null)
            {
                EmailTitleLabel.Dispose();
                EmailTitleLabel = null;
            }

            if (FirstNameLabel != null)
            {
                FirstNameLabel.Dispose();
                FirstNameLabel = null;
            }

            if (FirstNameTextField != null)
            {
                FirstNameTextField.Dispose();
                FirstNameTextField = null;
            }

            if (LastNameLabel != null)
            {
                LastNameLabel.Dispose();
                LastNameLabel = null;
            }

            if (LastNameTextField != null)
            {
                LastNameTextField.Dispose();
                LastNameTextField = null;
            }

            if (LogOutButton != null)
            {
                LogOutButton.Dispose();
                LogOutButton = null;
            }

            if (MaxSizeEmailID != null)
            {
                MaxSizeEmailID.Dispose();
                MaxSizeEmailID = null;
            }

            if (MaxSizeFirstName != null)
            {
                MaxSizeFirstName.Dispose();
                MaxSizeFirstName = null;
            }

            if (MaxSizeName != null)
            {
                MaxSizeName.Dispose();
                MaxSizeName = null;
            }

            if (ModifyUserImageButton != null)
            {
                ModifyUserImageButton.Dispose();
                ModifyUserImageButton = null;
            }

            if (PhoneNumberLabel != null)
            {
                PhoneNumberLabel.Dispose();
                PhoneNumberLabel = null;
            }

            if (PhoneNumberTextField != null)
            {
                PhoneNumberTextField.Dispose();
                PhoneNumberTextField = null;
            }

            if (SaveButton != null)
            {
                SaveButton.Dispose();
                SaveButton = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (UpdatePasswordButton != null)
            {
                UpdatePasswordButton.Dispose();
                UpdatePasswordButton = null;
            }

            if (UserImageView != null)
            {
                UserImageView.Dispose();
                UserImageView = null;
            }
        }
Esempio n. 10
0
        public override void SetDataAndStyleToView()
        {
            Title = Application.LocalizedString("ParameterTitle");
            InitialiseAllStrings();

            // round corner on the button modify the image of the user
            ModifyUserImageButton.Layer.CornerRadius = 4;
            ModifyUserImageButton.Layer.BorderWidth  = 1;
            ModifyUserImageButton.Layer.BorderColor  = UIColor.FromRGBA(98, 218, 115, 255).CGColor;
            ModifyUserImageButton.ContentEdgeInsets  = new UIEdgeInsets(5, 10, 5, 10);

            SaveButton.Layer.CornerRadius  = 4;
            SaveButton.Layer.MasksToBounds = true;
            AboutButton.Enabled            = true;
            LogOutButton.Enabled           = true;
            EmailTextField.Enabled         = false;

            // Free Credits Details
            RefreshDisplayedCreditCount();

            FirstNameTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; };
            FirstNameTextField.ShouldReturn   += (textField) =>
            {
                FirstNameTextField.ResignFirstResponder();
                return(true);
            };

            LastNameTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; };
            LastNameTextField.ShouldReturn   += (textField) =>
            {
                LastNameTextField.ResignFirstResponder();
                _hasDataChanged = true;
                return(true);
            };

            EmailTextField.EditingChanged += (o, e) =>
            {
                _hasDataChanged    = true;
                SaveButton.Enabled = true;
                EmailTextField.AutocorrectionType = UITextAutocorrectionType.No;
            };

            EmailTextField.ShouldReturn += (textField) =>
            {
                EmailTextField.ResignFirstResponder();
                _hasDataChanged = true;
                return(true);
            };

            CountryCodeTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; };
            CountryCodeTextField.ShouldReturn   += (textField) =>
            {
                CountryCodeTextField.ResignFirstResponder();
                _hasDataChanged = true;
                return(true);
            };

            PhoneNumberTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; };
            PhoneNumberTextField.ShouldReturn   += (textField) =>
            {
                PhoneNumberTextField.ResignFirstResponder();
                _hasDataChanged = true;
                return(true);
            };

            var toolbar = new UIToolbar();

            toolbar.BarStyle    = UIBarStyle.Default;
            toolbar.Translucent = true;
            toolbar.SizeToFit();

            // Done button
            var doneButton = new UIBarButtonItem(Application.LocalizedString("Validate"), UIBarButtonItemStyle.Done, (s, e) =>
            {
                PhoneNumberTextField.ResignFirstResponder();
            });

            toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true);
            PhoneNumberTextField.InputAccessoryView = toolbar;
            PhoneNumberTextField.InputAccessoryView = toolbar;
            PhoneNumberTextField.InputAccessoryView = toolbar;

            FirstNameTextField.Text           = App.CurrentUserEnvironment.User.FirstName;
            LastNameTextField.Text            = App.CurrentUserEnvironment.User.LastName;
            EmailTextField.Text               = App.CurrentUserEnvironment.User.Email;
            PhoneNumberTextField.KeyboardType = UIKeyboardType.DecimalPad;
            //if (!string.IsNullOrEmpty(App.CurrentUserEnvironment.User.PhoneNumber))
            //{
            //    var phoneNumber = App.CurrentUserEnvironment.User.PhoneNumber.Split('|');
            //    if (phoneNumber != null && phoneNumber.Length == 2)
            //    {
            //        if (phoneNumber[0].Contains("+"))
            //        {
            //            phoneNumber[0] = phoneNumber[0].Substring(1, phoneNumber[0].Length - 1);
            //        }
            //        CountryCodeTextField.Text = phoneNumber[0];
            //        PhoneNumberTextField.Text = phoneNumber[1];
            //    }
            //}
            UserImageView.Layer.CornerRadius = UserImageView.Frame.Size.Width / 2;
            UserImageView.ClipsToBounds      = true;
            if (!string.IsNullOrEmpty(App.CurrentUserEnvironment.User.UserPicture))
            {
                using (var dataDecoded = new NSData(App.CurrentUserEnvironment.User.UserPicture
                                                    , NSDataBase64DecodingOptions.IgnoreUnknownCharacters))
                {
                    UserImageView.Image = new UIImage(dataDecoded);
                }
            }
            SaveButton.Enabled = false;
        }