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
 //When the program ends, kill the speech recognizer
 public static async void MainPage_Unloaded(object sender, object args)
 {
     //Stop voice recognition
     VoiceController.UnloadSpeechRecognizer();
 }