示例#1
0
 public override void Press()
 {
     // This is a bit tricky because we can only get the state of a toggling key after the input has been
     // read off the MessagePump.  Ergo if we make that assumption that in the time it takes to run this method
     // we will be toggling the state of the key, set IsInEffect to the new state and then press the key.
     IsInEffect = !InputSimulator.IsTogglingKeyInEffect(KeyCode);
     base.Press();
 }
        private void CloseHandle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            //FDN: attiviamo il caps lock per mandare tutti caratteri Uppercase
            var isCapsLockOn = InputSimulator.IsTogglingKeyInEffect(VirtualKeyCode.CAPITAL);

            if (isCapsLockOn)
            {
                InputSimulator.SimulateKeyPress(VirtualKeyCode.CAPITAL);
            }
            keyboard.IsOpen = false;
        }
        protected override void OnOpened(EventArgs e)
        {
            //FDN: attiviamo il caps lock per mandare tutti caratteri Uppercase
            var isCapsLockOn = InputSimulator.IsTogglingKeyInEffect(VirtualKeyCode.CAPITAL);

            if (!isCapsLockOn)
            {
                InputSimulator.SimulateKeyPress(VirtualKeyCode.CAPITAL);
            }
            IsKeyboardShown = true;
            base.OnOpened(e);
        }
 void Awake()
 {
     Application.runInBackground = true;
     alphaButtons   = GameObject.Find("AlphaGroup").GetComponentsInChildren <ButtonHighlight>();
     bracketButtons = GameObject.Find("BracketGroup").GetComponentsInChildren <ButtonHighlight>();
     caps           = (InputSimulator.IsTogglingKeyInEffect(VirtualKeyCode.CAPITAL)) ? true : false;
     if (caps)
     {
         alphaButtons[48].HighlightToggle(caps);
         //inputFlags |= DOFSCIIMap.CapsToggle;
     }
     dofsciiOn = true;
     //inputFlags |= DOFSCIIMap.DOFSCIIToggle;
 }
示例#5
0
 /// <summary>
 /// Determines whether the toggling key is toggled on (in-effect) or not by calling the GetKeyState function.  (See: http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx)
 /// </summary>
 /// <param name="keyCode">The <see cref="VirtualKeyCode"/> for the key.</param>
 /// <returns>
 ///     <c>true</c> if the toggling key is toggled on (in-effect); otherwise, <c>false</c>.
 /// </returns>
 /// <remarks>
 /// The key status returned from this function changes as a thread reads key messages from its message queue. The status does not reflect the interrupt-level state associated with the hardware. Use the GetAsyncKeyState function to retrieve that information.
 /// An application calls GetKeyState in response to a keyboard-input message. This function retrieves the state of the key when the input message was generated.
 /// To retrieve state information for all the virtual keys, use the GetKeyboardState function.
 /// An application can use the virtual-key code constants VK_SHIFT, VK_CONTROL, and VK_MENU as values for the nVirtKey parameter. This gives the status of the SHIFT, CTRL, or ALT keys without distinguishing between left and right. An application can also use the following virtual-key code constants as values for nVirtKey to distinguish between the left and right instances of those keys.
 /// VK_LSHIFT
 /// VK_RSHIFT
 /// VK_LCONTROL
 /// VK_RCONTROL
 /// VK_LMENU
 /// VK_RMENU
 ///
 /// These left- and right-distinguishing constants are available to an application only through the GetKeyboardState, SetKeyboardState, GetAsyncKeyState, GetKeyState, and MapVirtualKey functions.
 /// </remarks>
 public bool IsTogglingKeyInEffect(VirtualKeyCode keyCode)
 {
     return(InputSimulator.IsTogglingKeyInEffect(keyCode));
 }
示例#6
0
 public override void SynchroniseKeyState()
 {
     IsInEffect = InputSimulator.IsTogglingKeyInEffect(KeyCode);
 }
示例#7
0
 void HandleShiftKeyPressed(ModifierKeyBase shiftKey)
 {
     _allLogicalKeys.OfType <CaseSensitiveKey>().ToList().ForEach(x => x.SelectedIndex =
                                                                      InputSimulator.IsTogglingKeyInEffect(VirtualKeyCode.CAPITAL) ^ shiftKey.IsInEffect ? 1 : 0);
     _allLogicalKeys.OfType <ShiftSensitiveKey>().ToList().ForEach(x => x.SelectedIndex = shiftKey.IsInEffect ? 1 : 0);
 }
示例#8
0
 bool IsCapsLockToggled()
 {
     return(InputSimulator.IsTogglingKeyInEffect(VirtualKeyCode.CAPITAL));
 }