예제 #1
0
        public void DidPickPlace(PlacePickerViewController viewController, Google.Places.Place place)
        {
            DismissViewController(true, null);

            if (place == null)
            {
                return;
            }

            chosenPlace = new Common.Models.Place
            {
                GooglePlaceId = place.Id,
                Latitude      = new decimal(place.Coordinate.Latitude),
                Longitude     = new decimal(place.Coordinate.Longitude),
                Name          = place.Name
            };

            if (place.Types != null && place.Types.Contains("synthetic_geocode"))
            {
                chosenPlace.Name = "An Unknown Location";
            }

            locationLabel.Text = chosenPlace.Name;
            chooseLocationButton.SetTitle("Change Location", UIControlState.Normal);
        }
        public void DidPickPlace(PlacePickerViewController viewController, Place place)
        {
            if (place != null)
            {
                var         name        = place.Name;
                var         placeId     = place.Id;
                var         coordinate  = place.Coordinate;
                Coordinates coordinates = new Coordinates(coordinate.Latitude, coordinate.Longitude);
                var         phone       = place.PhoneNumber;
                var         address     = place.FormattedAddress;
                var         attribution = place.Attributions?.ToString();
                var         weburi      = place.Website?.ToString();
                var         priceLevel  = (long)place.PriceLevel;
                var         rating      = place.Rating;
                var         swlatitude  = place.Viewport?.SouthWest.Latitude;
                var         swlongitude = place.Viewport?.SouthWest.Longitude;
                var         nelatitude  = place.Viewport?.NorthEast.Latitude;
                var         nelongitude = place.Viewport?.NorthEast.Longitude;
                Abstractions.CoordinateBounds bounds = null;
                if (swlatitude != null && swlongitude != null && nelatitude != null && nelongitude != null)
                {
                    bounds = new Abstractions.CoordinateBounds(new Coordinates(swlatitude.Value, swlongitude.Value), new Coordinates(nelatitude.Value, nelongitude.Value));
                }
                Places places = new Places(name, placeId, coordinates, phone, address, attribution, weburi, Convert.ToInt32(priceLevel), rating, bounds);
                OnPlaceSelected(new PlacePickedEventArgs(currentRequest.Value, false, places));
            }
            else
            {
                OnPlaceSelected(new PlacePickedEventArgs(currentRequest.Value, true));
            }

            DismissViewController(true, null);
            // DismissViewController(false,null);
        }
예제 #3
0
        private void ChooseLocationButton_TouchUpInside(object sender, EventArgs e)
        {
            PlacePickerConfig config = new PlacePickerConfig(null);

            placePicker = new PlacePickerViewController(config)
            {
                Delegate = this
            };
            PresentViewController(placePicker, true, null);
        }
 public void DidPickPlace(PlacePickerViewController viewController, Place place)
 {
     if (viewController.NavigationController == NavigationController)
     {
         NavigationController.PopViewController(true);
     }
     else
     {
         DismissViewController(true, null);
     }
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            var config = new PlacePickerConfig(null);

            placePickerViewController = new PlacePickerViewController(config)
            {
                Delegate = this
            };
        }
 public override void ViewWillAppear(bool animated)
 {
     base.ViewWillAppear(animated);
     if (!loaded)
     {
         loaded = true;
         var placePickerViewController = new PlacePickerViewController(config)
         {
             Delegate = this
         };
         placePickerViewController.ModalPresentationStyle = UIModalPresentationStyle.Popover;
         PresentViewController(placePickerViewController, true, null);
     }
 }
예제 #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            var config = new PlacePickerConfig(null);

            placePickerViewController = new PlacePickerViewController(config)
            {
                Delegate = this,
                ModalPresentationStyle = UIModalPresentationStyle.Popover
            };
            placesClient   = PlacesClient.SharedInstance;
            photosMetadata = new PlacePhotoMetadata [0];
        }
예제 #8
0
        public void DidPickPlace(PlacePickerViewController viewController, Place place)
        {
            DismissViewController(true, null);
            placesClient.LookUpPhotos(place.Id, LookUpPhotosResult);

            void LookUpPhotosResult(PlacePhotoMetadataList photos, NSError error)
            {
                if (error != null)
                {
                    AppDelegate.ShowMessage("Error", error.LocalizedDescription, NavigationController);
                    return;
                }

                photosMetadata = photos.Results;
                PhotosCollectionView.ReloadData();
            }
        }
 void DidCancel(PlacePickerViewController viewController)
 {
     DismissViewController(true, null);
     OnPlaceSelected(new PlacePickedEventArgs(currentRequest.Value, true));
 }
예제 #10
0
 void DidCancel(PlacePickerViewController viewController)
 {
     // Dismiss the place picker, as it cannot dismiss itself.
     DismissViewController(true, null);
     Console.WriteLine("No place selected");
 }
 void DidCancel(PlacePickerViewController viewController)
 {
     DismissViewController(true, null);
 }