本文整理汇总了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);
}
示例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
//.........这里部分代码省略.........