public override bool Evaluate(ExtensionContext ctx) { if (!base.Evaluate(ctx)) { return(false); } if (!string.IsNullOrEmpty(addin)) { // Make sure the add-in that implements the condition is loaded addinEngine.LoadAddin(null, addin, true); addin = null; // Don't try again } ConditionType type = ctx.GetCondition(typeId); if (type == null) { var parts = string.Join(", ", Array.ConvertAll(node.Attributes, attr => attr.Name + "=" + attr.Value)); addinEngine.ReportError("Condition '" + typeId + "' not found in current extension context. [" + parts + "]", node.ParentAddinDescription.AddinId, null, false); return(false); } try { return(type.Evaluate(node)); } catch (Exception ex) { addinEngine.ReportError("Error while evaluating condition '" + typeId + "'", node.ParentAddinDescription.AddinId, ex, false); return(false); } }
/// <summary> /// Forces the loading of an add-in. /// </summary> /// <param name="statusMonitor"> /// Status monitor to keep track of the loading process. /// </param> /// <param name="id"> /// Full identifier of the add-in to load. /// </param> /// <remarks> /// This method loads all assemblies that belong to an add-in in memory. /// All add-ins on which the specified add-in depends will also be loaded. /// Notice that in general add-ins don't need to be explicitly loaded using /// this method, since the add-in engine will load them on demand. /// </remarks> public static void LoadAddin(IProgressStatus statusMonitor, string id) { AddinEngine.LoadAddin(statusMonitor, id); }