本文整理汇总了C#中System.Windows.Forms.TreeNode.IsNamedObjectNode方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.IsNamedObjectNode方法的具体用法?C# TreeNode.IsNamedObjectNode怎么用?C# TreeNode.IsNamedObjectNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeNode
的用法示例。
在下文中一共展示了TreeNode.IsNamedObjectNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateRightClickItems
//.........这里部分代码省略.........
mImportElement.Text = "Import Screen";
menu.Items.Add(mImportElement);
}
#endregion
#region IsRootBehaviorsNode
else if (node.IsRootBehaviorsNode())
{
menu.Items.Add(form.addBehaviorToolStripMenuItem);
menu.Items.Add(form.openBehaviorFolderToolStripMenuItem);
menu.Items.Add(form.importBehaviorToolStripMenuItem);
}
#endregion
#region IsRootCustomVariables
else if (node.IsRootCustomVariablesNode())
{
menu.Items.Add(form.addVariableToolStripMenuItem);
}
#endregion
#region IsRootEventNode
else if (node.IsRootEventsNode())
{
menu.Items.Add(mAddEventMenuItem);
}
#endregion
#region IsNamedObjectNode
else if (node.IsNamedObjectNode())
{
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
示例2: MoveEntityOn
public static TreeNode MoveEntityOn(EntityTreeNode treeNodeMoving, TreeNode targetNode)
{
TreeNode newTreeNode = null;
#region Moving the Entity into (or out of) a directory
if (targetNode.IsDirectoryNode() || targetNode.IsRootEntityNode())
{
MoveEntityToDirectory(treeNodeMoving, targetNode);
}
#endregion
#region Moving an Entity onto another element to create an instance
else if (targetNode.IsEntityNode() || targetNode.IsScreenNode() || targetNode.IsRootNamedObjectNode())
{
bool isValidDrop = true;
// Make sure that we don't drop an Entity into its own Objects
if (targetNode.IsRootNamedObjectNode())
{
if(treeNodeMoving == targetNode.GetContainingElementTreeNode())
{
isValidDrop = false;
}
}
if (isValidDrop)
{
newTreeNode = MoveEntityOntoElement(treeNodeMoving, targetNode, newTreeNode);
}
}
#endregion
#region Moving an Entity onto a NamedObject (currently supports only Lists)
else if (targetNode.IsNamedObjectNode())
{
// Allow drop only if it's a list or Layer
NamedObjectSave targetNamedObjectSave = targetNode.Tag as NamedObjectSave;
if (!targetNamedObjectSave.IsList && !targetNamedObjectSave.IsLayer)
{
MessageBox.Show("The target is not a List or Layer so we can't add an Object to it.", "Target not valid");
}
if (targetNamedObjectSave.IsLayer)
{
TreeNode parent = targetNode.Parent;
newTreeNode = MoveEntityOn(treeNodeMoving, parent);
// this created a new NamedObjectSave. Let's put that on the Layer
MoveNamedObject(newTreeNode, targetNode);
}
else
{
// Make sure that the two types match
string listType = targetNamedObjectSave.SourceClassGenericType;
if (listType != treeNodeMoving.EntitySave.Name)
{
MessageBox.Show("The target list type is of type\n\n" +
listType +
"\n\nBut the Entity is of type\n\n" +
treeNodeMoving.EntitySave.Name +
"\n\nCould not add an instance to the list", "Could not add instance");
}
else
{
NamedObjectSave namedObject = new NamedObjectSave();
namedObject.InstanceName =
FileManager.RemovePath(listType) + "1";
StringFunctions.MakeNameUnique<NamedObjectSave>(
namedObject, targetNamedObjectSave.ContainedObjects);
// Not sure if we need to set this or not, but I think
// any instance added to a list will not be defined by base
namedObject.DefinedByBase = false;
NamedObjectSaveExtensionMethodsGlue.AddNamedObjectToCurrentNamedObjectList(namedObject);
ElementViewWindow.GenerateSelectedElementCode();
// Don't save the Glux, the caller of this method will take care of it
// GluxCommands.Self.SaveGlux();
}
}
}
#endregion
else if (targetNode.IsGlobalContentContainerNode())
{
AskAndAddAllContainedRfsToGlobalContent(treeNodeMoving.SaveObjectAsElement);
}
return newTreeNode;
}