public void Unsubcribe(MetaCommand item) { foreach (var items in _subscribers.Values) { items.Remove(item); } }
public void Subscribe(EventType eventType, MetaCommand item) { HashSet<MetaCommand> items; if (!_subscribers.TryGetValue(eventType, out items)) { _subscribers[eventType] = items = new HashSet<MetaCommand>(); } if (!items.Contains(item)) { items.Add(item); } }
public CommandActionInternal(MetaCommand metaCommand, CodeClass2 mcclass) { _metaCommand = metaCommand; _mcclass = mcclass; foreach (CodeAttribute2 attr in mcclass.Attributes) { if (attr.FullName == typeof(WhenFileChangedAttribute).FullName) { _eventType = EventType.FileChanged; var attrParameters = attr.Arguments.Cast<CodeAttributeArgument>().Select(_ => _.Value.Trim('\"')).ToArray(); _fileChangedMasks.Add(new FileChangedArgument(attrParameters[0], attrParameters[1], true)); DTEHelper.Events.Subscribe(_eventType, _metaCommand); } } }