IEnumerator RemovePlaceCoroutine(ItineraryListItem itineraryItem, PlaceDetails placeDetails) { Place place = itineraryItem?.placesData ?.SingleOrDefault(p => p.placeDetails == placeDetails) ?.place; if (place == null) { yield break; } string url = RemovePlaceResult.BuildURL(place); WWW www = new WWW(url); yield return(www); if (www.error != null) { Debug.Log(www.error); yield break; } var placeItem = placesShown.FirstOrDefault(p => p.data.placeDetails == placeDetails); if (placeItem != null) { itineraryItem.placesData.Remove(placeItem.data); placesShown.Remove(placeItem); Destroy(placeItem.gameObject); } }
private void appBarAddButton_Click(object sender, EventArgs e) { // Confirm there is some text in the text box. if (newPlaceNameTextBox.Text.Length > 0) { // Create a new place. PlaceDetails newPlaceItem = new PlaceDetails { PlaceName = newPlaceNameTextBox.Text, PlaceCity = city.Text, PlaceStreet = street.Text, PlaceStreetNumber = streetNumber.Text, PlaceDescription = description.Text //Category = (ToDoCategory)categoriesListPicker.SelectedItem }; // Add the place to the ViewModel. App.ViewModel.AddPlace(newPlaceItem); // Return to the main page. if (NavigationService.CanGoBack) { NavigationService.GoBack(); } } }
IEnumerator GetPlaceCoroutine(string place_id) { WWW www = new WWW(PHPProxy.Escape(PlaceDetails.BuildURL( place_id, PlaceDetails.Fields.name | PlaceDetails.Fields.geometry | PlaceDetails.Fields.place_id))); yield return(www); if (www.error != null) { Debug.Log(www.error); yield break; } PlaceDetails place = JsonUtility.FromJson <PlaceDetails>(www.text); if (place.status != "OK") { Debug.Log(place.error_message); yield break; } MapTagManager.Instance.ShowPlaceOnMap(place); }
public void OpenTooltip(MapTag tag) { place = tag.place; OpenTooltip(); tooltipRoot.transform.position = tag.transform.position; Update(); }
/// <summary> /// Start a flyby of a specific location, with an optional delay. /// </summary> /// <param name="place">A Google Maps Place Details location.</param> /// <param name="delay">An optional delay, in seconds.</param> public void StartFlyby(PlaceDetails place, float delay = 0) { locations = new List <GoogleMaps.Geometry>(); locations.Add(place.result.geometry); StopFlyby(); StartCoroutine(FlybyCoroutine(delay)); }
private MyReview ExtractReviewsFromResult(PlaceDetails result) { MyReview review = new MyReview() { Comment = string.Empty, Rating = 0 }; MyReview greaterReview = new MyReview(); foreach (Review r in result.Result.Reviews) { var tmpReview = new MyReview { Comment = r.Text, Rating = r.Rating }; if (r.Rating > review.Rating && r.Text.Split().Length > 3) { review = tmpReview; } else if (r.Text.Split().Length <= 3) { greaterReview = tmpReview; } } if (review.Comment?.Length == 0) { return(greaterReview); } return(review); }
public void Unsubscribe() { MessageService.Unsubscribe(this); PlaceList.Unsubscribe(); PlaceDetails.Unsubscribe(); PlaceOrders.Unsubscribe(); }
IEnumerator AddPlaceCoroutine(ItineraryListItem itinerary, PlaceDetails place) { LoginResult user = PersistentUser.User; string url = string.Format( AddPlaceResult.URL, WWW.EscapeURL(itinerary.itinerary.itineraryid), WWW.EscapeURL(place.result.place_id)); WWW www = new WWW(url); yield return(www); if (www.error != null) { Debug.Log(www.error); yield break; } AddPlaceResult json = JsonUtility.FromJson <AddPlaceResult>(www.text); if (json.error != null) { Debug.Log(json.error); yield break; } else if (json.places.Length > 0) { var newItem = AddPlaceListItem(json.places[0]); itinerary.placesData.Add(newItem.data); } }
public Place(string placeID, PlaceDetails placeDetails) { this.PlaceID = Convert.ToInt32(placeID); this.Latitude = placeDetails.Latitude; this.Longitude = placeDetails.Longitude; this.Name = placeDetails.Name; }
public void Subscribe() { MessageService.Subscribe <PlaceListViewModel>(this, (Action <PlaceListViewModel, string, object>) this.OnMessage); PlaceList.Subscribe(); PlaceDetails.Subscribe(); PlaceOrders.Subscribe(); }
private static PlaceDetails CreatePlaceDetailsFromNode(XPathNavigator navNode) { XPathNavigator navNodeLocal = navNode.Clone(); if (!navNodeLocal.MoveToFirstChild()) { return(null); } PlaceDetails placedetails = new PlaceDetails(); do { switch (navNodeLocal.LocalName) { case "formatted_address": placedetails.Address.WorldAddress = navNodeLocal.Value; break; case "formatted_phone_number": placedetails.Phone = navNodeLocal.Value; break; case "intl_phone_number": placedetails.IntlPhone = navNodeLocal.Value; break; case "rating": placedetails.Rating = navNodeLocal.ValueAsDouble / 5 /* 5 star scale normalized to 0 -> 1 */; break; case "url": placedetails.LinkUri = new Uri(navNodeLocal.Value); break; case "website": placedetails.WebsiteUri = new Uri(string.Format("http:{1}", navNodeLocal.Value)); break; case "vicinity": /* from places data */ placedetails.Address.Vicinity = navNodeLocal.Value; HandlePlaceNode(placedetails as Place, navNodeLocal); break; case "address_component": AddressComponent addresscomponent = CreateAddressComponentFromNode(navNodeLocal); if (addresscomponent.Types.Count > 0) { placedetails.Address.Components.Add(addresscomponent.Types[0], addresscomponent); } break; default: HandlePlaceNode(placedetails as Place, navNodeLocal); break; } }while (navNodeLocal.MoveToNext()); return(placedetails); }
public async Task Test_SerializationAsync() { // Get the client. IPlacesClient client = Fixture.GetRequiredService <IPlacesClient>(); // The place ID. // The White House, US. string placeId = "ChIJ37HL3ry3t4kRv3YLbdhpWXE"; // Make the request. PlaceDetails results = await client .GetDetailsAsync(placeId, default) .ConfigureAwait(false); // Create the container. var expected = new Container <PlaceDetails> { Value = results }; // Serialize to a string. string json = JsonSerializer.Serialize(expected); // Serialize again. var actual = JsonSerializer.Deserialize <Container <PlaceDetails> >(json); // Compare. Assert.Equal(expected.Value.Status, actual.Value.Status); Assert.Equal(expected.Value.Result.PlaceId, actual.Value.Result.PlaceId); Assert.Equal(expected.Value.Result.Geometry.Location.Lat, actual.Value.Result.Geometry.Location.Lat); Assert.Equal(expected.Value.Result.UtcOffset, actual.Value.Result.UtcOffset); }
public async Task <PlaceDetails> GetPlaceDetails(string placeid) { var googlePlaceDetailsSearchUrl = $"place/details/json?placeid={placeid}&key={FileConstants.GooglePlacesApiKey}"; var apiJsonValue = await HttpService.GetAsync(FileConstants.GooglePlacesApiBaseUrl, googlePlaceDetailsSearchUrl); return(apiJsonValue != null?PlaceDetails.FromJson(apiJsonValue) : default(PlaceDetails)); }
public void ConstructorTest() { var placeDetails = new PlaceDetails () { FemaleUsers = 20, MaleUsers = 40, PlaceId = 1 }; var test = placeDetails; }
public void DeletePlace(String id) //delete place by id { using (PlaceDataContext context = new PlaceDataContext(PlaceDataContext.DBConnectionString)) { IQueryable <PlaceDetails> entityQuery = from c in context.Places where c.PlaceId.Equals(id) select c; PlaceDetails entityToDelete = entityQuery.FirstOrDefault(); context.Places.DeleteOnSubmit(entityToDelete); context.SubmitChanges(); } }
// Remove a to-do task item from the database and collections. public void DeletePlace(PlaceDetails placeForDelete) { // Remove a place from the "all" observable collection. AllPlaces.Remove(placeForDelete); // Remove the to-do item from the data context. placeDB.Places.DeleteOnSubmit(placeForDelete); // Save changes to the database. SaveChangesToDB(); }
public void ConstructorTest() { var placeDetails = new PlaceDetails() { FemaleUsers = 20, MaleUsers = 40, PlaceId = 1 }; var test = placeDetails; }
// Add a place to the database and collections. public void AddPlace(PlaceDetails newPlace) { // Add a place to the data context. placeDB.Places.InsertOnSubmit(newPlace); // Save changes to the database. SaveChangesToDB(); // Add a place to the "all" observable collection. AllPlaces.Add(newPlace); }
void IDetailsCallback.OnSuccess(PlaceDetails details) { System.Diagnostics.Debug.WriteLine("DEMO: {0} {1}", "SUCCESS", details.Name); mStreet.Text = details.Name; foreach (AddressComponent component in details.AddressComponents) { foreach (AddressComponentType type in component.Types) { if (type == AddressComponentType.Locality) { mCity.Text = (component.LongName); } else if (type == AddressComponentType.AdministrativeAreaLevel1) { mState.Text = (component.ShortName); } else if (type == AddressComponentType.PostalCode) { mZip.Text = (component.LongName); } //switch (type) //{ // case AddressComponentType.StreetNumber: // break; // case AddressComponentType.Route: // break; // case AddressComponentType.Neighborhood: // break; // case AddressComponentType.SublocalityLevel1: // break; // case AddressComponentType.Sublocality: // break; // case AddressComponentType.Locality: // mCity.Text = (component.LongName); // break; // case AddressComponentType.AdministrativeAreaLevel1: // mState.Text = (component.ShortName); // break; // case AddressComponentType.AdministrativeAreaLevel2: // break; // case AddressComponentType.Country: // break; // case AddressComponentType.PostalCode: // mZip.Text = (component.LongName); // break; // case AddressComponentType.Political: // break; //} } } }
public async Task <PlaceDetails> GetDetails([FromRoute] string id) { HttpClient client = GetHttpClient(); HttpResponseMessage response = await client.GetAsync($"details/json?place_id={id}&fields=name,formatted_address,photo,place_id,vicinity,website,rating,review&key={APIKey}"); var detailsjson = await response.Content.ReadAsStringAsync(); PlaceDetails details = JsonConvert.DeserializeObject <PlaceDetails>(detailsjson); details.apiKey = APIKey; return(details); }
private void place_Click(object sender, EventArgs e) { var button = sender as Button; if (button != null) { PlaceDetails selectedPlace = button.DataContext as PlaceDetails; App.ViewModel.SelectedPlace = selectedPlace; } NavigationService.Navigate(new Uri("/View/ManagePlaces/GetPlace.xaml", UriKind.Relative)); }
private void appBarOkButton_Click(object sender, EventArgs e) { // Get a handle for the to-do item bound to the button. PlaceDetails placeForDelete = App.ViewModel.SelectedPlace; App.ViewModel.DeletePlace(placeForDelete); // Put the focus back to the main page. //this.Focus(); NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); }
public void UpdatePlace(int id, String name, String description, String city, String street, String house_number) { using (PlaceDataContext context = new PlaceDataContext(PlaceDataContext.DBConnectionString)) { IQueryable <PlaceDetails> entityQuery = from c in context.Places where c.PlaceId == id select c; PlaceDetails entityToUpdate = entityQuery.FirstOrDefault(); entityToUpdate.PlaceName = name; entityToUpdate.place_description = description; entityToUpdate.place_city = city; entityToUpdate.place_street = street; entityToUpdate.place_house_number = house_number; context.SubmitChanges(); } }
// Add a to-do item to the database and collections. public void EditPlace(PlaceDetails editedPlace) { // Add a to-do item to the data context. var place = placeDB.Places.Where(p => p.PlaceId == SelectedPlace.PlaceId).FirstOrDefault(); place.PlaceName = editedPlace.PlaceName; place.PlaceCity = editedPlace.PlaceCity; place.PlaceStreet = editedPlace.PlaceStreet; place.PlaceStreetNumber = editedPlace.PlaceStreetNumber; place.PlaceDescription = editedPlace.PlaceDescription; // Save changes to the database. SaveChangesToDB(); }
public void AddPlace(String name, String description, String city, String street, String house_number) { using (PlaceDataContext context = new PlaceDataContext(PlaceDataContext.DBConnectionString)) { PlaceDetails pd = new PlaceDetails(); pd.PlaceName = name; pd.place_description = description; pd.place_city = city; pd.place_street = street; pd.place_house_number = house_number; context.Places.InsertOnSubmit(pd); context.SubmitChanges(); } }
public async Task <IActionResult> Delete([FromRoute] Guid placeId, CancellationToken cancellationToken) { PlaceDetails chat = await _placesData.GetByIdAsync(placeId, cancellationToken); if (chat == null) { return(this.NotFound(new ProblemDetails() { Detail = $"Place with id {placeId} not found." })); } await _placesData.RemoveAsync(placeId, cancellationToken); return(this.Ok()); }
public async Task <IActionResult> Put([FromBody] ChangePlacesInfoCommand command, CancellationToken cancellationToken) { PlaceDetails place = await _placesData.GetByIdAsync(command.PlaceId, cancellationToken); if (place == null) { return(this.NotFound(new ProblemDetails() { Detail = $"Place with id {command.PlaceId} not found." })); } await _placesData.UpdateAsync(command, cancellationToken); return(this.Ok()); }
private static PlaceDetails ConvertToPlaceDetails(PlaceDetailsGoogle placeDetailsesGoogle) { PlaceDetails placeDetails = new PlaceDetails { Id = placeDetailsesGoogle.PlaceId, Phone = placeDetailsesGoogle.FormattedPhoneNumber, Website = new Uri(placeDetailsesGoogle.Website), Location = new Location { Latitude = placeDetailsesGoogle.Geometry.Location.Lat, Longitude = placeDetailsesGoogle.Geometry.Location.Lng }, }; return(placeDetails); }
public async Task <List <PlaceDetails> > GetFavoritesList(List <Favorites> fl) { List <PlaceDetails> pdlist = new List <PlaceDetails>(); HttpClient client = GetHttpClient(); foreach (Favorites f in fl) { HttpResponseMessage response = await client.GetAsync($"details/json?place_id={f.Places}&fields=name,formatted_address,photo,place_id,vicinity,website,rating,review&key={APIKey}"); var detailsjson = await response.Content.ReadAsStringAsync(); PlaceDetails details = JsonConvert.DeserializeObject <PlaceDetails>(detailsjson); pdlist.Add(details); } return(pdlist); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Details); Vm = ((BaseNavigationService)ServiceLocator.Current.GetInstance <INavigationService>()) .GetAndRemoveParameter <PlaceDetails>(Intent); var gridview = FindViewById <GridView>(Resource.Id.gridview); gridview.Adapter = new GridViewAdapter(this, Vm.Result.Photos); gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args) { var intent = new Intent(this, typeof(FullScreenActivity)); intent.PutExtra("photo", Vm.Result.Photos[args.Position].ImageUrl); StartActivity(intent); }; }
/* * Request places details given a list of places (asynchronous). */ public async static Task <List <PlaceDetails> > RequestBatchPlaceDetailsAsync(Place.IdRef[] arrayIdRefs) { List <PlaceDetails> listplacedetails = new List <PlaceDetails>(arrayIdRefs.Length /* default capacity */); foreach (Place.IdRef idref in arrayIdRefs) { PlaceDetails placedetails = await RequestPlaceDetailsAsync(idref); if (null == placedetails) { return(null); } listplacedetails.Add(placedetails); } return(listplacedetails); }