예제 #1
0
        void KeyboardHook_LockedDownKeyboardKeyPressed(object sender, KeyboardLockDownKeyPressedEventArgs e)
        {
            // Invoke is required here to avoid cross threading exceptions.
            Action a = () => textBoxMessages.AppendText(string.Format("Lockdown pressed event: {0}{1}", DateTime.Now, Environment.NewLine));

            textBoxMessages.Invoke(a);
        }
예제 #2
0
 /// <summary>
 /// Raises the KeyboardLockDownKeyPressed event by invoking each subscribed delegate asynchronously.
 /// </summary>
 /// <param name="pressedKeys">The keys that are pressed.</param>
 /// <param name="state">The state of the keys.</param>
 static void OnLockedDownKeyboardKeyPressed(KeysEx pressedKeys, KeyState state)
 {
     foreach (EventHandler <KeyboardLockDownKeyPressedEventArgs> pressedEvent in LockedDownKeyboardKeyPressed.GetInvocationList())
     {
         var           args     = new KeyboardLockDownKeyPressedEventArgs(pressedKeys, state);
         AsyncCallback callback = ar => ((EventHandler <KeyboardLockDownKeyPressedEventArgs>)ar.AsyncState).EndInvoke(ar);
         pressedEvent.BeginInvoke(null, args, callback, pressedEvent);
     }
 }
예제 #3
0
 void KeyboardHook_LockedDownKeyboardKeyPressed(object sender, KeyboardLockDownKeyPressedEventArgs e)
 {
     // Invoke is required here to avoid cross threading exceptions.
     Action a = () => textBoxMessages.AppendText(string.Format("Lockdown pressed event: {0}{1}", DateTime.Now, Environment.NewLine));
     textBoxMessages.Invoke(a);
 }
예제 #4
0
		/// <summary>
		/// Raises the KeyboardLockDownKeyPressed event by invoking each subscribed delegate asynchronously.
		/// </summary>
		/// <param name="pressedKeys">The keys that are pressed.</param>
		/// <param name="state">The state of the keys.</param>
		static void OnLockedDownKeyboardKeyPressed(KeysEx pressedKeys, KeyState state)
		{
			foreach (EventHandler<KeyboardLockDownKeyPressedEventArgs> pressedEvent in LockedDownKeyboardKeyPressed.GetInvocationList())
			{
				var args = new KeyboardLockDownKeyPressedEventArgs(pressedKeys, state);
				AsyncCallback callback = ar => ((EventHandler<KeyboardLockDownKeyPressedEventArgs>)ar.AsyncState).EndInvoke(ar);
				pressedEvent.BeginInvoke(null, args, callback, pressedEvent);
			}
		}