Exemple #1
0
        static ExtensionContext CreateExtensionContext(WorkspaceObject targetObject)
        {
            var extensionContext = AddinManager.CreateExtensionContext();

            if (targetObject == null)
            {
                extensionContext.RegisterCondition("ItemType", FalseCondition.Instance);
                extensionContext.RegisterCondition("AppliesTo", FalseCondition.Instance);
            }
            else
            {
                extensionContext.RegisterCondition("ItemType", new ItemTypeCondition(targetObject.GetType()));
                extensionContext.RegisterCondition("AppliesTo", new AppliesToCondition(targetObject));
            }
            return(extensionContext);
        }