Exemple #1
0
        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);
            }
        }
Exemple #2
0
        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);
                }
            }
        }