protected override async void OnNavigatedTo(NavigationEventArgs e) { Debug.WriteLine("Calling base.OnNavigatedTo()"); base.OnNavigatedTo(e); Debug.WriteLine("ReadingListItemsPage.OnNavigatedTo()"); // XXX: Probably a better way to do this; LoadState? if (_readingListDataSource == null) { NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged; _readingListDataSource = (ReadingListDataSource)App.Current.Resources["readingListDataSource"]; if (_readingListDataSource == null) { Debug.WriteLine("_readingListDataSource was null!"); return; } DefaultViewModel["Items"] = _readingListDataSource.Items; _readingListDataSource.Items.VectorChanged += Items_VectorChanged; _readingListDataSource.UpdatingStatusChanged += UpdatingStatusChanged; if (_readingListDataSource.Items.Count == 0) { await _readingListDataSource.UpdateReadingList(); } } }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { // Do not repeat app initialization when already running, just ensure that // the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } //RegisterBackgroundTasks(); _applicationData.DataChanged += applicationData_DataChanged; _readingListDataSource = new ReadingListDataSource(); ReadingList = _readingListDataSource.Items; // Setup the Settings command to open our settingsUserControl on the home page SetupSettingsPane(); // Show the home screen ShowReadingListItemsPage(); // Show the settings panel if the username and password aren't set if (!_readingListDataSource.CheckCredentials()) { SettingsPane.Show(); } _updateReadingListTimer = new DispatcherTimer { Interval = TimeSpan.FromMinutes(15) }; _updateReadingListTimer.Tick += UpdateReadingListTimerOnTick; //_updateReadingListTimer.Start(); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { // TODO: Load state from previously suspended application } }