示例#1
0
文件: DTEEvents.cs 项目: DzmitrySo/mc
 public void Unsubcribe(MetaCommand item)
 {
     foreach (var items in _subscribers.Values)
     {
         items.Remove(item);
     }
 }
示例#2
0
文件: DTEEvents.cs 项目: DzmitrySo/mc
        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);
            }
        }
示例#3
0
            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);
                    }
                }
            }