/// <summary> /// Registers a callback which got called if one of the given keys changed their state to one of the given states. /// </summary> /// <param name="keys">The keys which has to be watched for.</param> /// <param name="states">The key states which has to be watched for.</param> /// <param name="callback">The callback to be called.</param> /// <returns>A token which represends the current callback to be used for <see cref="DW.WPFToolkit.Helpers.KeyboardWatcher.RemoveCallback" />.</returns> public KeyboardWatchToken AddCallback(IEnumerable <Key> keys, IEnumerable <KeyState> states, Action <KeyStateChangedArgs> callback) { var token = new KeyboardWatchToken(); var callbackItem = new KeyboardWatcherCallback { Callback = callback, Keys = keys, KeyStates = states, Token = token }; _callbacks[token] = callbackItem; return(token); }
/// <summary> /// Registers a callback which got called if one of the given keys changed their state to one of the given states. /// </summary> /// <param name="keys">The keys which has to be watched for.</param> /// <param name="states">The key states which has to be watched for.</param> /// <param name="callback">The callback to be called.</param> /// <returns>A token which represends the current callback to be used for <see cref="DW.WPFToolkit.Helpers.KeyboardWatcher.RemoveCallback" />.</returns> public KeyboardWatchToken AddCallback(IEnumerable<Key> keys, IEnumerable<KeyState> states, Action<KeyStateChangedArgs> callback) { var token = new KeyboardWatchToken(); var callbackItem = new KeyboardWatcherCallback { Callback = callback, Keys = keys, KeyStates = states, Token = token }; _callbacks[token] = callbackItem; return token; }