private void Page_Loaded(object sender, RoutedEventArgs e) { startStoryboard.Begin(); DeviceInfo.RefreshFormFactorType(); if ((DeviceInfo.SystemVersion > DeviceInfo.CreatorsUpdate) && (DeviceInfo.FormFactorType == DeviceInfo.DeviceFormFactorType.Desktop)) { WindowTopBarFunctions.ApplyAcrylic(); TitleBarStackPanel.Visibility = Visibility.Visible; } ActivatePCExtensionPrompt.Visibility = PCExtensionHelper.IsSupported ? Visibility.Visible : Visibility.Collapsed; HideFlipViewButton("PreviousButtonHorizontal"); HideFlipViewButton("NextButtonHorizontal"); string dot = Convert.ToChar(8226).ToString(); indicators = new TextBlock[flipView.Items.Count]; for (int i = 0; i < flipView.Items.Count; i++) { indicators[i] = new TextBlock() { Margin = new Thickness(2, 0, 2, 0), Text = dot, Opacity = (i == 0) ? 1 : 0.5, }; PageIndicators.Children.Add(indicators[i]); } WhatsNewHelper.InitIntro(); }
public void InitFlyout() { bool changelogPresent = false; var ids = WhatsNewHelper.GetWhatsNewContentIdAndMarkAsRead(); foreach (var item in Content.Children) { var sp = item as StackPanel; if (sp == null) { continue; } if (ids.Contains(sp.Tag.ToString())) { changelogPresent = true; sp.Visibility = Visibility.Visible; } else { sp.Visibility = Visibility.Collapsed; } } if (!changelogPresent) { FlyoutCloseRequest?.Invoke(this, new EventArgs()); } #if !DEBUG //App.Tracker.Send(HitBuilder.CreateCustomEvent("What's new", "Show", DeviceInfo.ApplicationVersionString).Build()); #endif }
private async void MarkdownTextBlock_Loading(FrameworkElement sender, object args) { if (sender is MarkdownTextBlock markdownTextBlock) { markdownTextBlock.Text = await WhatsNewHelper.GetJsonStringAsync(); } }
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(); }
public void InitFlyout() { bool changelogPresent = false; var ids = WhatsNewHelper.GetWhatsNewContentId(); foreach (var item in Content.Children) { var sp = item as StackPanel; if (sp == null) { continue; } if (ids.Contains(sp.Tag.ToString())) { changelogPresent = true; sp.Visibility = Visibility.Visible; } else { sp.Visibility = Visibility.Collapsed; } } if (!changelogPresent) { FlyoutCloseRequest?.Invoke(this, new EventArgs()); } if (ids.Count == 1) { bool specialHeaderPresent = (from x in Header.Children let fe = x as FrameworkElement where ((fe != null) && (fe.Tag != null) && (fe.Tag.ToString() == ids[0])) select x).Count() > 0; foreach (var item in Header.Children) { var fe = item as FrameworkElement; if (fe == null) { continue; } if (specialHeaderPresent) { if ((fe.Tag == null) || (fe.Tag.ToString() != ids[0])) { fe.Visibility = Visibility.Collapsed; } else { fe.Visibility = Visibility.Visible; } } else { if (!string.IsNullOrEmpty(fe.Tag as string)) { fe.Visibility = Visibility.Collapsed; } } } bool specialFooterPresent = (from x in Footer.Children let fe = x as FrameworkElement where ((fe != null) && (fe.Tag != null) && (fe.Tag.ToString() == ids[0])) select x).Count() > 0; foreach (var item in Footer.Children) { var fe = item as FrameworkElement; if (fe == null) { continue; } if (specialFooterPresent) { if ((fe.Tag == null) || (fe.Tag.ToString() != ids[0])) { fe.Visibility = Visibility.Collapsed; } else { fe.Visibility = Visibility.Visible; } } else { if (!string.IsNullOrEmpty(fe.Tag as string)) { fe.Visibility = Visibility.Collapsed; } } } } #if !DEBUG App.Tracker.Send(HitBuilder.CreateCustomEvent("What's new", "Show", DeviceInfo.ApplicationVersionString).Build()); #endif }
private async void Page_Loaded(object sender, RoutedEventArgs e) { InitTitleBar(); ApplicationView.GetForCurrentView().SetPreferredMinSize(LocalConfiguration.WindowMinSize); Window.Current.CoreWindow.Activated += Window_Activated; 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. var mediaControls = SystemMediaTransportControls.GetForCurrentView(); mediaControls.IsEnabled = true; mediaControls.IsPreviousEnabled = true; mediaControls.IsNextEnabled = true; mediaControls.IsPlayEnabled = true; mediaControls.IsPauseEnabled = true; mediaControls.PlaybackStatus = MediaPlaybackStatus.Paused; mediaControls.ButtonPressed += SystemControls_ButtonPressed; await mediaControls.DisplayUpdater.CopyFromFileAsync(MediaPlaybackType.Music, await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/Media/silent.wav"))); PlayStatusTracker.MediaControls = mediaControls; PlayStatusTracker.StartRegularRefresh(); // Show what's new if necessary if (WhatsNewHelper.ShouldShowWhatsNew()) { shouldShowWhatsNew = true; } webViewCheckTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1), }; webViewCheckTimer.Tick += WebViewCheckTimer_Tick; webViewCheckTimer.Start(); clipboardCheckTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(3), }; clipboardCheckTimer.Tick += ClipboardCheckTimer_Tick; clipboardCheckTimer.Start(); stuckDetectTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(4), }; stuckDetectTimer.Tick += StuckDetectTimer_Tick; stuckDetectTimer.Start(); AnalyticsHelper.PageView("MainPage"); AnalyticsHelper.Log("mainEvent", "appOpened", SystemInformation.OperatingSystemVersion.ToString()); if (ThemeHelper.GetCurrentTheme() == Theme.Light) { splashScreenToLightStoryboard.Begin(); } developerMessage = await DeveloperMessageHelper.GetNextDeveloperMessage(); LyricsViewerIntegrationHelper.InitIntegration(); LiveTileHelper.InitLiveTileUpdates(); JumpListHelper.DeleteRecentJumplistEntries(); }