Пример #1
0
 private async void OnKeyUp(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == Windows.System.VirtualKey.F11)
     {
         if (SupportFullScreen)
         {
             await ShellControl.TryEnterFullScreenAsync();
         }
     }
     else if (e.Key == Windows.System.VirtualKey.Escape)
     {
         if (SupportFullScreen && ShellControl.IsFullScreen)
         {
             ShellControl.ExitFullScreen();
         }
         else
         {
             NavigationService.GoBack();
         }
     }
 }
Пример #2
0
        public ShellPage()
        {
            InitializeComponent();

            this.DataContext  = this;
            ShellPage.Current = this;

            this.SizeChanged += OnSizeChanged;
            if (SystemNavigationManager.GetForCurrentView() != null)
            {
                SystemNavigationManager.GetForCurrentView().BackRequested += ((sender, e) =>
                {
                    if (SupportFullScreen && ShellControl.IsFullScreen)
                    {
                        e.Handled = true;
                        ShellControl.ExitFullScreen();
                    }
                    else if (NavigationService.CanGoBack())
                    {
                        NavigationService.GoBack();
                        e.Handled = true;
                    }
                });

                NavigationService.Navigated += ((sender, e) =>
                {
                    if (NavigationService.CanGoBack())
                    {
                        SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                    }
                    else
                    {
                        SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
                    }
                });
            }
        }