private async void Page_Loaded(object sender, RoutedEventArgs e) { try { ApplicationView.GetForCurrentView().SetPreferredMinSize(LocalConfiguration.WindowMinSize); SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested; // Update app constants from server AppConstants.Update(); // Update assets from server AssetManager.UpdateAssets(); // Play silent sound to avoid suspending the app when it's minimized. silentMediaPlayer.Play(); // Media controls are necessary for the audio to continue when app is minimized. MediaControlsHelper.Init(Dispatcher); MediaControlsHelper.TrackChanged += (ss, trackChangedArgs) => { if (nowPlaying.IsOpen) { nowPlaying.PlayChangeTrackAnimation( reverse: (trackChangedArgs.Direction == TrackChangeDirection.Backward)); } }; // Show what's new if necessary if (WhatsNewHelper.ShouldShowWhatsNew()) { shouldShowWhatsNew = true; } LyricsViewerIntegrationHelper.InitIntegration(); LiveTileHelper.InitLiveTileUpdates(); JumpListHelper.DeleteRecentJumplistEntries(); AnalyticsHelper.PageView("MainPage", setNewSession: true); AnalyticsHelper.Log("mainEvent", "appOpened", SystemInformation.OperatingSystemVersion.ToString()); developerMessage = await DeveloperMessageHelper.GetNextDeveloperMessage(); // Window.Current.CoreWindow.KeyDown does not capture Alt events, but AcceleratorKeyActivated does. // NOTE: This event captures all key events, even when WebView is focused. CoreWindow.GetForCurrentThread().Dispatcher.AcceleratorKeyActivated += Dispatcher_AcceleratorKeyActivated; } catch (Exception ex) { AnalyticsHelper.Log("mainPageLoadedException", ex.Message, ex.ToString()); await new MessageDialog(ex.ToString(), "MainPage:Loaded unhandled exception").ShowAsync(); } }
private async void Page_Loaded(object sender, RoutedEventArgs e) { ApplicationView.GetForCurrentView().SetPreferredMinSize(LocalConfiguration.WindowMinSize); SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested; // Update app constants from server AppConstants.Update(); // Update assets from server AssetManager.UpdateAssets(); // Play silent sound to avoid suspending the app when it's minimized. silentMediaPlayer.Play(); // Media controls are necessary for the audio to continue when app is minimized. MediaControlsHelper.Init(Dispatcher); MediaControlsHelper.TrackChanged += (ss, trackChangedArgs) => { if (nowPlaying.IsOpen) { nowPlaying.PlayChangeTrackAnimation( reverse: (trackChangedArgs.Direction == TrackChangeDirection.Backward)); } }; // Show what's new if necessary if (WhatsNewHelper.ShouldShowWhatsNew()) { shouldShowWhatsNew = true; } AnalyticsHelper.PageView("MainPage"); AnalyticsHelper.Log("mainEvent", "appOpened", SystemInformation.OperatingSystemVersion.ToString()); developerMessage = await DeveloperMessageHelper.GetNextDeveloperMessage(); LyricsViewerIntegrationHelper.InitIntegration(); LiveTileHelper.InitLiveTileUpdates(); JumpListHelper.DeleteRecentJumplistEntries(); }