• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Core.AcceleratorKeyEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Windows.UI.Core.AcceleratorKeyEventArgs的典型用法代码示例。如果您正苦于以下问题:C# AcceleratorKeyEventArgs类的具体用法?C# AcceleratorKeyEventArgs怎么用?C# AcceleratorKeyEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AcceleratorKeyEventArgs类属于Windows.UI.Core命名空间,在下文中一共展示了AcceleratorKeyEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CoreDispatcher_AcceleratorKeyActivated

        /// <summary>
        ///     Invoked on every keystroke, including system keys such as Alt key combinations, when
        ///     this page is active and occupies the entire window.  Used to detect keyboard navigation
        ///     between pages even when the page itself doesn't have focus.
        /// </summary>
        /// <param name="sender">Instance that triggered the event.</param>
        /// <param name="args">Event data describing the conditions that led to the event.</param>
        private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
        {
            var virtualKey = args.VirtualKey;

            // Only investigate further when Left, Right, or the dedicated Previous or Next keys are pressed
            if ((args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown || args.EventType == CoreAcceleratorKeyEventType.KeyDown) &&
                (virtualKey == VirtualKey.Left || virtualKey == VirtualKey.Right || (int)virtualKey == 166 || (int)virtualKey == 167))
            {
                var coreWindow = Window.Current.CoreWindow;
                var downState = CoreVirtualKeyStates.Down;
                var menuKey = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState;
                var controlKey = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState;
                var shiftKey = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState;
                var noModifiers = !menuKey && !controlKey && !shiftKey;
                var onlyAlt = menuKey && !controlKey && !shiftKey;

                if (((int)virtualKey == 166 && noModifiers) || (virtualKey == VirtualKey.Left && onlyAlt))
                {
                    // When the previous key or Alt+Left are pressed navigate back
                    args.Handled = true;
                    GoBack(this, new RoutedEventArgs());
                }
                else if (((int)virtualKey == 167 && noModifiers) || (virtualKey == VirtualKey.Right && onlyAlt))
                {
                    // When the next key or Alt+Right are pressed navigate forward
                    args.Handled = true;
                    GoForward(this, new RoutedEventArgs());
                }
            }
        }
开发者ID:stevehansen,项目名称:vidyano_v1,代码行数:37,代码来源:LayoutAwarePage.cs


示例2: HandleKeyDown

        private void HandleKeyDown(AcceleratorKeyEventArgs args)
        {
            var alt = (Window.Current.CoreWindow.GetKeyState(VirtualKey.Menu) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;
            var shift = (Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;
            var control = (Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;
            var windows = ((Window.Current.CoreWindow.GetKeyState(VirtualKey.LeftWindows) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down) || ((Window.Current.CoreWindow.GetKeyState(VirtualKey.RightWindows) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down);
            var character = ToChar(args.VirtualKey, shift);

            System.Diagnostics.Debug.WriteLine("{0} alt:{1} shift:{2} control:{3} windows:{4} virt:{5}", character, alt, shift, control, windows, args.VirtualKey);

            var keyDown = new KeyboardEventArgs
            {
                AltKey = alt,
                Character = character,
                ControlKey = control,
                EventArgs = args,
                ShiftKey = shift,
                VirtualKey = args.VirtualKey
            };
            try { KeyDown?.Invoke(keyDown); } catch { }

            if (windows && (character == 'z' || character == 'Z'))
            {
                RaiseWindowZGestured();
            }
            else if (args.KeyStatus.IsExtendedKey && args.VirtualKey == VirtualKey.Back)
            {
                RaiseGoBackGestured();
            }
            else
            {
                return;
            }
            args.Handled = true;
        }
开发者ID:joshberry,项目名称:Template10,代码行数:35,代码来源:KeyboardHelper.cs


示例3: CoreDispatcher_AcceleratorKeyActivated

        private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs e)
        {
            if ((e.EventType == CoreAcceleratorKeyEventType.SystemKeyDown ||
                e.EventType == CoreAcceleratorKeyEventType.KeyDown))
            {
                var coreWindow = Windows.UI.Xaml.Window.Current.CoreWindow;
                var downState = CoreVirtualKeyStates.Down;
                var virtualKey = e.VirtualKey;
                bool winKey = ((coreWindow.GetKeyState(VirtualKey.LeftWindows) & downState) == downState || (coreWindow.GetKeyState(VirtualKey.RightWindows) & downState) == downState);
                bool altKey = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState;
                bool controlKey = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState;
                bool shiftKey = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState;

                // raise keydown actions
                var keyDown = new KeyboardEventArgs
                {
                    AltKey = altKey,
                    Character = ToChar(virtualKey, shiftKey),
                    ControlKey = controlKey,
                    EventArgs = e,
                    ShiftKey = shiftKey,
                    VirtualKey = virtualKey
                };

                try { _KeyDown?.Raise(this, keyDown); }
                catch { }

                // Handle F5 to refresh content
                if (virtualKey == VirtualKey.F5)
                {
                    bool noModifiers = !altKey && !controlKey && !shiftKey;
                    _RefreshRequest?.Raise(this, keyDown);
                }
            }
        }
开发者ID:ZedTheYeti,项目名称:Hangups-UWP,代码行数:35,代码来源:KeyboardService.cs


示例4: CoreDispatcher_AcceleratorKeyActivated

        private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
        {
            if (args.EventType.ToString().Contains("Down") && !args.Handled)
            {
                var alt = (Window.Current.CoreWindow.GetKeyState(VirtualKey.Menu) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;
                var shift = (Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;
                var control = (Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;
                var windows = ((Window.Current.CoreWindow.GetKeyState(VirtualKey.LeftWindows) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down) || ((Window.Current.CoreWindow.GetKeyState(VirtualKey.RightWindows) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down);
                var character = ToChar(args.VirtualKey, shift);

                var keyDown = new KeyboardEventArgs
                {
                    AltKey = alt,
                    Character = character,
                    ControlKey = control,
                    EventArgs = args,
                    ShiftKey = shift,
                    VirtualKey = args.VirtualKey
                };

                try { KeyDown?.Invoke(keyDown); }
                finally
                {
                    args.Handled = keyDown.Handled;
                }
            }
        }
开发者ID:haroldma,项目名称:Audiotica,代码行数:27,代码来源:KeyboardHelper.cs


示例5: CoreDispatcher_AcceleratorKeyActivated

        /// <summary>
        /// Invoked on every keystroke, including system keys such as Alt key combinations, when
        /// this page is active and occupies the entire window. Used to detect keyboard navigation
        /// between pages even when the page itself doesn't have focus.
        /// </summary>
        private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
        {
            var virtualKey = args.VirtualKey;

            // Only investigate further when Left, Right, or the dedicated Previous or Next keys
            // are pressed
            if ((args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown ||
                args.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))
                {
                    // When the previous key or Alt+Left are pressed navigate back
                    args.Handled = true;
                    var vm = DataContext as FrameworkPageViewModel;
                    if (vm != null)
                    {
                        vm.NavigateBack();
                    }
                }
            }
        }
开发者ID:ryanhorath,项目名称:Rybird.Framework,代码行数:37,代码来源:WindowsruntimePage.cs


示例6: OnAcceleratorKeyActivated

 private void OnAcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
 {
     // Ensures the ENTER key always runs the same code as your default button.
     if (args.EventType == CoreAcceleratorKeyEventType.KeyDown && args.VirtualKey == VirtualKey.Enter)
     {
         _searchViewModel.LaunchSearch();
     }
 }
开发者ID:stephgou,项目名称:Thot,代码行数:8,代码来源:SearchPage.xaml.cs


示例7: CoreDispatcher_AcceleratorKeyActivated

 private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
 {
     if (args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown
         || args.EventType == CoreAcceleratorKeyEventType.KeyDown)
     {
         HandleKeyDown(args);
     }
 }
开发者ID:joshberry,项目名称:Template10,代码行数:8,代码来源:KeyboardHelper.cs


示例8: AcceleratorKeyActivated

			public void AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
			{
				if (args.VirtualKey == VirtualKey.Control)
					ctrlDown = args.EventType == CoreAcceleratorKeyEventType.KeyDown;

				if (args.VirtualKey == VirtualKey.F3 || (args.VirtualKey == VirtualKey.F && ctrlDown))
				{
					searchKeyPressed();
					args.Handled = true;
				}
			}
开发者ID:fstn,项目名称:WindowsPhoneApps,代码行数:11,代码来源:PageUtilities.cs


示例9: Dispatcher_AcceleratorKeyActivated

        private static void Dispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
        {
            if (!_isEnterPressed) return;
            if (_command == null) return;
            if (args.VirtualKey != VirtualKey.Enter) return;

            if (args.EventType == CoreAcceleratorKeyEventType.KeyDown)
            {
                args.Handled = true;
                _command?.Execute(null);
            }
        }
开发者ID:hungdluit,项目名称:ChatterBox,代码行数:12,代码来源:ReturnKeyCommandBehavior.cs


示例10: CoreDispatcher_AcceleratorKeyActivated

        private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs e)
        {
            if (e.EventType.ToString().Contains("Down") && !e.Handled)
            {
                var args = KeyboardEventArgs(e.VirtualKey);
                args.EventArgs = e;

                try { KeyDown?.Invoke(args); }
                finally
                {
                    e.Handled = e.Handled;
                }
            }
        }
开发者ID:Rasetech,项目名称:Template10,代码行数:14,代码来源:KeyboardHelper.cs


示例11: zCoreDispatcher_AcceleratorKeyActivated

        private void zCoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs e)
        {
            if ((e.EventType == CoreAcceleratorKeyEventType.SystemKeyDown ||
                e.EventType == CoreAcceleratorKeyEventType.KeyDown))
            {
                var coreWindow = Windows.UI.Xaml.Window.Current.CoreWindow;
                var downState = CoreVirtualKeyStates.Down;
                var virtualKey = e.VirtualKey;
                bool winKey = ((coreWindow.GetKeyState(VirtualKey.LeftWindows) & downState) == downState || (coreWindow.GetKeyState(VirtualKey.RightWindows) & downState) == downState);
                bool altKey = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState;
                bool controlKey = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState;
                bool shiftKey = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState;
                bool noModifiers = !altKey && !controlKey && !shiftKey;
                bool onlyAlt = altKey && !controlKey && !shiftKey;

                // raise keydown actions
                var keyDown = new KeyboardEventArgs
                {
                    AltKey = altKey,
                    Character = ToChar(virtualKey, shiftKey),
                    ControlKey = controlKey,
                    EventArgs = e,
                    ShiftKey = shiftKey,
                    VirtualKey = virtualKey
                };

                try { KeyDown?.Invoke(keyDown); }
                catch { }

                if (((int)virtualKey == 166 && noModifiers) || (virtualKey == VirtualKey.Left && onlyAlt))
                {
                    // When the previous key or Alt+Left are pressed navigate back
                    e.Handled = true;
                    RaiseGoBackGestured();
                }
                else if (((int)virtualKey == 167 && noModifiers) || (virtualKey == VirtualKey.Right && onlyAlt))
                {
                    // When the next key or Alt+Right are pressed navigate forward
                    e.Handled = true;
                    RaiseGoForwardGestured();
                }
                else if (((int)virtualKey == 69 && controlKey))
                {
                    // when control-E
                    e.Handled = true;
                    RaiseControlEGestured();
                }
            }
        }
开发者ID:joshberry,项目名称:Template10,代码行数:49,代码来源:KeyboardHelper.cs


示例12: OnAcceleratorKeyActivated

 private void OnAcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
 {
     if ((args.EventType == CoreAcceleratorKeyEventType.KeyDown) ||
         args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown)
     {
         if (args.VirtualKey == VirtualKey.Right)
         {
             if (FeedListView.Items != null && FeedListView.SelectedIndex < FeedListView.Items.Count)
             {
                 FeedListView.SelectedIndex++;
                 if (FeedListView.Items.Count > FeedListView.SelectedIndex + ScrollOffset)
                 {
                     FeedListView.ScrollIntoView(FeedListView.Items[FeedListView.SelectedIndex + ScrollOffset]);
                 }
                 else
                 {
                     FeedListView.ScrollIntoView(FeedListView.Items.Count - 1);
                 }
             }
         }
         if (args.VirtualKey == VirtualKey.Left)
         {
             if (FeedListView.SelectedIndex > 0)
             {
                 FeedListView.SelectedIndex--;
                 if (FeedListView.SelectedIndex - ScrollOffset > 0)
                 {
                     FeedListView.ScrollIntoView(FeedListView.Items[FeedListView.SelectedIndex - ScrollOffset]);
                 }
                 else
                 {
                     FeedListView.ScrollIntoView(FeedListView.Items[0]);
                 }
             }
         }
         if (args.VirtualKey == VirtualKey.F5)
         {
             Vm.MasterDetailViewModel.LoadNewFeedsCommand.Execute(null);
         }
     }
 }
开发者ID:Anarh2404,项目名称:TechNews,代码行数:41,代码来源:Shell.xaml.cs


示例13: SettingsFlyout1_AcceleratorKeyActivated

        /// <summary>
        /// Invoked on every keystroke, including system keys such as Alt key combinations, when
        /// this page is active and occupies the entire window.  Used to detect keyboard back 
        /// navigation via Alt+Left key combination.
        /// </summary>
        /// <param name="sender">Instance that triggered the event.</param>
        /// <param name="args">Event data describing the conditions that led to the event.</param>
        void SettingsFlyout1_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
        {
            // Only investigate further when Left is pressed
            if (args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown && 
                args.VirtualKey == VirtualKey.Left)
            {
                var coreWindow = Window.Current.CoreWindow;
                var downState = CoreVirtualKeyStates.Down;

                // Check for modifier keys
                // The Menu VirtualKey signifies Alt
                bool menuKey = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState;
                bool controlKey = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState;
                bool shiftKey = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState;

                if (menuKey && !controlKey && !shiftKey)
                {
                    args.Handled = true;
                    this.Hide();
                }
            }
        }
开发者ID:mbin,项目名称:Win81App,代码行数:29,代码来源:SettingsFlyout1.xaml.cs


示例14: CoreDispatcher_AcceleratorKeyActivated

        /// <summary>
        /// 當這個頁面作用中且佔用整個視窗時,在按下每個按鍵時叫用,
        /// 包括如 Alt 鍵組合等系統按鍵。用來偵測頁面之間的鍵盤巡覽,
        /// 即使頁面本身沒有焦點。
        /// </summary>
        /// <param name="sender">觸發事件的執行個體。</param>
        /// <param name="e">描述造成事件之狀況的事件資料。</param>
        private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender,
            AcceleratorKeyEventArgs e)
        {
            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+Left 時,向後巡覽
                    e.Handled = true;
                    this.GoBackCommand.Execute(null);
                }
                else if (((int)virtualKey == 167 && noModifiers) ||
                    (virtualKey == VirtualKey.Right && onlyAlt))
                {
                    // 按下下一頁按鍵或 Alt+Right 時,向前巡覽
                    e.Handled = true;
                    this.GoForwardCommand.Execute(null);
                }
            }
        }
开发者ID:vulcanlee,项目名称:Windows8Lab,代码行数:43,代码来源:NavigationHelper.cs


示例15: OnAcceleratorKeyActivated

 private void OnAcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
 {
     if ((args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown || args.EventType == CoreAcceleratorKeyEventType.KeyDown) && (args.VirtualKey == VirtualKey.Escape))
     {
         if (!DetailFrame.CanGoBack || CurrentState != MasterDetailState.Narrow) return;
         DetailFrame.GoBack();
         args.Handled = true;
     }
 }
开发者ID:startewho,项目名称:CnBetaUWA,代码行数:9,代码来源:MasterDetailView.cs


示例16: SettingsFlyout2_AcceleratorKeyActivated

        /// <summary>
        /// Invoked on every keystroke, including system keys such as Alt key combinations, when
        /// this page is active and occupies the entire window.  Used to detect keyboard back 
        /// navigation via Alt+Left key combination.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        void SettingsFlyout2_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
        {
            // Only investigate further when Left is pressed
            if (args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown &&
                args.VirtualKey == VirtualKey.Left)
            {
                var coreWindow = Window.Current.CoreWindow;
                var downState = CoreVirtualKeyStates.Down;

                // Check for modifier keys
                // The Menu VirtualKey signifies Alt
                bool menuKey = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState;
                bool controlKey = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState;
                bool shiftKey = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState;

                if (menuKey && !controlKey && !shiftKey)
                {
                    args.Handled = true;

                    // If in second content layer, return to previous content
                    // Otherwise, dismiss the SettingsFlyout
                    if (this.isSecondContentLayer)
                    {
                        this.isSecondContentLayer = false;
                        this.Content = this.content1;
                        this.BackClick -= SettingsFlyout2_BackClick;
                    }
                    else
                    {
                        this.Hide();
                    }
                }
            }
        }
开发者ID:oldnewthing,项目名称:old-Windows8-samples,代码行数:41,代码来源:SettingsFlyout2.xaml.cs


示例17: dispatcher_AcceleratorKeyActivated

 void dispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
 {
     VirtualKey key = args.VirtualKey;
     if ((args.EventType == CoreAcceleratorKeyEventType.KeyDown))
     {
         Unlock();
         args.Handled = true;
     }
 }
开发者ID:anytao,项目名称:ModernReader,代码行数:9,代码来源:Cover.xaml.cs


示例18: CoreDispatcher_AcceleratorKeyActivated

 private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
 {
     throw new NotImplementedException();
 }
开发者ID:josemoreta,项目名称:TestAgricolaCounterSolution,代码行数:4,代码来源:NavigationHelper.cs


示例19: OnAcceleratorKeyActivated

 private void OnAcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs e)
 {
     Debug.WriteLine("AcceleratorKeyActivated|{0}| VKey: {1}| ScanCode: {2}| IsExtendedKey: {3}| IsKeyReleased: {4}| IsMenuKeyDown: {5}",
         e.EventType, e.VirtualKey, e.KeyStatus.ScanCode, e.KeyStatus.IsExtendedKey, e.KeyStatus.IsKeyReleased, e.KeyStatus.IsMenuKeyDown);
 }
开发者ID:pwkpwk,项目名称:Interceptorist,代码行数:5,代码来源:MainPageViewModel.cs


示例20: OnAcceleratorKeyActivated

        private void OnAcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
        {
            _page.OnKeyActivated(args);

            if (args.KeyStatus.IsKeyReleased)
                _page.OnKeyUp(args);

            if (args.Handled)
                return;

            var virtualKey = args.VirtualKey;
            if (args.KeyStatus.IsKeyReleased)
            {
                var isLeftOrRightKey =
                    _page.UseAltLeftOrRightToNavigate && (
                        virtualKey == VirtualKey.Left || 
                        virtualKey == VirtualKey.Right ||
                        (int)virtualKey == 166 || 
                        (int)virtualKey == 167);

                var isBackKey = _page.UseBackKeyToNavigate && virtualKey == VirtualKey.Back;

                if (isLeftOrRightKey || isBackKey)
                {
                    if (PopupHelper.IsPopupVisible)
                        return;

                    var element = FocusManager.GetFocusedElement();
                    if (element is FrameworkElement && PopupHelper.IsInPopup((FrameworkElement)element))
                        return;

                    if (isBackKey)
                    {
                        if (!(element is TextBox) && !(element is PasswordBox) &&
                                 (_page.UseBackKeyToNavigateInWebView || !(element is WebView)) && _page.Frame.CanGoBack)
                        {
                            args.Handled = true;
                            TryGoBackAsync();
                        }
                    }
                    else
                    {
                        var altKey = Keyboard.IsAltKeyDown;
                        var controlKey = Keyboard.IsControlKeyDown;
                        var shiftKey = Keyboard.IsShiftKeyDown;

                        var noModifiers = !altKey && !controlKey && !shiftKey;
                        var onlyAlt = altKey && !controlKey && !shiftKey;

                        if (((int)virtualKey == 166 && noModifiers) || (virtualKey == VirtualKey.Left && onlyAlt))
                        {
                            args.Handled = true;
                            TryGoBackAsync();
                        }
                        else if (((int)virtualKey == 167 && noModifiers) || (virtualKey == VirtualKey.Right && onlyAlt))
                        {
                            args.Handled = true;
                            TryGoForwardAsync();
                        }
                    }
                }
            }
        }
开发者ID:Rakim09,项目名称:MyToolkit,代码行数:63,代码来源:NavigationKeyHandler.cs



注:本文中的Windows.UI.Core.AcceleratorKeyEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Core.CoreDispatcher类代码示例发布时间:2022-05-26
下一篇:
C# ApplicationSettings.SettingsPaneCommandsRequestedEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap