Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
 //------------------------------------------------------------------------------------------------
 //----------------------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();
     }
 }