當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。