Esempio n. 1
0
        private void ReleaseExtension(IBundle bundle)
        {
            Func <Extension, bool>                 comparer   = null;
            Func <ExtensionPoint, bool>            func2      = null;
            Dictionary <string, List <Extension> > dictionary = new Dictionary <string, List <Extension> >();
            List <ExtensionPoint> list = new List <ExtensionPoint>();

            using (ReaderWriterLockHelper.CreateWriterLock(this._locker))
            {
                foreach (KeyValuePair <string, List <Extension> > pair in this.Extensions)
                {
                    if (comparer == null)
                    {
                        comparer = item => item.Owner == bundle;
                    }
                    dictionary[pair.Key] = ListUtility.RemoveAll <Extension>(pair.Value, comparer);
                }
                if (func2 == null)
                {
                    func2 = item => item.Owner == bundle;
                }
                list = ListUtility.RemoveAll <ExtensionPoint>(this.ExtensionPoints, func2);
            }
            foreach (KeyValuePair <string, List <Extension> > pair2 in dictionary)
            {
                this.FireExtensionsChanged(pair2.Key, CollectionChangedAction.Remove, pair2.Value);
            }
            foreach (ExtensionPoint point in list)
            {
                this.FireExtensionPointChanged(CollectionChangedAction.Remove, point);
            }
        }