Ejemplo n.º 1
0
        partial void EmailRadioBtn_TouchUpInside(UIButton sender)
        {
            EmailRadioBtn.SetBackgroundImage(UIImage.FromBundle("circular_filled.png"), UIControlState.Normal);
            PhoneRadioBtn.SetBackgroundImage(UIImage.FromBundle("circular_empty.png"), UIControlState.Normal);
            EmailPhone.Placeholder  = "Email";
            EmailPhone.KeyboardType = UIKeyboardType.EmailAddress;
            EmailPhone.Text         = "";
            IsEmail = true;

            EmailPhone.ShouldChangeCharacters = (textField, range, replacementString) => {
                var newLength = textField.Text.Length + replacementString.Length - range.Length;
                return(newLength <= 100);
            };
        }
Ejemplo n.º 2
0
        partial void PhoneRadioBtn_TouchUpInside(UIButton sender)
        {
            PhoneRadioBtn.SetBackgroundImage(UIImage.FromBundle("circular_filled.png"), UIControlState.Normal);
            EmailRadioBtn.SetBackgroundImage(UIImage.FromBundle("circular_empty.png"), UIControlState.Normal);
            EmailPhone.Placeholder  = "Phone";
            EmailPhone.KeyboardType = UIKeyboardType.PhonePad;
            EmailPhone.Text         = "";
            IsEmail = false;
            const int maxCharacters = 10;

            EmailPhone.Text = Regex.Replace(EmailPhone.Text, @"[^0-9]+", "");
            EmailPhone.ShouldChangeCharacters = (textField, range, replacementString) => {
                var newContent = new NSString(textField.Text).Replace(range, new NSString(replacementString)).ToString();
                int number;
                if (newContent.Length > 0)
                {
                    EmailPhone.AttributedPlaceholder = new NSAttributedString("", null, UIColor.Red);
                    //EmailPhone.AttributedPlaceholder = new NSAttributedString("", null, UIColor.Red);
                }
                return(newContent.Length <= maxCharacters && (replacementString.Length == 0 || int.TryParse(replacementString, out number)));
            };
        }
        void ReleaseDesignerOutlets()
        {
            if (DealerBtn != null)
            {
                DealerBtn.Dispose();
                DealerBtn = null;
            }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if (txtZip != null)
            {
                txtZip.Dispose();
                txtZip = null;
            }
        }
Ejemplo n.º 4
0
        public override void ViewDidLoad()
        {
            updateInternetStatus();
            Reachability.ReachabilityChanged += (object sender, EventArgs e) => {
                updateInternetStatus();
            };

            // hide keyboard on touch outside area
            var g = new UITapGestureRecognizer(() => View.EndEditing(true));

            g.CancelsTouchesInView = false; //for iOS5
            View.AddGestureRecognizer(g);



            InitialContainer.Hidden = false;
            GuestContainer.Hidden   = true;
            DealerContainer.Hidden  = true;

            EmailRadioBtn.SetBackgroundImage(UIImage.FromBundle("circular_filled.png"), UIControlState.Normal);
            PhoneRadioBtn.SetBackgroundImage(UIImage.FromBundle("circular_empty.png"), UIControlState.Normal);

            EmailPhone.Placeholder = "Email";
            IsEmail = true;

            LastNameTxt.Text = Regex.Replace(LastNameTxt.Text, @"[^a-zA-Z]+", "");
            LastNameTxt.ShouldChangeCharacters = (UITextField txt, NSRange range, string oopsTxt) =>
            {
                var newLength = txt.Text.Length + oopsTxt.Length - range.Length;
                return(newLength <= 50);
            };


            txtZip.ShouldChangeCharacters = (textField, range, replacementString) => {
                txtZip.Text = Regex.Replace(textField.Text, @"[^0-9]+", "");
                var newLength = textField.Text.Length + replacementString.Length - range.Length;
                return(newLength <= 5);
            };



            DealerCodeTxt.ShouldChangeCharacters = (textField, range, replacementString) => {
                DealerCodeTxt.Text = Regex.Replace(textField.Text, @"[^0-9]+", "");
                var newLength = textField.Text.Length + replacementString.Length - range.Length;
                return(newLength <= 6);
            };


            if (UserInterfaceIdiomIsPhone)
            {
                Console.WriteLine("width :: " + this.View.Bounds.Width + " Height :: " + this.View.Bounds.Height);
                // iphone 8 plus :: width :: 414 Height :: 736
                // iphone 7 width :: 375 Height :: 667

                //if (this.View.Bounds.Width == 375)
                //{
                //    boxImg.Frame = new CGRect(0, 0, 500, 500);
                //}
                //else
                //{
                //    boxImg.Frame = new CGRect(0, 0, 550, 550);
                //}

                //if (this.View.Bounds.Height == 667)
                //{
                //    boxImg.Center = new CGPoint(this.View.Bounds.Width / 2, this.View.Bounds.Height / 1.5);
                //    ComponentView.Center = new CGPoint(this.View.Bounds.Width / 2, this.View.Bounds.Height / 1.5);
                //}
                //else
                //{
                //    boxImg.Center = new CGPoint(this.View.Bounds.Width / 2, this.View.Bounds.Height / 2);
                //    ComponentView.Center = new CGPoint(this.View.Bounds.Width / 2, this.View.Bounds.Height / 2.2);
                //}

                if (this.View.Bounds.Width == 375)
                {
                    NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, keyboardWillHide);
                    NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillShowNotification, keyboardWillShow);
                }
            }
            else
            {
                if (InterfaceOrientation == UIInterfaceOrientation.LandscapeLeft || InterfaceOrientation == UIInterfaceOrientation.LandscapeRight)
                {
                    NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, keyboardWillHide);
                    NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillShowNotification, keyboardWillShow);
                }
            }

            AppDelegate.appDelegate.IsZipCodeValid = false;

            storeLocatorModel = new StoreLocatorModel();

            AppDelegate.appDelegate.IsInfoSaved         = false;
            AppDelegate.appDelegate.IsFactorySaved      = false;
            AppDelegate.appDelegate.IsAftermarketSaved  = false;
            AppDelegate.appDelegate.IsHistorySaved      = false;
            AppDelegate.appDelegate.IsReconditionsSaved = false;
            AppDelegate.appDelegate.IsPhotosSaved       = false;
            AppDelegate.appDelegate.IsAllDataSaved      = false;

            LastNameTxt.ShouldReturn = (tf) =>
            {
                LastNameTxt.ReturnKeyType = UIReturnKeyType.Next;
                EmailPhone.BecomeFirstResponder();
                return(true);
            };
            EmailPhone.ShouldReturn = (tf) =>
            {
                EmailPhone.ReturnKeyType = UIReturnKeyType.Next;
                txtZip.BecomeFirstResponder();
                return(true);
            };

            txtZip.ShouldReturn = (tf) =>
            {
                txtZip.EndEditing(true);
                txtZip.ReturnKeyType = UIReturnKeyType.Go;
                GoClick();
                return(true);
            };

            DealerCodeTxt.ShouldReturn = (tf) =>
            {
                DealerCodeTxt.EndEditing(true);
                DealerCodeTxt.ReturnKeyType = UIReturnKeyType.Go;
                DealerClicked();
                return(true);
            };
        }