public void AddKeyBinding(SkiKeyBinding keyBinding) { lock (_keyBindingsMap) { if (!_keyBindingsMap.TryGetValue(keyBinding.KeyCombination.Key, out var list)) { list = _keyBindingsMap[keyBinding.KeyCombination.Key] = new List <SkiKeyBinding>(); } list.Add(keyBinding); } }
public void RemoveKeyBinding(SkiKeyBinding keyBinding) { lock (_keyBindingsMap) { if (!_keyBindingsMap.TryGetValue(keyBinding.KeyCombination.Key, out var list)) { return; } list.Remove(keyBinding); if (!list.Any()) { _keyBindingsMap.Remove(keyBinding.KeyCombination.Key); } } }