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

            var me = RealmUserServices.GetMe(false);

            FirstNameTextField.KeyboardType         = UIKeyboardType.EmailAddress;
            FirstNameTextField.Text                 = me.FirstName;
            FirstNameTextField.Placeholder          = Strings.Basic.first_name;
            FirstNameTextField.AutocorrectionType   = UITextAutocorrectionType.No;
            FirstNameTextField.EditingDidEndOnExit += (sender, e) =>
            {
                FirstNameTextField.ResignFirstResponder();
            };

            LastNameTextField.KeyboardType         = UIKeyboardType.EmailAddress;
            LastNameTextField.Text                 = me.LastName;
            LastNameTextField.Placeholder          = Strings.Basic.last_name;
            LastNameTextField.AutocorrectionType   = UITextAutocorrectionType.No;
            LastNameTextField.EditingDidEndOnExit += (sender, e) =>
            {
                LastNameTextField.ResignFirstResponder();
            };

            ProfileImageButton.SetImageWithCustomCache(me.GetRemoteProfileImageUrlCached(), FallbackImageFileName, FallbackImageFileName, me.RemoteProfileImageURL);
            ProfileImageButton.Layer.MasksToBounds        = true;
            ProfileImageButton.Layer.CornerRadius         = ProfileImageButton.Frame.Size.Width / 2;
            ProfileImageButton.ClipsToBounds              = true;
            ProfileImageButton.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray;

            SetProgressButton(SaveButton);

            RemoveBackBarButtonTitle();
        }
コード例 #2
0
        private void GestureGecognizer()
        {
            var gestureRecognizer = new UITapGestureRecognizer(() =>
            {
                FirstNameTextField.ResignFirstResponder();
                LastNameTextField.ResignFirstResponder();
                EmailTextField.ResignFirstResponder();
                PasswordTextField.ResignFirstResponder();
                ConfirmPasswordTextField.ResignFirstResponder();
                PhoneNumberTextField.ResignFirstResponder();
            });

            View.AddGestureRecognizer(gestureRecognizer);
        }
コード例 #3
0
        private void SetDataAndStyleToView()
        {
            // init strings in view
            InitializeAllStrings();

            // set up the background
            //BackgroundImageView2.Image = UIImage.FromBundle("LoginBackground");

            // dissmiss the keyboard when i press return key on email TextField
            EmailTextField.ShouldReturn += (textField) =>
            {
                EmailTextField.ResignFirstResponder();
                PasswordTextField.BecomeFirstResponder();
                return(true);
            };

            // dissmiss the keyboard when i press return key on password TextField
            PasswordTextField.ShouldReturn += (textField) =>
            {
                PasswordTextField.ResignFirstResponder();
                LoginButton_TouchUpInside(null, null);
                return(true);
            };

            // dissmiss the keyboard when i press return key on Name TextField
            FirstNameTextField.ShouldReturn += (textField) =>
            {
                FirstNameTextField.ResignFirstResponder();
                LastNameTextField.BecomeFirstResponder();
                return(true);
            };

            // dissmiss the keyboard when i press return key on FirstName TextField
            LastNameTextField.ShouldReturn += (textField) =>
            {
                LastNameTextField.ResignFirstResponder();
                EmailTextFieldOfRegistration.BecomeFirstResponder();
                return(true);
            };

            // dissmiss the keyboard when i press return key on email TextField
            EmailTextFieldOfRegistration.ShouldReturn += (textField) =>
            {
                EmailTextFieldOfRegistration.ResignFirstResponder();
                PasswordTextFieldOfRegistration.BecomeFirstResponder();
                return(true);
            };

            // dissmiss the keyboard when i press return key on password TextField
            PasswordTextFieldOfRegistration.ShouldReturn += (textField) =>
            {
                PasswordTextFieldOfRegistration.ResignFirstResponder();
                ConfirmPasswordTextField.BecomeFirstResponder();
                return(true);
            };
            PasswordTextFieldOfRegistration.EditingChanged += (o, e) =>
            {
                ErrorMessageLabel.Hidden = true;
            };
            PasswordTextFieldOfRegistration.ShouldBeginEditing += (textField) =>
            {
                if (View.Frame.Y >= 0)
                {
                    bottom = ((float)(RegistrationContainer.Frame.Y + PasswordTextFieldOfRegistration.Frame.Y + PasswordTextFieldOfRegistration.Frame.Height + 10));
                }
                return(true);
            };

            // dissmiss the keyboard when i press return key on Confirm Password TextField
            ConfirmPasswordTextField.ShouldReturn += (textField) =>
            {
                ConfirmPasswordTextField.ResignFirstResponder();
                return(true);
            };
            ConfirmPasswordTextField.EditingChanged += (o, e) =>
            {
                ErrorMessageLabel.Hidden = true;
            };
            ConfirmPasswordTextField.ShouldBeginEditing += (textField) =>
            {
                if (View.Frame.Y >= 0)
                {
                    bottom = ((float)(RegistrationContainer.Frame.Y + ConfirmPasswordTextField.Frame.Y + ConfirmPasswordTextField.Frame.Height + 10));
                }
                return(true);
            };

            // dissmiss the keyboard when i press return key on Confirm Password TextField
            EmailTextFieldOfForgetPassword.ShouldReturn += (textField) =>
            {
                EmailTextFieldOfForgetPassword.ResignFirstResponder();
                return(true);
            };

            EmailTextField.KeyboardType                       = UIKeyboardType.EmailAddress;
            EmailTextField.AutocorrectionType                 = UITextAutocorrectionType.No;
            PasswordTextField.AutocorrectionType              = UITextAutocorrectionType.No;
            FirstNameTextField.ReturnKeyType                  = UIReturnKeyType.Next;
            LastNameTextField.AutocorrectionType              = UITextAutocorrectionType.No;
            LastNameTextField.ReturnKeyType                   = UIReturnKeyType.Next;
            EmailTextFieldOfRegistration.KeyboardType         = UIKeyboardType.EmailAddress;
            EmailTextFieldOfRegistration.AutocorrectionType   = UITextAutocorrectionType.No;
            EmailTextFieldOfRegistration.ReturnKeyType        = UIReturnKeyType.Next;
            PasswordTextFieldOfRegistration.ReturnKeyType     = UIReturnKeyType.Next;
            ConfirmPasswordTextField.ReturnKeyType            = UIReturnKeyType.Next;
            EmailTextFieldOfForgetPassword.KeyboardType       = UIKeyboardType.EmailAddress;
            EmailTextFieldOfForgetPassword.AutocorrectionType = UITextAutocorrectionType.No;

            // set up the rounded corner fot the button
            LoadingIndicator.Hidden         = true;
            LoginButton.Layer.CornerRadius  = 4;
            LoginButton.Layer.MasksToBounds = true;

            RegistrationButton.Layer.CornerRadius  = 4;
            RegistrationButton.Layer.MasksToBounds = true;
            RegistrationButton.Enabled             = false;

            ResetPasswordButton.Layer.CornerRadius  = 4;
            ResetPasswordButton.Layer.MasksToBounds = true;
            ResetPasswordButton.Enabled             = false;

            //DisplayFacebookButton();
            //_facebookButton.Layer.CornerRadius = 4;
            //_facebookButton.Layer.MasksToBounds = true;

            CreateAccountButton.ContentEdgeInsets  = new UIEdgeInsets(5, 0, 5, 5);
            ForgetPasswordButton.ContentEdgeInsets = new UIEdgeInsets(5, 5, 5, 0);

            LoginContainer.Hidden          = false;
            RegistrationContainer.Hidden   = true;
            ForgetPasswordContainer.Hidden = true;
            BackButton.Hidden           = true;
            CreateAccountButton.Hidden  = false;
            ForgetPasswordButton.Hidden = false;
            ErrorMessageLabel.Hidden    = true;
            ErrorMessageLabel.TextColor = UIColor.FromRGB(255, 76, 56);
        }
        partial void OnClick(UIButton sender)
        {
            EmailTextField.ResignFirstResponder();
            PasswordTextField.ResignFirstResponder();
            FirstNameTextField.ResignFirstResponder();
            LastNameTextField.ResignFirstResponder();

            //Ensure required fields are input
            if (Settings.Email == null || Settings.Email == string.Empty)
            {
                HelperMethods.SendBasicAlert("Validation", "Please input a valid email address");
                return;
            }
            if (Settings.Password == null || Settings.Password == string.Empty)
            {
                HelperMethods.SendBasicAlert("Validation", "Please input a valid password");
                return;
            }

            if (Settings.Email != ReEmailTextField.Text)
            {
                HelperMethods.SendBasicAlert("Validation", "Email doesn't match");
                return;
            }

            if (Settings.Password != RePasswordTextField.Text)
            {
                HelperMethods.SendBasicAlert("Validation", "Password doesn't match");
                return;
            }


            if (Settings.FirstName == null || Settings.FirstName == string.Empty)
            {
                HelperMethods.SendBasicAlert("Validation", "Please input your first name");
                return;
            }
            if (Settings.LastName == null || Settings.LastName == string.Empty)
            {
                HelperMethods.SendBasicAlert("Validation", "Please input your last name");
                return;
            }
            if (Settings.Phone == null || Settings.Phone == string.Empty)
            {
                HelperMethods.SendBasicAlert("Validation", "Please input your phone number");
                return;
            }

            if (Settings.LocationPickerSelectedId == 0)
            {
                HelperMethods.SendBasicAlert("Validation", "Please select your location");
                return;
            }

            RegistrationViewController registrationVC = (RegistrationViewController)((MultiStepProcessHorizontalViewController)this.ParentViewController).ContainerViewController;
            var stepThree = registrationVC.Steps[2];

            registrationVC._pageViewController.SetViewControllers(new[] { stepThree as UIViewController }, UIPageViewControllerNavigationDirection.Forward, true, (finished) =>
            {
                if (finished)
                {
                    //finalStep.StepActivated(this, new MultiStepProcessStepEventArgs());
                }
            });
            //throw new NotImplementedException();
        }
コード例 #5
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;
        }