コード例 #1
0
        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> >());
        }
コード例 #2
0
 public void RegisterShortcut(IKeyboardShortcut shortcut)
 {
     if (shortcut == null)
     {
         throw new ArgumentNullException(nameof(shortcut));
     }
     _releasedObservers.RegisterShortcut(shortcut);
     _pressedObservers.RegisterShortcut(shortcut);
     _shortcuts.Add(shortcut);
 }
コード例 #3
0
 public List <Action <IKeyboardShortcut> > GetObserverNotifyActions(IKeyboardShortcut shortcut)
 {
     return(_observers[shortcut.GetType()].ToList());
 }