public override void LoadChildren()
        {
            // Load Definitions
            var definitions = GetFeatureDefinitionIndex().Distinct(new SPFeatureDefinitionComparer());

            // Load Active Features
            Dictionary <Guid, SPFeature> featureIndex = this.FeatureCollection.ToDictionary(p => p.DefinitionId);


            // Unordered List
            var unorderedList = new SerializableList <ISPNode>();

            foreach (var def in definitions)
            {
                SPFeatureNode node = new SPFeatureNode();
                node.Definition = def;
                node.Setup(this);

                if (featureIndex.ContainsKey(def.Id))
                {
                    node.SPObject  = featureIndex[def.Id];
                    node.Activated = true;

                    featureIndex.Remove(def.Id);
                }

                unorderedList.Add(node);
            }

            foreach (var entry in featureIndex)
            {
                SPFeatureNode node = new SPFeatureNode();
                node.Definition = null;
                node.Setup(this);
                node.Text += " (Error: Missing definition)";

                unorderedList.Add(node);
            }


            // Add Inactive Features node from definitions
            this.Children = new SerializableList <ISPNode>(unorderedList.OrderBy(p => p.Text));
        }
        public override void LoadChildren()
        {
            // Load Definitions
            IEnumerable <SPFeatureDefinition> definitions = GetFeatureDefinitionIndex();

            // Load Active Features
            Dictionary <Guid, SPFeature> featureIndex = this.FeatureCollection.ToDictionary(p => p.DefinitionId);


            // Unordered List
            List <ISPNode> unorderedList = new List <ISPNode>();

            foreach (var def in definitions)
            {
                SPFeatureNode node = new SPFeatureNode();
                node.Definition = def;
                node.Setup(this.SPObject);

                if (featureIndex.ContainsKey(def.Id))
                {
                    node.SPObject  = featureIndex[def.Id];
                    node.Activated = true;

                    featureIndex.Remove(def.Id);
                }

                unorderedList.Add(node);
            }

            foreach (var entry in featureIndex)
            {
                SPFeatureNode node = new SPFeatureNode();
                node.Definition = null;
                node.Setup(this.SPObject);

                unorderedList.Add(node);
            }


            // Add Inactive Features node from definitions
            this.Children = unorderedList.OrderBy(p => p.Text).ToList();
        }
Ejemplo n.º 3
0
        public override void LoadChildren()
        {
            // Load Definitions
            IEnumerable<SPFeatureDefinition> definitions = GetFeatureDefinitionIndex();

            // Load Active Features
            Dictionary<Guid, SPFeature> featureIndex = this.FeatureCollection.ToDictionary(p => p.DefinitionId);

            // Unordered List
            List<ISPNode> unorderedList = new List<ISPNode>();

            foreach (var def in definitions)
            {
                SPFeatureNode node = new SPFeatureNode();
                node.Definition = def;
                node.Setup(this.SPObject);

                if (featureIndex.ContainsKey(def.Id))
                {
                    node.SPObject = featureIndex[def.Id];
                    node.Activated = true;

                    featureIndex.Remove(def.Id);
                }

                unorderedList.Add(node);
            }

            foreach (var entry in featureIndex)
            {
                SPFeatureNode node = new SPFeatureNode();
                node.Definition = null;
                node.Setup(this.SPObject);

                unorderedList.Add(node);
            }

            // Add Inactive Features node from definitions
            this.Children = unorderedList.OrderBy( p=> p.Text).ToList();
        }
Ejemplo n.º 4
0
 public void SetupItem(object target)
 {
     this.Node = (SPFeatureNode)target;
     this.Command = new RelayCommand(Execute, CanExecute);
 }