コード例 #1
0
 private void RunWithCoords(Coordinates coords)
 {
     while (true)
     {
         if (History == null)
         {
             History = new List <string>();
         }
         Forecast      = WeatherApi.RunAsync(coords).GetAwaiter().GetResult();
         CurrentCityId = Forecast.City.ID;
         if (!(History.Contains(Forecast.City.Name + "," + Forecast.City.Country)))
         {
             History.Add(Forecast.City.Name + "," + Forecast.City.Country);
             History = new List <string>(History);
         }
         RefreshDate = DateTime.Now.ToString(@"HH\:mm\:ss");
         Thread.Sleep(10 * 60 * 1000); // gets fresh data every 10mins
     }
 }