コード例 #1
0
        private void UpdateCurrentConditions()
        {
            string errorMsg = WeatherController.GetErrorMsg();

            if (errorMsg != "")
            {
                // Add error dialog popup
                return;
            }
            SetCurrentConditions(WeatherController.GetCurrTemp(), WeatherController.GetConditionsMsg());
            errorMsg = WeatherController.GetErrorMsg();
            if (errorMsg != "")
            {
                // Add error dialog popup
                return;
            }
            SetTodaysForecast(WeatherController.GetHighTemp(), WeatherController.GetLowTemp());
        }
コード例 #2
0
ファイル: App.xaml.cs プロジェクト: aWilson41/Smart-Mirror
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            // Template junk for setting up initial page
            frame = Window.Current.Content as Frame;

            // If the frame hasn't been created yet then create it
            if (frame == null)
            {
                frame = new Frame();
                frame.NavigationFailed += OnNavigationFailed;

                //if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                //{
                //// TODO: Load state from previously suspended application
                //}

                // Place the frame in the current Window
                Window.Current.Content = frame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (frame.Content == null)
                {
                    // On app start we should update the weather
                    WeatherController.UpdateCurrentConditions(null, null);
                    WeatherController.UpdateTodaysForecast(null, null);
                    WeatherController.UpdateHourlyForecast(null, null);
                    WeatherController.Update10DayForecast(null, null);

                    // Navigate to a new main page and save that main page
                    frame.Navigate(typeof(CalendarPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }
        }