Beispiel #1
0
        public string GetMapsUri(string url, ref string refText)
        {
            if (!AppendSettingDialog.Instance.IsPreviewFoursquare)
            {
                return(null);
            }

            var urlId = Regex.Replace(url, @"https?://(4sq|foursquare)\.com/", "");

            if (CheckInUrlsVenueCollection.ContainsKey(urlId))
            {
                refText = CheckInUrlsVenueCollection[urlId].LocateInfo;
                return(new Google().CreateGoogleStaticMapsUri(CheckInUrlsVenueCollection[urlId]));
            }

            FourSquareDataModel.Venue curVenue = null;
            var venueId = GetVenueId(url);

            if (string.IsNullOrEmpty(venueId))
            {
                return(null);
            }

            curVenue = GetVenueInfo(venueId);
            if (curVenue == null)
            {
                return(null);
            }

            var curLocation = new Google.GlobalLocation {
                Latitude = curVenue.Location.Latitude, Longitude = curVenue.Location.Longitude, LocateInfo = CreateVenueInfoText(curVenue)
            };

            //例外発生の場合があるため
            if (!CheckInUrlsVenueCollection.ContainsKey(urlId))
            {
                CheckInUrlsVenueCollection.Add(urlId, curLocation);
            }
            refText = curLocation.LocateInfo;
            return(new Google().CreateGoogleStaticMapsUri(curLocation));
        }
Beispiel #2
0
        public string GetMapsUri(string url, ref string refText)
        {
            if (!AppendSettingDialog.Instance.IsPreviewFoursquare) return null;

            var urlId = Regex.Replace(url, @"https?://(4sq|foursquare)\.com/", "");

            if (CheckInUrlsVenueCollection.ContainsKey(urlId))
            {
                refText = CheckInUrlsVenueCollection[urlId].LocateInfo;
                return new Google().CreateGoogleStaticMapsUri(CheckInUrlsVenueCollection[urlId]);
            }

            FourSquareDataModel.Venue curVenue = null;
            var venueId = GetVenueId(url);
            if (string.IsNullOrEmpty(venueId)) return null;

            curVenue = GetVenueInfo(venueId);
            if (curVenue == null) return null;

            var curLocation = new Google.GlobalLocation {Latitude = curVenue.Location.Latitude, Longitude = curVenue.Location.Longitude, LocateInfo = CreateVenueInfoText(curVenue)};
            //例外発生の場合があるため
            if (!CheckInUrlsVenueCollection.ContainsKey(urlId)) CheckInUrlsVenueCollection.Add(urlId, curLocation);
            refText = curLocation.LocateInfo;
            return new Google().CreateGoogleStaticMapsUri(curLocation);
        }