Ejemplo n.º 1
0
        public static string GetCurrentCountryName()
        {
            var name = App.Locator.DeviceService.CountryCode();

            if (name.ToLower() == "usa")
            {
                name = "United States of America";
            }

            var country = ISO3166.FromAlpha2(name);

            if (country != null)
            {
                return(country.Name);
            }

            return("United States of America");
        }
Ejemplo n.º 2
0
        public static string GetCurrentCallingCode()
        {
            var name    = App.Locator.DeviceService.CountryCode();
            var country = ISO3166.FromAlpha2(name);

            if (country != null)
            {
                return("+" + country.DialCodes[0]);
            }
            else
            {
                country = ISO3166.FromAlpha3(name);

                if (country != null)
                {
                    return("+" + country.DialCodes[0]);
                }
            }

            return("+1");
        }
Ejemplo n.º 3
0
        public AddressPickerPage()
        {
            InitializeComponent();

#if __IOS__
            if (App.Locator.DeviceService.IsIphoneX() == true)
            {
                TitleLabel.TranslationY = 35;
                BackButton.TranslationY = 10;
            }
            else
            {
                TitleLabel.TranslationY = 24;
            }
#elif __ANDROID__
            TitleLabel.TranslationY = 5;
            BackButton.TranslationY = -18;
            BackButton.TranslationX = -30;
#endif

            Items = ISO3166.GetCollection().ToList();
            ItemsListView.ItemsSource = Items;
        }
Ejemplo n.º 4
0
        public RegistrationPage(bool isAddedInfo, UserDetails userData = null)
        {
            InitializeComponent();


#if __ANDROID__
            backButton.TranslationX       = -30;
            entryPhoneNumber.TranslationY = 3;
#else
            if (App.Locator.DeviceService.IsIphoneX() == true)
            {
                backButton.TranslationY = 30;
                titleLabel.TranslationY = 30;
            }
#endif


            BindingContext = new RegisterViewModel();

            IsAddedInfo = isAddedInfo;

            if (userData != null)
            {
                IsFinishActivation = true;
                UserData           = userData;
                ViewModel.UserName = userData.PaketUser;
                ViewModel.FullName = userData.FullName;
                ViewModel.Address  = userData.Address;
                if (ViewModel.Address == null)
                {
                    ViewModel.Address = ISO3166.GetCurrentCountryName();
                }
            }
            else
            {
                ViewModel.Address = ISO3166.GetCurrentCountryName();
            }

            if (IsAddedInfo)
            {
                GenerateButton.Text = AppResources.CompleteRegistration;
                titleLabel.Text     = AppResources.AddInfo;
            }
            else if (isAddedInfo == false && IsFinishActivation == true)
            {
                GenerateButton.Text = AppResources.CompleteRegistration;
                titleLabel.Text     = AppResources.AddInfo;

                entryFullName.Text    = userData.FullName;
                entryUserName.Text    = userData.PaketUser;
                entryPhoneNumber.Text = userData.PhoneNumber;
                entryUserAddress.Text = userData.Address;

                if (userData.PaketUser != null)
                {
                    if (userData.PaketUser.Length > 0)
                    {
                        entryUserName.IsEnabled = false;
                    }
                }
            }

            var selectCountryCommand = new Command(() =>
            {
                var picker          = new CountryPickerPage();
                picker.eventHandler = DidSelectCountryHandler;
                Navigation.PushAsync(picker, true);
            });

            XamEffects.Commands.SetTap(countryCodeLabel, selectCountryCommand);

            var selectTermsCommand = new Command(() =>
            {
                Device.OpenUri(new Uri(Constants.PAKET_PRIVACY_URL));
            });

            XamEffects.Commands.SetTap(termsOfServiceLabel, selectTermsCommand);

            var whyTapCommand = new Command(() =>
            {
                Device.OpenUri(new Uri(Constants.WHY_BLOCKED));
            });

            XamEffects.Commands.SetTap(whyButton, whyTapCommand);


            App.Locator.DeviceService.setStausBarLight();

            if (ViewModel.Address.ToLower() == "united states of america" || ViewModel.Address.ToLower() == "usa")
            {
                ErrorView.IsVisible = true;
            }

            EnableDisableButton();
        }