private void Refresh_Click(object sender, RoutedEventArgs e)
 {
     if (loader.SelectedCity != null)
     {
         loader.refreshWeatherData(loader.SelectedCity.id.ToString());
         loader.OnPropertyChanged("Weather");
         DateTime dt = DateTime.Now;
         loader.RefreshMessage = "Last time updated: " + dt.ToString();
     }
 }
        public static void autoRefresh(Object obj)
        {
            WeatherDataLoader loader = obj as WeatherDataLoader;

            while (true)
            {
                Thread.Sleep(5 * 1000);
                if (loader.SelectedCity != null)
                {
                    loader.refreshWeatherData(loader.SelectedCity.id.ToString());
                    loader.OnPropertyChanged("Weather");
                    loader.RefreshMessage = "Last time updated: " + DateTime.Now.ToString();
                }
            }
        }