public override void LoadNodes() { base.LoadNodes(); // Make a list of FeatureDefinitions that are available for the current scope. Dictionary <string, SPFeatureDefinition> featureList = new Dictionary <string, SPFeatureDefinition>(); foreach (SPFeatureDefinition def in Program.Window.Explorer.CurrentFarm.FeatureDefinitions) { try { // Only add features that match the scope if (def.Scope == FeatureScope) { featureList.Add(def.RootDirectory.ToLower(), def); } } catch { // def.Scope throws an exception. //featureList.Add(def.RootDirectory.ToLower(), def); } } foreach (SPFeature feature in FeatureCollection) { if (feature.Definition != null) { // Remove known features featureList.Remove(feature.Definition.RootDirectory.ToLower()); //ExplorerNodeBase node = CreateNode(feature.Definition, InstalledIndex); this.Nodes.Add(new FeatureNode(this.SPParent, feature, InstalledIndex, true)); } else { // A feature was found but there was no definition available this.Nodes.Add(new FeatureNode(this.SPParent, feature, InstalledIndex, true)); } } // List the remaining feature definitions that may be installed on the current scope foreach (SPFeatureDefinition def in featureList.Values) { if (def != null) { ExplorerNodeBase node = new FeatureNode(this.SPParent, def, UnInstalledIndex, false); this.Nodes.Add(node); } } }
public override void LoadNodes() { base.LoadNodes(); // Make a list of FeatureDefinitions that are available for the current scope. Dictionary<string, SPFeatureDefinition> featureList = new Dictionary<string,SPFeatureDefinition>(); foreach (SPFeatureDefinition def in Program.Window.Explorer.CurrentFarm.FeatureDefinitions) { try { // Only add features that match the scope if (def.Scope == FeatureScope) { featureList.Add(def.RootDirectory.ToLower(), def); } } catch { // def.Scope throws an exception. //featureList.Add(def.RootDirectory.ToLower(), def); } } foreach (SPFeature feature in FeatureCollection) { if (feature.Definition != null) { // Remove known features featureList.Remove(feature.Definition.RootDirectory.ToLower()); //ExplorerNodeBase node = CreateNode(feature.Definition, InstalledIndex); this.Nodes.Add(new FeatureNode(this.SPParent, feature, InstalledIndex, true)); } else { // A feature was found but there was no definition available this.Nodes.Add(new FeatureNode(this.SPParent, feature, InstalledIndex, true)); } } // List the remaining feature definitions that may be installed on the current scope foreach (SPFeatureDefinition def in featureList.Values) { if (def != null) { ExplorerNodeBase node = new FeatureNode(this.SPParent, def, UnInstalledIndex, false); this.Nodes.Add(node); } } }