当前位置: 首页>>代码示例>>C#>>正文


C# TreeNode.GetFullFilePath方法代码示例

本文整理汇总了C#中System.Windows.Forms.TreeNode.GetFullFilePath方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.GetFullFilePath方法的具体用法?C# TreeNode.GetFullFilePath怎么用?C# TreeNode.GetFullFilePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.TreeNode的用法示例。


在下文中一共展示了TreeNode.GetFullFilePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddAndRemoveScreensComponentsAndStandards

        private void AddAndRemoveScreensComponentsAndStandards(TreeNode folderTreeNode)
        {
            if (ProjectManager.Self.GumProjectSave == null)
                return;

            // Save off old selected stuff
            InstanceSave selectedInstance = SelectedState.Self.SelectedInstance;
            ElementSave selectedElement = SelectedState.Self.SelectedElement;


            if (!string.IsNullOrEmpty(ProjectManager.Self.GumProjectSave.FullFileName))
            {
                string currentDirectory = FileManager.GetDirectory(ProjectManager.Self.GumProjectSave.FullFileName);

                if (folderTreeNode != null)
                {
                    currentDirectory = folderTreeNode.GetFullFilePath();
                }
            }

            // todo - now use this 


            #region Add nodes that haven't been added yet

            foreach (ScreenSave screenSave in ProjectManager.Self.GumProjectSave.Screens)
            {
                if (GetTreeNodeFor(screenSave) == null)
                {
                    string fullPath = FileLocations.Self.ScreensFolder + FileManager.GetDirectory(screenSave.Name);
                    TreeNode parentNode = GetTreeNodeFor(fullPath);

                    AddTreeNodeForElement(screenSave, parentNode, ScreenImageIndex);
                }
            }

            foreach (ComponentSave componentSave in ProjectManager.Self.GumProjectSave.Components)
            {
                if (GetTreeNodeFor(componentSave) == null)
                {
                    string fullPath = FileLocations.Self.ComponentsFolder + FileManager.GetDirectory(componentSave.Name);
                    TreeNode parentNode = GetTreeNodeFor(fullPath);

                    AddTreeNodeForElement(componentSave, parentNode, ComponentImageIndex);
                }
            }

            foreach (StandardElementSave standardSave in ProjectManager.Self.GumProjectSave.StandardElements)
            {
                if (standardSave.Name != "Component")
                {
                    if (GetTreeNodeFor(standardSave) == null)
                    {
                        AddTreeNodeForElement(standardSave, mStandardElementsTreeNode, StandardElementImageIndex);
                    }
                }
            }



            #endregion

            #region Remove nodes that are no longer needed

            for (int i = mScreensTreeNode.Nodes.Count - 1; i > -1; i--)
            {
                ScreenSave screen = mScreensTreeNode.Nodes[i].Tag as ScreenSave;

                // If the screen is null, that means that it's a folder TreeNode, so we don't want to remove it
                if (screen != null)
                {
                    if (!ProjectManager.Self.GumProjectSave.Screens.Contains(screen))
                    {
                        mScreensTreeNode.Nodes.RemoveAt(i);
                    }
                }
            }

            for (int i = mComponentsTreeNode.Nodes.Count - 1; i > -1; i--)
            {
                ComponentSave component = mComponentsTreeNode.Nodes[i].Tag as ComponentSave;

                // If the component is null, that means that it's a folder TreeNode, so we don't want to remove it
                if (component != null)
                {
                    if (!ProjectManager.Self.GumProjectSave.Components.Contains(component))
                    {
                        mComponentsTreeNode.Nodes.RemoveAt(i);
                    }
                }
            }

            for (int i = mStandardElementsTreeNode.Nodes.Count - 1; i > -1; i-- )
            {
                // Do we want to support folders here?
                StandardElementSave standardElement = mStandardElementsTreeNode.Nodes[i].Tag as StandardElementSave;

                if (!ProjectManager.Self.GumProjectSave.StandardElements.Contains(standardElement))
                {
                    mStandardElementsTreeNode.Nodes.RemoveAt(i);
//.........这里部分代码省略.........
开发者ID:jiailiuyan,项目名称:Gum,代码行数:101,代码来源:ElementTreeViewManager.cs


注:本文中的System.Windows.Forms.TreeNode.GetFullFilePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。