Пример #1
0
 public PluginMenuItem(PluginBase plugin, IPluginObserver observer)
 {
     pPlugin = plugin;
     pObserver = observer;
     Click += PluginMenuItemClick;
     Text = plugin.Name;
 }
        public void Unsubscribe(Type messageType, IPluginObserver observer)
        {
            IList <IPluginObserver> observersList;

            if (_dicObservers.TryGetValue(messageType, out observersList))
            {
                if (observersList.Contains(observer))
                {
                    observersList.Remove(observer);
                }
            }
        }
        public void Subscribe(Type messageType, IPluginObserver observer)
        {
            IList <IPluginObserver> observersList;

            if (!_dicObservers.TryGetValue(messageType, out observersList))
            {
                _dicObservers.TryAdd(messageType, new List <IPluginObserver> {
                    observer
                });
            }
            else
            {
                if (!observersList.Contains(observer))
                {
                    observersList.Add(observer);
                }
            }
        }
Пример #4
0
 public void Init(IPluginObserver observer)
 {
     pObserver = observer;
 }