Ejemplo n.º 1
0
        public FTreeItem FindFeatureProfileTreeItem(MSModel.Feature featureProfile, FTreeItem node = null)
        {
            if (node == null)
            {
                foreach (Feature f in BaseFeatures)
                {
                    FTreeItem childNode = FindFeatureProfileTreeItem(featureProfile, f);

                    if (childNode != null)
                    {
                        return(childNode);
                    }
                }
            }
            else
            {
                if (node.Detail.FeatureProfile.Guid == featureProfile.Guid ||
                    node.Detail.FeatureProfile.FullSymbol == featureProfile.FullSymbol)
                {
                    return(node);
                }

                foreach (FTreeItem fti in node.Children)
                {
                    FTreeItem childNode = FindFeatureProfileTreeItem(featureProfile, fti);

                    if (childNode != null)
                    {
                        return(childNode);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        public void InitializeFromModel(IModel model)
        {
            List <FTreeItem> rootFeatures = new List <FTreeItem>();

            Queue <InitializationWorkItem> workItemQueue = new Queue <InitializationWorkItem>(
                from Profile profile in model.ProfilesRaw
                where profile.Parent.Parent == null
                select new InitializationWorkItem()
            {
                Profile = profile
            }
                );

            while (workItemQueue.Count > 0)
            {
                InitializationWorkItem workItem = workItemQueue.Dequeue();
                MSModel.Feature        profile  = workItem.Profile as MSModel.Feature;

                FeatureDetail fd = new FeatureDetail(profile);
                FTreeItem     treeItem;

                if (profile.IsPropertyFeature)
                {
                    treeItem = new Property(this, fd);
                }
                else
                {
                    treeItem = new Feature(this, fd);
                }

                if (workItem.ParentTreeItem != null)
                {
                    workItem.ParentTreeItem.Add(treeItem);
                }
                else
                {
                    rootFeatures.Add(treeItem);
                }

                foreach (Profile childProfile in profile.Children)
                {
                    workItemQueue.Enqueue(new InitializationWorkItem()
                    {
                        ParentTreeItem = treeItem, Profile = childProfile
                    });
                }
            }

            foreach (Feature f in rootFeatures)
            {
                StackPanel p = new StackPanel();
                f.TabItem         = new TabItem();
                f.TabItem.Header  = f.Content;
                f.TabItem.Content = p;
                f.HelpWin         = this.HelpWin;
                this.Items.Add(f.TabItem);
                f.RecurseFeature("", p);
                f.TreeChange += OnTreeChange;

                this.BaseFeatures.Add(f);
            }

            this.SelectedItem = rootFeatures.First().TabItem;
        }
Ejemplo n.º 3
0
 public FeatureDetail(MSModel.Feature featureProfile)
 {
     this.FeatureProfile = featureProfile;
 }