/// <summary> /// Lists available website locations. /// </summary> /// <returns>List of location names</returns> public List <string> ListAvailableLocations() { List <string> locations = new List <string>(); WebSpaces webspaces = WebsiteChannel.GetWebSpaces(subscriptionId); List <string> webspacesGeoRegions = new List <string>(); webspaces.ForEach(w => webspacesGeoRegions.Add(w.GeoRegion)); GeoRegions regions = new GeoRegions(); using (HttpClient client = CreateWebsitesHttpClient()) { regions = client.GetXml <GeoRegions>(UriElements.WebSpacesGeoRegionsRoot, Logger); } regions.ForEach(r => locations.Add(r.Name)); locations = locations.Union(webspacesGeoRegions).ToList(); return(locations); }
private int MatchAirports(IEnumerable <airport> rgap) { int cUniqueAirports = 0; HashSet <string> hsThisFlight = new HashSet <string>(); foreach (airport ap in rgap) { // Dedupe as we go based on latitude/longitude, ignoring non-ports. // We don't actually need the facility name here - so we can just round off the latitude/longitude and distinguish by type code. // Note: this can differ slightly from Visited Airports counts because for achievements, we're ignoring flights in training devices; visited airports doesn't ignore them. if (ap.IsPort) { string szHash = ap.GeoHashKey; if (!Airports.Contains(szHash)) { Airports.Add(ap.GeoHashKey); cUniqueAirports++; } hsThisFlight.Add(szHash); string szCountry = ap.CountryDisplay; string szAdmin1 = ap.Admin1Display; // Keep track of visited countries/regions if (!String.IsNullOrWhiteSpace(szCountry)) { if (!GeoRegions.ContainsKey(szCountry)) { GeoRegions[szCountry] = new HashSet <string>(); } if (!String.IsNullOrWhiteSpace(szAdmin1) && !GeoRegions[szCountry].Contains(szAdmin1)) { GeoRegions[szCountry].Add(szAdmin1); } } } } return(hsThisFlight.Count); }
/// <summary> /// Lists available website locations. /// </summary> /// <returns>List of location names</returns> public List<string> ListAvailableLocations() { List<string> locations = new List<string>(); WebSpaces webspaces = WebsiteChannel.GetWebSpaces(subscriptionId); List<string> webspacesGeoRegions = new List<string>(); webspaces.ForEach(w => webspacesGeoRegions.Add(w.GeoRegion)); GeoRegions regions = new GeoRegions(); using (HttpClient client = CreateWebsitesHttpClient()) { regions = client.GetXml<GeoRegions>(UriElements.WebSpacesGeoRegionsRoot, Logger); } regions.ForEach(r => locations.Add(r.Name)); locations = locations.Union(webspacesGeoRegions).ToList(); return locations; }