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(); }
public LaunchPackagePage(Package package) { InitializeComponent(); AddressBookHelper.LoadCallSigns(); BindingContext = package; //set launcher phone var profile = App.Locator.ProfileModel; var number = profile.StoredPhoneNumber; PhoneNumberUtil phoneUtil = PhoneNumberUtil.Instance; try { PhoneNumber numberProto = phoneUtil.Parse(number, ""); package.LauncherPhoneCode = "+" + Convert.ToString(numberProto.CountryCode); package.LauncherPhoneNumber = number.Replace(package.LauncherPhoneCode, ""); } catch (NumberParseException) { package.LauncherPhoneNumber = number; } #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; EntryLauncherPhoneNumber.TranslationY = 3; EntryRecipientPhoneNumber.TranslationY = 3; #endif var selectMyCountryCommand = new Command(() => { var picker = new CountryPickerPage(); picker.eventHandler = DidSelectMyCountryHandler; Navigation.PushAsync(picker, true); }); var selectRecipientCountryCommand = new Command(() => { var picker = new CountryPickerPage(); picker.eventHandler = DidSelectRecipientCountryHandler; Navigation.PushAsync(picker, true); }); var selectFromLocation = new Command(() => { GooglePlace place = null; if (ViewModel.FromLocationGPS != null) { string location = ViewModel.FromLocationGPS; place = new GooglePlace(); place.Address = ViewModel.FromLocationAddress; place.Latitude = Convert.ToDouble(location.Split(',')[0]); place.Longitude = Convert.ToDouble(location.Split(',')[1]); } var picker = new LocationPickerPage(LocationPickerType.From, place); picker.eventHandler = DidSelectLocationHandler; Navigation.PushAsync(picker, true); }); var selectToLocation = new Command(() => { GooglePlace place = null; if (ViewModel.ToLocationGPS != null) { string location = ViewModel.ToLocationGPS; place = new GooglePlace(); place.Address = ViewModel.ToLocationAddress; place.Latitude = Convert.ToDouble(location.Split(',')[0]); place.Longitude = Convert.ToDouble(location.Split(',')[1]); } var picker = new LocationPickerPage(LocationPickerType.To, place); picker.eventHandler = DidSelectLocationHandler; Navigation.PushAsync(picker, true); }); var openFullScreeenPhotoCommand = new Command(() => { OpenPhotoFullScreen(); }); XamEffects.Commands.SetTap(PhotoImage, openFullScreeenPhotoCommand); XamEffects.Commands.SetTap(LauncherCountryCodeLabel, selectMyCountryCommand); XamEffects.Commands.SetTap(RecipientCountryCodeLabel, selectRecipientCountryCommand); XamEffects.Commands.SetTap(FromLocationLabel, selectFromLocation); // XamEffects.Commands.SetTap(FromLocationFrame, selectFromLocation); XamEffects.Commands.SetTap(FromLocationImage, selectFromLocation); XamEffects.Commands.SetTap(ToLocationLabel, selectToLocation); // XamEffects.Commands.SetTap(ToLocationFrame, selectToLocation); XamEffects.Commands.SetTap(ToLocationImage, selectToLocation); EntryRecepient.MakeCustomOffset(); }