public ShellViewModel() { Navigation = new AppNavigation(); Navigation.LoadNavigation(); if (Window.Current.Bounds.Width < 800) { this.SplitViewDisplayMode = SplitViewDisplayMode.Overlay; } else { this.SplitViewDisplayMode = SplitViewDisplayMode.CompactOverlay; } Window.Current.SizeChanged += ((args, e) => { WindowSizeChanged(e.Size.Width); }); NavigationService.NavigatedToPage += NavigationService_NavigatedToPage; FullScreenService.FullScreenModeChanged += FullScreenModeChanged; SystemNavigationManager.GetForCurrentView().BackRequested += ((sender, e) => { if (NavigationService.CanGoBack()) { FullScreenService.ExitFullScreenMode(); e.Handled = true; NavigationService.GoBack(); } }); }
/// <summary> /// Dispose 方法 /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (disposing) { FullScreenService.UnRegister(this); } }
private void PageLayout_KeyUp(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e) { if (e.Key == Windows.System.VirtualKey.Escape && ViewModel.CurrentPageName.Contains("DetailPage")) { FullScreenService.ChangeFullScreenMode(); } }
private void PageLayout_KeyUp(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e) { if (FullScreenService.CurrentPageSupportFullScreen) { if (e.Key == Windows.System.VirtualKey.F5) { FullScreenService.EnterFullScreenMode(true); } else if (e.Key == Windows.System.VirtualKey.Escape) { if (isFullScreen) { FullScreenService.ExitFullScreenMode(); } else { TryGoBack(); } } } else { if (e.Key == Windows.System.VirtualKey.Escape) { TryGoBack(); } } }
private void DisableFullScreenClick(object sender, RoutedEventArgs e) { try { FullScreenService.ChangeFullScreenMode(); } catch (Exception) { } }
private void UpdateTrigger(Windows.Graphics.Display.DisplayOrientations orientation) { var qualifiers = Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView().QualifierValues; var isOnMobile = qualifiers.ContainsKey("DeviceFamily") && qualifiers["DeviceFamily"].ToLowerInvariant() == "Mobile".ToLowerInvariant(); if (orientation == Windows.Graphics.Display.DisplayOrientations.Landscape || orientation == Windows.Graphics.Display.DisplayOrientations.LandscapeFlipped) { if (isOnMobile) { FullScreenService.ChangeFullScreenMode(); } } else if (orientation == Windows.Graphics.Display.DisplayOrientations.Portrait || orientation == Windows.Graphics.Display.DisplayOrientations.PortraitFlipped) { if (isOnMobile) { FullScreenService.ChangeFullScreenMode(); } } }