Exemple #1
0
        public static ISO3166CountryCodes GetISOCode(this BillingCountryOptions option)
        {
            switch (option)
            {
            case BillingCountryOptions.BillingCountryOptionUK:
                return(ISO3166CountryCodes.UK);

                break;

            case BillingCountryOptions.BillingCountryOptionUSA:
                return(ISO3166CountryCodes.USA);

                break;

            case BillingCountryOptions.BillingCountryOptionCanada:
                return(ISO3166CountryCodes.Canada);

                break;

            default:
                return(ISO3166CountryCodes.Others);

                break;
            }
        }
Exemple #2
0
        public override void  SetUpCell()
        {
            countrySheet           = new UIActionSheet("Select Country");
            countrySheet.TintColor = UIColor.Black;
            selectedCountry        = BillingCountryOptions.BillingCountryOptionUK;


            HomeButton.TouchUpInside += (sender, ev) => {
                DismissKeyboardAction();
            };
            countrySheet.Clicked += delegate(object sender, UIButtonEventArgs button) {
                switch (button.ButtonIndex)
                {
                case (int)BillingCountryOptions.BillingCountryOptionUK:
                    selectedCountry = BillingCountryOptions.BillingCountryOptionUK;

                    break;

                case (int)BillingCountryOptions.BillingCountryOptionUSA:
                    selectedCountry = BillingCountryOptions.BillingCountryOptionUSA;

                    break;

                case (int)BillingCountryOptions.BillingCountryOptionCanada:
                    selectedCountry = BillingCountryOptions.BillingCountryOptionCanada;

                    break;

                case (int)BillingCountryOptions.BillingCountryOptionOther:
                    selectedCountry = BillingCountryOptions.BillingCountryOptionOther;

                    break;

                default:
                    selectedCountry = BillingCountryOptions.BillingCountryOptionUK;
                    break;
                }
                CountryLabel.Text = selectedCountry.ToDescriptionString();
            };

            foreach (BillingCountryOptions option in Enum.GetValues(typeof(BillingCountryOptions)))
            {
                countrySheet.AddButton(option.ToDescriptionString());
            }
            CountryButton.TouchUpInside += (sender, ev) => {
                if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
                {
                    countrySheet.ShowInView(this.Superview);
                }
                else
                {
                    countrySheet.ShowInView(UIApplication.SharedApplication.KeyWindow);
                }
            };
            PostcodeTextField.Text = "";
            PostcodeTextField.Font = JudoSDKManager.FIXED_WIDTH_FONT_SIZE_20;
            ;
            PostcodeTextField.TextColor = UIColor.Black;

            PostcodeTextField.ShouldChangeCharacters = (UITextField textField, NSRange nsRange, string replacementString) => {
                CSRange range = new CSRange((int)nsRange.Location, (int)nsRange.Length);
                DispatchQueue.MainQueue.DispatchAsync(() => {
                });
                int textLengthAfter = textField.Text.Length + replacementString.Length - range.Length;
                if (textLengthAfter > 10)
                {
                    return(false);
                }
                return(true);
            };
        }
		public override void  SetUpCell ()
		{
			countrySheet = new UIActionSheet ("Select Country");
			countrySheet.TintColor = UIColor.Black;
			selectedCountry = BillingCountryOptions.BillingCountryOptionUK;


			HomeButton.TouchUpInside += (sender, ev) => {
				DismissKeyboardAction();
			};
			countrySheet.Clicked += delegate(object sender, UIButtonEventArgs button) {
				switch (button.ButtonIndex) {
				case (int) BillingCountryOptions.BillingCountryOptionUK:
					selectedCountry = BillingCountryOptions.BillingCountryOptionUK;

					break;
				case (int)BillingCountryOptions.BillingCountryOptionUSA:
					selectedCountry = BillingCountryOptions.BillingCountryOptionUSA;

					break;
				case (int)BillingCountryOptions.BillingCountryOptionCanada:
					selectedCountry = BillingCountryOptions.BillingCountryOptionCanada;

					break;
				case (int)BillingCountryOptions.BillingCountryOptionOther:
					selectedCountry = BillingCountryOptions.BillingCountryOptionOther;

					break;
				default:
					selectedCountry = BillingCountryOptions.BillingCountryOptionUK;
					break;

				}
				CountryLabel.Text = selectedCountry.ToDescriptionString ();
			};

			foreach (BillingCountryOptions option in Enum.GetValues(typeof(BillingCountryOptions))) {
				countrySheet.AddButton (option.ToDescriptionString ());
			}
				CountryButton.TouchUpInside += (sender, ev) => {
					if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) {
						countrySheet.ShowInView(this.Superview);
					}
					else
					{
						countrySheet.ShowInView (UIApplication.SharedApplication.KeyWindow);
					}
			};
			PostcodeTextField.Text = "";	
			PostcodeTextField.Font = JudoSDKManager.FIXED_WIDTH_FONT_SIZE_20;;
			PostcodeTextField.TextColor = UIColor.Black;

			PostcodeTextField.ShouldChangeCharacters = (UITextField textField, NSRange nsRange, string replacementString) => {
				CSRange range = new CSRange ((int)nsRange.Location, (int)nsRange.Length);
				DispatchQueue.MainQueue.DispatchAsync (() => {
				});
				int textLengthAfter = textField.Text.Length + replacementString.Length - range.Length;
				if (textLengthAfter > 10) {
					return false;
				}
				return true;
			};

		}