Exemple #1
0
 internal void NotifyKeyUp(WinVirtualKey key)
 {
     while (_keysHit.Remove(key))
     {
     }
     while (_keysDown.Remove(key))
     {
     }
 }
Exemple #2
0
        public bool IsKeyHit(WinVirtualKey key)
        {
            if (!_focused)
            {
                return(false);
            }

            return(_keysHit.Contains(key));
        }
Exemple #3
0
            public void NotifyKeyUp(WinVirtualKey key)
            {
                if (key == WinVirtualKey.None)
                {
                    return;
                }

                _host.NotifyKeyUp(key);
            }
Exemple #4
0
 /// <summary>
 /// Initializes the <see cref="WinRTKeyAndMouseInputHandler"/> class.
 /// </summary>
 static WinRTKeyAndMouseInputHandler()
 {
     s_keyMappingDict = new Dictionary <VirtualKey, WinVirtualKey>();
     foreach (VirtualKey actVirtualKey in Enum.GetValues(typeof(VirtualKey)))
     {
         short         actVirtualKeyCode = (short)actVirtualKey;
         WinVirtualKey actWinVirtualKey  = (WinVirtualKey)actVirtualKeyCode;
         s_keyMappingDict[actVirtualKey] = actWinVirtualKey;
     }
 }
        public bool IsKeyDown(WinVirtualKey key)
        {
            if (!m_focused)
            {
                return(false);
            }

            return
                (m_keysDown.Contains(key) ||
                 m_keysHit.Contains(key));
        }
Exemple #6
0
        internal void NotifyKeyDown(WinVirtualKey key)
        {
            var anyRegistered =
                _keysDown.Contains(key) ||
                _keysHit.Contains(key);

            if (anyRegistered)
            {
                return;
            }

            _keysHit.Add(key);
        }
        /// <summary>
        /// Called when a key is down.
        /// </summary>
        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (m_currentControl == null)
            {
                return;
            }

            // Notify event to keyboard state
            WinVirtualKey actKeyCode = s_keyMappingDict[e.KeyCode];

            if (actKeyCode != WinVirtualKey.None)
            {
                m_stateKeyboard.NotifyKeyDown(actKeyCode);
            }
        }