示例#1
0
        protected override void OnKeyUp(KeyRoutedEventArgs args)
        {
            base.OnKeyUp(args);

            var key       = args.OriginalKey;
            var isHandled = args.Handled;

            isHandled    = KeyProcess.KeyUp(key, this);
            args.Handled = isHandled;
        }
示例#2
0
        public string Key2Value(string key)
        {
            KeyProcess process = null;

            if (m_KeyProcess.TryGetValue(key, out process))
            {
                return(process());
            }
            return(key);
        }
示例#3
0
        public void RegisterKeyProcess(string key, KeyProcess process)
        {
            if (m_KeyProcess == null)
            {
                m_KeyProcess = new Dictionary <string, KeyProcess>();
            }

            if (m_KeyProcess.ContainsKey(key))
            {
                Log.w("Already Register Key Process:" + key);
                return;
            }

            m_KeyProcess.Add(key, process);
        }
示例#4
0
        protected override void OnKeyDown(KeyRoutedEventArgs args)
        {
            // We don't perform any action in OnKeyDown because we wait for the key to be
            // released before performing a Toggle().  However, if we don't handle OnKeyDown,
            // it bubbles up to the parent ScrollViewer and may cause scrolling, which is
            // undesirable.  Therefore, we check to see if we will handle OnKeyUp for this key
            // press, and if so, we set Handled=true for OnKeyDown to stop bubbling this event.
            base.OnKeyDown(args);

            var isHandled = args.Handled;

            if (isHandled || _isDragging)
            {
                return;
            }

            var key = args.OriginalKey;

            isHandled = KeyProcess.KeyDown(key, this);

            args.Handled    = isHandled;
            _handledKeyDown = isHandled;
        }
示例#5
0
 private bool OnKeyUpInternal(VirtualKey key)
 {
     KeyProcess.KeyUp(key, out var handled, _keyboardNavigationAcceptsReturn, this);
     return(handled);
 }
示例#6
0
 private protected virtual bool OnKeyDownInternal(VirtualKey key)
 {
     KeyProcess.KeyDown(key, out var handled, _keyboardNavigationAcceptsReturn, this);
     return(handled);
 }