示例#1
0
        private void OnComponentConfigurationListChanged(object sender,
                                                         BuildListEventArgs <BuildComponentConfiguration> e)
        {
            if (_multiMap == null)
            {
                _multiMap =
                    new BuildMultiSet <string, BuildComponentConfiguration>();
            }

            switch (e.ChangeType)
            {
            case BuildListChangeType.Added:
                BuildComponentConfiguration addedItem = e.ChangedItem;
                _multiMap.Add(addedItem.ComponentName, addedItem);
                break;

            case BuildListChangeType.Removed:
                BuildComponentConfiguration removedItem = e.ChangedItem;
                _multiMap.Remove(removedItem.ComponentName, removedItem);
                break;

            case BuildListChangeType.Replaced:
                BuildComponentConfiguration changedItem      = e.ChangedItem;
                BuildComponentConfiguration replacedWithItem = e.ReplacedWith;
                _multiMap.Remove(changedItem.ComponentName, changedItem);
                _multiMap.Add(replacedWithItem.ComponentName, replacedWithItem);
                break;

            case BuildListChangeType.Cleared:
                _multiMap.Clear();
                break;
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildComponentConfigurationList"/>
        /// class with the specified engine type.
        /// </summary>
        /// <param name="engineType">
        /// The build engine type, which is targeted by this set of configurations.
        /// </param>
        public BuildComponentConfigurationList(BuildEngineType engineType)
        {
            _engineType = engineType;
            _multiMap   = new BuildMultiSet <string, BuildComponentConfiguration>();

            this.Changed += new EventHandler <
                BuildListEventArgs <BuildComponentConfiguration> >(OnComponentConfigurationListChanged);
        }