Beispiel #1
0
        protected virtual void InitializeChild(TreeNode parent, TreeNode child, object context)
        {
            NamedSmoObject smoObj = context as NamedSmoObject;

            if (smoObj == null)
            {
                Debug.WriteLine("context is not a NamedSmoObject. type: " + context.GetType());
            }
            else
            {
                smoProperties = SmoProperties;
                SmoTreeNode childAsMeItem = (SmoTreeNode)child;
                childAsMeItem.CacheInfoFromModel(smoObj);
                SmoQueryContext smoContext = parent.GetContextAs <SmoQueryContext>();

                // If node has custom name, replaced it with the name already set
                string customizedName = GetNodeCustomName(context, smoContext);
                if (!string.IsNullOrEmpty(customizedName))
                {
                    childAsMeItem.NodeValue    = customizedName;
                    childAsMeItem.NodePathName = GetNodePathName(context);
                }

                childAsMeItem.NodeSubType = GetNodeSubType(context, smoContext);
                childAsMeItem.NodeStatus  = GetNodeStatus(context, smoContext);
            }
        }
Beispiel #2
0
        private bool ShouldFilterNode(TreeNode childNode, ValidForFlag validForFlag)
        {
            bool        filterTheNode = false;
            SmoTreeNode smoTreeNode   = childNode as SmoTreeNode;

            if (smoTreeNode != null)
            {
                if (!ServerVersionHelper.IsValidFor(validForFlag, smoTreeNode.ValidFor))
                {
                    filterTheNode = true;
                }
            }

            return(filterTheNode);
        }