public void RegisterShortcut(IKeyboardShortcut shortcut) { if (_observers.ContainsKey(shortcut.GetType())) { throw new InvalidOperationException($"Shortcut {shortcut.GetType().Name} was already registered"); } _observers.Add(shortcut.GetType(), new List <Action <IKeyboardShortcut> >()); }
public void RegisterShortcut(IKeyboardShortcut shortcut) { if (shortcut == null) { throw new ArgumentNullException(nameof(shortcut)); } _releasedObservers.RegisterShortcut(shortcut); _pressedObservers.RegisterShortcut(shortcut); _shortcuts.Add(shortcut); }
public List <Action <IKeyboardShortcut> > GetObserverNotifyActions(IKeyboardShortcut shortcut) { return(_observers[shortcut.GetType()].ToList()); }