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(); } }
private void UpdateWeeksWeatherForecastDisplay() { WeatherLogic.UpdateThisWeeksWeather(); if (MirrorState.IsConnectedToInternet()) { //WeeksWeatherLocationTextBlock.Text = WeatherLogic.GetCurrentLocation(); ForecastDay1Date.Text = WeatherLogic.GetDay1Date(); ForecastDay1High.Text = WeatherLogic.GetDay1HighTemp(); ForecastDay1Low.Text = WeatherLogic.GetDay1LowTemp(); ForecastDay1Weather.Source = new BitmapImage(new Uri(WeatherLogic.GetDay1WeatherIcon())); ForecastDay2Date.Text = WeatherLogic.GetDay2Date(); ForecastDay2High.Text = WeatherLogic.GetDay2HighTemp(); ForecastDay2Low.Text = WeatherLogic.GetDay2LowTemp(); ForecastDay2Weather.Source = new BitmapImage(new Uri(WeatherLogic.GetDay2WeatherIcon())); ForecastDay3Date.Text = WeatherLogic.GetDay3Date(); ForecastDay3High.Text = WeatherLogic.GetDay3HighTemp(); ForecastDay3Low.Text = WeatherLogic.GetDay3LowTemp(); ForecastDay3Weather.Source = new BitmapImage(new Uri(WeatherLogic.GetDay3WeatherIcon())); ForecastDay4Date.Text = WeatherLogic.GetDay4Date(); ForecastDay4High.Text = WeatherLogic.GetDay4HighTemp(); ForecastDay4Low.Text = WeatherLogic.GetDay4LowTemp(); ForecastDay4Weather.Source = new BitmapImage(new Uri(WeatherLogic.GetDay4WeatherIcon())); ForecastDay5Date.Text = WeatherLogic.GetDay5Date(); ForecastDay5High.Text = WeatherLogic.GetDay5HighTemp(); ForecastDay5Low.Text = WeatherLogic.GetDay5LowTemp(); ForecastDay5Weather.Source = new BitmapImage(new Uri(WeatherLogic.GetDay5WeatherIcon())); } }
//------------------------------------------------------------------------------------------------ //----------------------Modify XAML Elements For Each Weather Component--------------------------- //------------------------------------------------------------------------------------------------ private void UpdateTodaysWeatherDisplay() { WeatherLogic.UpdateTodaysWeather(); if (MirrorState.IsConnectedToInternet()) { TodaysWeatherTypeImage.Source = new BitmapImage(new Uri(WeatherLogic.GetTodaysWeatherIcon())); TodaysWeatherLocationTextBlock.Text = WeatherLogic.GetCurrentLocation(); TodaysWeatherTempTextBlock.Text = WeatherLogic.GetTodaysTemperature(); TodaysWeatherHiTempTextBlock.Text = WeatherLogic.GetTodaysHiTemp(); TodaysWeatherLowTempTextBlock.Text = WeatherLogic.GetTodaysLowTemp(); TodaysWeatherDate.Text = WeatherLogic.GetTodaysLastUpdateDay(); } }