コード例 #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
ファイル: KeyboardHook.cs プロジェクト: rzhukov/VolumeControl
		/// <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);
			}
		}