Пример #1
0
        public SurveyPage(GooglePlaceItem gItem)
        {
            InitializeComponent();
            lblRating.Text = sliderRating.Value.ToString();

            SurveyViewModel vm = new SurveyViewModel(gItem);

            vm.Initialize(this);
            BindingContext = vm;
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
 public SurveyViewModel(GooglePlaceItem gItem)
 {
     this.gItem = gItem;
 }