public void Bind(IKeyMap <T> keyMap) { if (_idToInfos == null) { return; } foreach (var pair in _keyToId) { var prefix = pair.Key.Prefix; var shortcut = pair.Key.Key; if (shortcut == Keys.None) { continue; } var targetKeyMap = keyMap; if (prefix != Keys.None) { if (keyMap.IsPrefixDefined(prefix)) { targetKeyMap = keyMap.GetPrefixKeyMap(prefix); } else { targetKeyMap = keyMap.SetPrefix(prefix); } } var actionId = pair.Value; var handled = false; if (_idToBindAction.IsValueCreated) { if (_idToBindAction.Value.ContainsKey(actionId)) { var bindAction = _idToBindAction.Value[actionId]; bindAction(shortcut, targetKeyMap); handled = true; } } if (!handled && _idToInfos.ContainsKey(actionId)) { var info = _idToInfos[actionId]; targetKeyMap.SetAction(shortcut, info.Action); } } }