public SurveyPage(GooglePlaceItem gItem) { InitializeComponent(); lblRating.Text = sliderRating.Value.ToString(); SurveyViewModel vm = new SurveyViewModel(gItem); vm.Initialize(this); BindingContext = vm; }
public async Task UpdatePosition(Plugin.Geolocator.Abstractions.Position position) { try { LoadingMessage = "Gettings nearest store"; string coordinates = position.Latitude + "," + position.Longitude; //hardcoded cordinates for demo purpose, change it to "coordinates" gItem = await ServiceLocator.GooglePlacesService.GetPlacesAsync("40.76875440000001,-111.8907201"); if (gItem != null) { IsSurveyVisible = true; Location = "You are at" + Environment.NewLine + gItem.name + Environment.NewLine + gItem.vicinity; if (gItem.photos != null && gItem.photos.Count > 0) { this.Image = string.Format(Helpers.Constants.GOOGLE_PLACES_IMAGE_BASE_URL, gItem.photos[0].photo_reference); } } else { Location = "No stores nearby offer discounts " + coordinates; IsSurveyVisible = false; } IsBusy = false; } catch (Exception ex) { Debug.WriteLine(ex.Message); IsBusy = false; } }
public SurveyViewModel(GooglePlaceItem gItem) { this.gItem = gItem; }