示例#1
0
 private void OnCancelClick(int player, GamePadState state)
 {
     _focusElement?.Dispatcher.Invoke(() => {
         OwnerElement?.RaiseEvent(new RoutedEventArgs(BlockNavigatorProperty.CancelClickEvent, OwnerElement));
         _focusElement?.RaiseEvent(new RoutedEventArgs(BlockNavigatorProperty.CancelClickEvent, _focusElement));
         NavigateBack();
     });
 }
        public void ActivateNestedNavigator(FrameworkElement focusElm)
        {
            IsEnabled = false;
            var nav = BlockNavigatorProperty.GetBlockNavigator(focusElm);

            nav.ParentNavigator = this;
            nav.IsEnabled       = true;

            OwnerElement.RaiseEvent(new RoutedEventArgs(BlockNavigatorProperty.NavigationExitEvent, OwnerElement));
            nav.OwnerElement.RaiseEvent(new RoutedEventArgs(BlockNavigatorProperty.NavigationEnterEvent, nav.OwnerElement));
        }
        public void NavigateBack()
        {
            if (ParentNavigator == null)
            {
                return;
            }

            IsEnabled = false;
            var nav = ParentNavigator;

            nav.IsEnabled = true;
            nav.SetFocus(OwnerElement, false);

            OwnerElement.RaiseEvent(new RoutedEventArgs(BlockNavigatorProperty.NavigationExitEvent, OwnerElement));
            nav.OwnerElement.RaiseEvent(new RoutedEventArgs(BlockNavigatorProperty.NavigationEnterEvent, nav.OwnerElement));
        }
示例#4
0
        private void OnConfirmClick(int player, GamePadState state)
        {
            _focusElement?.Dispatcher.Invoke(() => {
                OwnerElement?.RaiseEvent(new RoutedEventArgs(BlockNavigatorProperty.ConfirmClickEvent, OwnerElement));
                _focusElement?.RaiseEvent(new RoutedEventArgs(BlockNavigatorProperty.ConfirmClickEvent, _focusElement));
                if (BlockNavigatorProperty.GetSimulateMouse(_focusElement))
                {
                    SimulateMouse(_focusElement);
                }

                if (BlockNavigatorProperty.GetIsNestedNavigation(_focusElement))
                {
                    ActivateNestedNavigator(_focusElement);
                }
            });
        }
示例#5
0
 private void OnCancelClick(int player, GamePadState state)
 {
     _focusElement?.Dispatcher.Invoke(() => {
         RoutedEventArgs args = null;
         if (OwnerElement != null)
         {
             args = new RoutedEventArgs(BlockNavigatorProperty.CancelClickEvent, OwnerElement);
             OwnerElement?.RaiseEvent(args);
         }
         if (OwnerElement != _focusElement)
         {
             _focusElement?.RaiseEvent(new RoutedEventArgs(BlockNavigatorProperty.CancelClickEvent, _focusElement));
         }
         if (args == null || args.Handled == false)
         {
             NavigateBack();
         }
     });
 }