bool InsertAddin(IProgressStatus statusMonitor, Addin iad) { try { RuntimeAddin p = new RuntimeAddin(); // Read the config file and load the add-in assemblies AddinDescription description = p.Load(iad); // Register the add-in loadedAddins [Addin.GetIdName(p.Id)] = p; if (!AddinDatabase.RunningSetupProcess) { // Load the extension points and other addin data foreach (ExtensionNodeSet rel in description.ExtensionNodeSets) { RegisterNodeSet(rel); } foreach (ConditionTypeDescription cond in description.ConditionTypes) { Type ctype = p.GetType(cond.TypeName, true); defaultContext.RegisterCondition(cond.Id, ctype); } } foreach (ExtensionPoint ep in description.ExtensionPoints) { InsertExtensionPoint(p, ep); } foreach (Assembly asm in p.Assemblies) { loadedAssemblies [asm] = p; } // Fire loaded event defaultContext.NotifyAddinLoaded(p); AddinManager.ReportAddinLoad(p.Id); return(true); } catch (Exception ex) { AddinManager.ReportError("Extension could not be loaded", iad.Id, ex, false); if (statusMonitor != null) { statusMonitor.ReportError("Extension '" + iad.Id + "' could not be loaded.", ex); } return(false); } }
internal void NotifyAddinLoaded(RuntimeAddin ad) { tree.NotifyAddinLoaded(ad, true); lock (conditionTypes) { if (childContexts != null) { foreach (WeakReference wref in childContexts) { ExtensionContext ctx = wref.Target as ExtensionContext; if (ctx != null) { ctx.NotifyAddinLoaded(ad); } } } } }