public void GeoTimezoneInfo_ByTZID()
 {
     // given a TZ ID, find the right GeoTimezone object and check its properties
     foreach (var tz in GeoTimezoneInfo.Windows)
     {
         var g = GeoTimezoneInfo.ByTZID(tz.TZID.ToLowerInvariant());
         Assert.IsNotNull(g);
         Assert.AreEqual(tz.TZID, g.TZID);
     }
 }
예제 #2
0
        public GeoTimezoneInfo GuessTimezone(GeoCountryInfo country)
        {
            if (country == null)
            {
                return(null);
            }

            switch (country.ISO2)
            {
            case "AR": return(GeoTimezoneInfo.ByTZID("America/Buenos_Aires"));

            case "CL": return(GeoTimezoneInfo.ByTZID("America/Santiago"));

            case "JP": return(GeoTimezoneInfo.ByTZID("Asia/Tokyo"));

            case "NZ": return(GeoTimezoneInfo.ByTZID("Pacific/Auckland"));

            case "CH": return(GeoTimezoneInfo.ByTZID("Europe/Zurich"));

            default: return(null);
            }
        }
예제 #3
0
        // --------------------------------------------------
        // Timezone
        public GeoTimezoneInfo LookupTimezone(IGeoLatLon point)
        {
            var response = _google.RequestTimezone(point);

            return(GeoTimezoneInfo.ByTZID(response.TimeZoneId));
        }