public MainPage() { //Initialize all the things this.InitializeComponent(); VoiceController.InitializeSpeechRecognizer(); MirrorState.InitialMirrorState(); _clockTimer = new DispatcherTimer(); _todaysWeatherTimer = new DispatcherTimer(); _tomorrowsWeatherTimer = new DispatcherTimer(); _weeksWeatherTimer = new DispatcherTimer();; _refreshRateTimer = new DispatcherTimer(); //Set the refresh rates on the timers _clockTimer.Interval = TimeSpan.FromSeconds(ClockRefreshRate); _todaysWeatherTimer.Interval = TimeSpan.FromSeconds(TodaysWeatherRefreshRate); _tomorrowsWeatherTimer.Interval = TimeSpan.FromHours(TomorrowsWeatherRefreshRate); _weeksWeatherTimer.Interval = TimeSpan.FromHours(WeeksWeatherRefreshRate); _refreshRateTimer.Interval = TimeSpan.FromMilliseconds(DisplayRefreshRate); //Set all the flags for updates to true at start _clockTicked = true; _todaysWeatherTicked = true; _tomorrowsWeatherTicked = true; _weeksWeatherTicked = true; //Populate all weather information at the beginning WeatherLogic.UpdateTodaysWeather(); WeatherLogic.UpdateTomorrowsWeather(); WeatherLogic.UpdateThisWeeksWeather(); //Start the program StartTimers(); RefreshDisplay(); }
private void UpdateTomorrowsWeatherDisplay() { WeatherLogic.UpdateTomorrowsWeather(); if (MirrorState.IsConnectedToInternet()) { TomorrowsWeatherLocationTextBlock.Text = WeatherLogic.GetCurrentLocation(); TomorrowsWeatherLastUpdateDate.Text = WeatherLogic.GetTomorrowsLastUpdateDay(); Time6AM.Text = WeatherLogic.Get6AMTime(); Temp6AM.Text = WeatherLogic.Get6AMTemp(); Weather6AM.Source = new BitmapImage(new Uri(WeatherLogic.Get6AMWeatherIcon())); Time9AM.Text = WeatherLogic.Get9AMTime(); Temp9AM.Text = WeatherLogic.Get9AMTemp(); Weather9AM.Source = new BitmapImage(new Uri(WeatherLogic.Get9AMWeatherIcon())); Time12PM.Text = WeatherLogic.Get12PMTime(); Temp12PM.Text = WeatherLogic.Get12PMTemp(); Weather12PM.Source = new BitmapImage(new Uri(WeatherLogic.Get12PMWeatherIcon())); Time3PM.Text = WeatherLogic.Get3PMTime(); Temp3PM.Text = WeatherLogic.Get3PMTemp(); Weather3PM.Source = new BitmapImage(new Uri(WeatherLogic.Get3PMWeatherIcon())); Time6PM.Text = WeatherLogic.Get6PMTime(); Temp6PM.Text = WeatherLogic.Get6PMTemp(); Weather6PM.Source = new BitmapImage(new Uri(WeatherLogic.Get6PMWeatherIcon())); Time9PM.Text = WeatherLogic.Get9PMTime(); Temp9PM.Text = WeatherLogic.Get9PMTemp(); Weather9PM.Source = new BitmapImage(new Uri(WeatherLogic.Get9PMWeatherIcon())); TomorrowsHighTextBlock.Text = WeatherLogic.GetTomorrowsHighTemp(); TomorrowsLowTextBlock.Text = WeatherLogic.GetTomorrowsLowTemp(); } }