Esempio n. 1
0
        /// <summary>
        /// Shows Assets based on MOG_Property(s) assigned to PropertyList
        /// </summary>
        private void ExpandPropertyTreeDown(TreeNode node)
        {
            BeginUpdate();

            List <string> classificationsToAdd = GetSubClassifications(node);
            List <string> assetsToAdd          = GetAssets(node);

            // Sort our classifications alphabetically
            classificationsToAdd.Sort();

            // Foreach classification, add it
            foreach (string classification in classificationsToAdd)
            {
                TreeNode classificationNode = new TreeNode(classification);

                // Assign the default node checked state
                classificationNode.Checked = node.Checked;

                classificationNode.Tag = new Mog_BaseTag(classificationNode, classification, RepositoryFocusLevel.Classification, false);
                ((Mog_BaseTag)classificationNode.Tag).PackageNodeType = PackageNodeTypes.Class;
                node.Nodes.Add(classificationNode);

                classificationNode.Name = classificationNode.FullPath;
                SetImageIndices(classificationNode, GetClassificationImageIndex(classificationNode.FullPath));

                classificationNode.Nodes.Add(new TreeNode(Blank_Node_Text));
            }

            // Use the System.IComparable interface for `string` to sort our list
            assetsToAdd.Sort();

            // Foreach Asset, add it
            foreach (string assetFilename in assetsToAdd)
            {
                MOG_Filename assetFile = new MOG_Filename(assetFilename);
                assetFile = MOG_ControllerProject.GetAssetCurrentBlessedPath(assetFile);
                TreeNode assetNode;
                // If we are expandingAssets or expandingPackageGroups, we need to be able to expand down
                if (ExpandAssets || ExpandPackageGroups)
                {
                    assetNode = new TreeNode(assetFile.GetAssetName(), new TreeNode[] { new TreeNode(Blank_Node_Text) });
                }
                // Else, do not expand down.  Showing the Asset is all we need to do
                else
                {
                    assetNode = new TreeNode(assetFile.GetAssetName());
                }

                assetNode.Tag = new Mog_BaseTag(assetNode, assetFile.GetEncodedFilename(), FocusForAssetNodes, true);
                ((Mog_BaseTag)assetNode.Tag).PackageNodeType = PackageNodeTypes.Asset;
                ((Mog_BaseTag)assetNode.Tag).PackageFullName = assetFile.GetAssetFullName();
                node.Nodes.Add(assetNode);
                assetNode.Name = assetFile.GetAssetFullName();

                SetImageIndices(assetNode, GetAssetFileImageIndex(assetFile.GetEncodedFilename()));
            }

            EndUpdate();
        }
        /// <summary>
        /// Used to get an Asset node with a good node.Tag for this TreeView or any inheriting classes.
        ///  Does not use full filename.
        /// </summary>
        protected virtual TreeNode CreateAssetNode(MOG_Filename asset)
        {
            // Create a basic tree node
            TreeNode     assetNode = new TreeNode(asset.GetAssetName());
            MOG_Filename assetFile = MOG_ControllerProject.GetAssetCurrentBlessedPath(asset);

            assetNode.Tag  = new Mog_BaseTag(assetNode, "", RepositoryFocusLevel.Repository, true);
            assetNode.Name = asset.GetAssetFullName();
            // Initialize the treenode's image
            SetImageIndices(assetNode, GetAssetImageIndex(asset.GetAssetFullName()));

            return(assetNode);
        }
Esempio n. 3
0
        /// <summary>
        /// Used to get an Asset node with a good node.Tag for this TreeView or any inheriting classes.
        ///  Does not use full filename.
        /// </summary>
        protected override TreeNode CreateAssetNode(MOG_Filename asset)
        {
            TreeNode assetNode = base.CreateAssetNode(asset);

            // If we are expandingAssets or expandingPackageGroups, we need to be able to expand down
            if (ExpandAssets || ExpandPackageGroups)
            {
                // Add the dummy node so the usere will be given the opportunity to expand it
                assetNode.Nodes.Add(new TreeNode(Blank_Node_Text));
            }

            // Rebuild the node's tag
            MOG_Filename assetFile = MOG_ControllerProject.GetAssetCurrentBlessedPath(asset);
            Mog_BaseTag  tag       = new Mog_BaseTag(assetNode, assetFile.GetEncodedFilename(), FocusForAssetNodes, true);

            tag.PackageNodeType = PackageNodeTypes.Asset;
            tag.PackageFullName = assetFile.GetAssetFullName();
            assetNode.Tag       = tag;

            return(assetNode);
        }