예제 #1
0
파일: VenueService.cs 프로젝트: BiserB/Memo
        public async Task <IList <Venue> > GetVenuesAsync(double latitude, double longitude)
        {
            var url = VenueBase.GenerateURL(latitude, longitude);

            using (var client = new HttpClient())
            {
                var response = await client.GetAsync(url);

                var json = await response.Content.ReadAsStringAsync();

                var result = JsonConvert.DeserializeObject <VenueBase>(json);

                return(result.Response.Venues);
            }
        }
예제 #2
0
        private static VenueBaseDto CreateHereVenue(VenueBase venue)
        {
            var hereVenue = venue as HereVenue;

            if (hereVenue == null || hereVenue.IsUseless())
            {
                return(null);
            }

            return(new HereVenueDto
            {
                SourceType = venue.SourceType.ToString(),
                Category = venue.Category,
                Title = venue.Title,
                Address = venue.Address,
                ContactPhone = venue.ContactPhone,
                Website = venue.Websites == null ? null : string.Join(", ", venue.Websites),
                OpeningHours = venue.OpeningHours,

                WikipediaContent = hereVenue.WikipediaContent
            });
        }
예제 #3
0
        private static VenueBaseDto CreateFoursquareVenue(VenueBase venue)
        {
            var foursquareVenue = venue as FoursquareVenue;

            if (foursquareVenue == null || foursquareVenue.IsUseless())
            {
                return(null);
            }

            return(new FoursquareVenueDto {
                SourceType = venue.SourceType.ToString(),
                Category = venue.Category,
                Title = venue.Title,
                Address = venue.Address,
                ContactPhone = venue.ContactPhone,
                Website = venue.Websites == null ? null : string.Join(", ", venue.Websites),
                OpeningHours = venue.OpeningHours,

                Rating = foursquareVenue.Rating,
                MaxRating = foursquareVenue.MaxRating,
                RatingColor = foursquareVenue.RatingColor,
                LikesCount = foursquareVenue.LikesCount,
                PriceLevel = foursquareVenue.PriceLevel.HasValue
                    ? string.Join(string.Empty, Enumerable.Range(1, foursquareVenue.PriceLevel.Value).Select(x => foursquareVenue.PriceCurrency))
                    : null,
                RemainingPriceLevel = foursquareVenue.PriceLevel.HasValue
                    ? string.Join(string.Empty, Enumerable.Range(1, foursquareVenue.PriceMaxLevel - foursquareVenue.PriceLevel.Value).Select(x => foursquareVenue.PriceCurrency))
                    : null,
                PhotoUrls = foursquareVenue.PhotoUrls,
                Tags = foursquareVenue.Tags,
                Tips = foursquareVenue.Tips?.Select(x => new FoursquareVenueTipDto {
                    Message = x.Message,
                    Likes = x.Likes,
                    AgreeCount = x.AgreeCount,
                    DisagreeCount = x.DisagreeCount
                }).ToArray()
            });
        }
예제 #4
0
 public static void SetVenue(FrameworkElement dp, VenueBase value)
 {
     dp.SetValue(VenueProperty, value);
 }
예제 #5
0
 public DiscoveredVenueViewModel(VenueBase venue)
 {
     this.Venue = venue;
 }