public MapPickerPage(LocationPickerType pickerType, GooglePlace selectedAddress = null) { InitializeComponent(); SelectedAddress = selectedAddress; PickerType = pickerType; #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 SelectButton.Opacity = 0; MapView.UiSettings.ZoomControlsEnabled = false; MapView.MyLocationEnabled = true; MapView.CameraIdled += (sender, e) => { if (SelectButton.Opacity > 0) { LoadAddress(MapView.CameraPosition.Target.Latitude, MapView.CameraPosition.Target.Longitude); } }; if (SelectedAddress != null) { SelectButton.Opacity = 1; MapView.InitialCameraUpdate = CameraUpdateFactory.NewPositionZoom(new Position(SelectedAddress.Latitude, SelectedAddress.Longitude), 20d); LoadAddress(SelectedAddress.Latitude, SelectedAddress.Longitude); } else if (!App.Locator.LocationHelper.lat.Equals(0.0)) { MapView.InitialCameraUpdate = CameraUpdateFactory.NewPositionZoom(new Position(App.Locator.LocationHelper.lat, App.Locator.LocationHelper.lng), 20d); } if (PickerType == LocationPickerType.To) { TitleLabel.Text = AppResources.SelectToLocation; } else if (PickerType == LocationPickerType.From) { TitleLabel.Text = AppResources.SelectFromLocation; } }
public LocationPickerPage(LocationPickerType pickerType, GooglePlace selectedAddress = null) { InitializeComponent(); SelectedAddress = selectedAddress; PickerType = pickerType; #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 if (PickerType == LocationPickerType.To) { TitleLabel.Text = AppResources.SelectToLocation; SearchField.Placeholder = AppResources.LocationPickerTypeTo; } else if (PickerType == LocationPickerType.From) { TitleLabel.Text = AppResources.SelectFromLocation; SearchField.Placeholder = AppResources.LocationPickerTypeFrom; } PlacesRetrieved(new AutoCompleteResult()); if (SelectedAddress != null) { SearchField.Text = SelectedAddress.Address; } }
private void OnSelect(object sender, System.EventArgs e) { if (AddressLabel.Text == null) { return; } else if (AddressLabel.Text.Length == 0) { return; } if (MapView != null) { var place = new GooglePlace(); place.Address = AddressLabel.Text; place.Latitude = MapView.CameraPosition.Target.Latitude; place.Longitude = MapView.CameraPosition.Target.Longitude; place.Country = addressData.Country; Navigation.PopAsync(false); eventHandler(this, new LocationPickerPageEventArgs(place)); } }
public LocationPickerPageEventArgs(GooglePlace item) { this.item = item; }
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(); }