private void InvokeBack(NavigationBackingOrForwardingEventArgs earg)
        {
            if (PageBacking == null)
            {
                return;
            }
            var lt = PageBacking.GetInvocationList().Reverse();

            foreach (EventHandler <NavigationBackingOrForwardingEventArgs> one in lt)
            {
                one.Invoke(this, earg);
            }
        }
        /// <summary>
        /// 当此页处于活动状态并占用整个窗口时,在每次
        /// 击键(包括系统键,如 Alt 组合键)时调用。    用于检测页之间的键盘
        /// 导航(即使在页本身没有焦点时)。
        /// </summary>
        /// <param name="sender">触发事件的实例。</param>
        /// <param name="e">描述导致事件的条件的事件数据。</param>
        private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs e)
        {
            if (!e.Handled)
            {
                var virtualKey = e.VirtualKey;

                // 仅当按向左、向右或专用上一页或下一页键时才进一步
                // 调查
                if ((e.EventType == CoreAcceleratorKeyEventType.SystemKeyDown ||
                     e.EventType == CoreAcceleratorKeyEventType.KeyDown) &&
                    (virtualKey == VirtualKey.Left || virtualKey == VirtualKey.Right ||
                     (int)virtualKey == 166 || (int)virtualKey == 167))
                {
                    var  coreWindow  = Window.Current.CoreWindow;
                    var  downState   = CoreVirtualKeyStates.Down;
                    bool menuKey     = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState;
                    bool controlKey  = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState;
                    bool shiftKey    = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState;
                    bool noModifiers = !menuKey && !controlKey && !shiftKey;
                    bool onlyAlt     = menuKey && !controlKey && !shiftKey;

                    if (((int)virtualKey == 166 && noModifiers) ||
                        (virtualKey == VirtualKey.Left && onlyAlt))
                    {
                        // 在按上一页键或 Alt+向左键时向后导航
                        e.Handled = true;
                        var ev = new NavigationBackingOrForwardingEventArgs(NavigationBackingOrForwardingEventArgs.NavigationEventSource.Mouse);
                        InvokeBack(ev);
                        if (!ev.Handled)
                        {
                            this.GoBackCommand.Execute(null);
                        }
                    }
                    else if (((int)virtualKey == 167 && noModifiers) ||
                             (virtualKey == VirtualKey.Right && onlyAlt))
                    {
                        // 在按下一页键或 Alt+向右键时向前导航
                        e.Handled = true;
                        var ev = new NavigationBackingOrForwardingEventArgs(NavigationBackingOrForwardingEventArgs.NavigationEventSource.Mouse)
                        {
                            IsForward = true
                        };
                        PageBacking?.Invoke(this, ev);
                        if (!ev.Handled)
                        {
                            this.GoForwardCommand.Execute(null);
                        }
                    }
                }
            }
        }
 /// <summary>
 /// 在按下硬件“后退”按钮时调用。仅适用于 Windows Phone。
 /// </summary>
 /// <param name="sender">触发事件的实例。</param>
 /// <param name="e">描述导致事件的条件的事件数据。</param>
 private void HardwareButtons_BackPressed(object sender, BackRequestedEventArgs e)
 {
     if (!e.Handled)
     {
         var ev = new NavigationBackingOrForwardingEventArgs(NavigationBackingOrForwardingEventArgs.NavigationEventSource.System);
         InvokeBack(ev);
         if (!ev.Handled)
         {
             if (this.GoBackCommand.CanExecute(null))
             {
                 e.Handled = true;
                 this.GoBackCommand.Execute(null);
             }
         }
         else
         {
             e.Handled = true;
         }
     }
 }
        /// <summary>
        /// 当此页处于活动状态并占用整个窗口时,在每次鼠标单击、触摸屏点击
        /// 或执行等效交互时调用。    用于检测浏览器样式下一页和
        /// 上一步鼠标按钮单击以在页之间导航。
        /// </summary>
        /// <param name="sender">触发事件的实例。</param>
        /// <param name="e">描述导致事件的条件的事件数据。</param>
        private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs e)
        {
            if (/*!e.Handled*/ true)
            {
                var properties = e.CurrentPoint.Properties;

                // 忽略与鼠标左键、右键和中键的键关联
                if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed ||
                    properties.IsMiddleButtonPressed)
                {
                    return;
                }

                // 如果按下后退或前进(但不是同时),则进行相应导航
                bool backPressed    = properties.IsXButton1Pressed;
                bool forwardPressed = properties.IsXButton2Pressed;
                if (backPressed ^ forwardPressed)
                {
                    e.Handled = true;
                    var ev = new NavigationBackingOrForwardingEventArgs(NavigationBackingOrForwardingEventArgs.NavigationEventSource.Mouse);
                    InvokeBack(ev);
                    if (!ev.Handled)
                    {
                        if (backPressed)
                        {
                            this.GoBackCommand.Execute(null);
                        }
                        if (forwardPressed)
                        {
                            ev.IsForward = true;
                            this.GoForwardCommand.Execute(null);
                        }
                    }
                }
            }
        }