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


C# TreeNode.IsReferencedFile方法代码示例

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


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

示例1: PopulateRightClickItems


//.........这里部分代码省略.........
                AddRemoveFromProjectItems(form, menu);

                menu.Items.Add(form.editResetVariablesToolStripMenuItem);
                menu.Items.Add(mFindAllReferences);

                menu.Items.Add("-");

                menu.Items.Add(mDuplicate);

                menu.Items.Add("-");

                menu.Items.Add(mMoveToTop);
                menu.Items.Add(mMoveUp);
                menu.Items.Add(mMoveDown);
                menu.Items.Add(mMoveToBottom);

                menu.Items.Add("-");

                NamedObjectSave currentNamedObject = EditorLogic.CurrentNamedObject;

                if (currentNamedObject.SourceType == SourceType.FlatRedBallType &&
                    currentNamedObject.SourceClassType == "PositionedObjectList<T>" &&
                    !string.IsNullOrEmpty(currentNamedObject.SourceClassGenericType) &&
                    !currentNamedObject.SetByDerived)
                {
                    menu.Items.Add(form.addObjectToolStripMenuItem);
                }

            }

            #endregion

            #region IsReferencedFileNode
            else if (node.IsReferencedFile())
            {
                menu.Items.Add(form.viewInExplorerToolStripMenuItem);
                menu.Items.Add(mFindAllReferences);
                menu.Items.Add("Copy path to clipboard", null, HandleCopyToClipboardClick);
                menu.Items.Add("-");

                menu.Items.Add(mCreateZipPackage);
                menu.Items.Add(mRecreateCompanionFiles);

                menu.Items.Add("-");

                AddRemoveFromProjectItems(form, menu);

                menu.Items.Add(mUseContentPipeline);
                //menu.Items.Add(form.openWithDEFAULTToolStripMenuItem);

                ReferencedFileSave rfs = (ReferencedFileSave)node.Tag;

                if (FileManager.GetExtension(rfs.Name) == "csv" || rfs.TreatAsCsv)
                {
                    menu.Items.Add("-");
                    menu.Items.Add(form.setCreatedClassToolStripMenuItem);
                    menu.Items.Add(form.reGenerateCodeToolStripMenuItem);
                }


                if (!string.IsNullOrEmpty(rfs.SourceFile) || rfs.SourceFileCache.Count != 0)
                {
                    menu.Items.Add("-");
                    menu.Items.Add(mViewSourceInExplorer);
                    menu.Items.Add(mRebuildFile);
                }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:67,代码来源:RightClickHelper.cs

示例2: MoveReferencedFile

        private static void MoveReferencedFile(TreeNode treeNodeMoving, TreeNode targetNode)
        {
            while (targetNode != null && targetNode.IsReferencedFile
                ())
            {
                targetNode = targetNode.Parent;
            }
            // If the user drops a file on a Screen or Entity, let's allow them to
            // complete the operation on the Files node
            if (targetNode is BaseElementTreeNode)
            {
                targetNode = ((BaseElementTreeNode)targetNode).FilesTreeNode;
            }

            ReferencedFileSave referencedFileSave = treeNodeMoving.Tag as ReferencedFileSave;

            if (targetNode.IsGlobalContentContainerNode())
            {
                if (targetNode.GetContainingElementTreeNode() == null)
                {
                    string targetDirectory = ProjectManager.MakeAbsolute(targetNode.GetRelativePath(), true);
                    MoveReferencedFileToDirectory(referencedFileSave, targetDirectory);
                }
                else
                {
                    DragAddFileToGlobalContent(treeNodeMoving, referencedFileSave);
                    // This means the user wants to add the file
                    // to global content.
                }
            }
            else if (targetNode.IsFolderForGlobalContentFiles())
            {
                string targetDirectory = ProjectManager.MakeAbsolute(targetNode.GetRelativePath(), true);
                MoveReferencedFileToDirectory(referencedFileSave, targetDirectory);
            }
            else if (!targetNode.IsFilesContainerNode() &&
                !targetNode.IsFolderInFilesContainerNode() &&
                !targetNode.IsFolderForGlobalContentFiles())
            {
                MessageBox.Show(@"Can't drop this file here");
                return;
            }
            else if (!string.IsNullOrEmpty(referencedFileSave.SourceFile) ||
                referencedFileSave.SourceFileCache.Count != 0)
            {
                MessageBox.Show("Can't move the file\n\n" + referencedFileSave.Name + "\n\nbecause it has source-referencing files.  These sources will be broken " +
                    "if the file is moved.  You will need to manually move the file, modify the source references, remove this file, then add the newly-created file.");
                return;
            }
            //if (targetNode.IsFolderInFilesContainerNode() || targetNode.IsFilesContainerNode())
            else
            {
                // See if we're moving the RFS from one Element to another
                IElement container = ObjectFinder.Self.GetElementContaining(referencedFileSave);
                TreeNode elementTreeNodeDroppingIn = targetNode.GetContainingElementTreeNode();
                IElement elementDroppingIn = null;
                if (elementTreeNodeDroppingIn != null)
                {
                    // User didn't drop on an entity, but instead on a node within the entity.
                    // Let's check if it's a subfolder. If so, we need to tell the user that we
                    // can't add the file in a subfolder.

                    if (targetNode.IsFolderInFilesContainerNode())
                    {
                        MessageBox.Show("Shared files cannot be added to subfolders, so it will be added directly to \"Files\"");
                    }

                    elementDroppingIn = elementTreeNodeDroppingIn.Tag as IElement;
                }

                if (container != elementDroppingIn)
                {
                    ElementViewWindow.SelectedNode = targetNode;

                    string absoluteFileName = ProjectManager.MakeAbsolute(referencedFileSave.Name, true);
                    string creationReport;
                    string errorMessage;

                    var newlyCreatedFile = ElementCommands.Self.CreateReferencedFileSaveForExistingFile(elementDroppingIn, null, absoluteFileName,
                                                                    PromptHandleEnum.Prompt, 
                                                                    referencedFileSave.GetAssetTypeInfo(),
                                                                    out creationReport,
                                                                    out errorMessage);

                    ElementViewWindow.UpdateChangedElements();

                    
                    

                    if (!String.IsNullOrEmpty(errorMessage))
                    {
                        MessageBox.Show(errorMessage);
                    }
                    else if(newlyCreatedFile != null)
                    {
                        GlueCommands.Self.TreeNodeCommands.SelectTreeNode(newlyCreatedFile);

                    }
                }
                else
//.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:101,代码来源:ElementViewWindow.DragDrop.cs


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