本文整理汇总了C#中System.Windows.Forms.TreeNode.IsRootCustomVariablesNode方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.IsRootCustomVariablesNode方法的具体用法?C# TreeNode.IsRootCustomVariablesNode怎么用?C# TreeNode.IsRootCustomVariablesNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeNode
的用法示例。
在下文中一共展示了TreeNode.IsRootCustomVariablesNode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateRightClickItems
//.........这里部分代码省略.........
else if (node.IsRootEntityNode())
{
menu.Items.Add(form.addEntityToolStripMenuItem);
mImportElement.Text = "Import Entity";
menu.Items.Add(mImportElement);
menu.Items.Add(form.addFolderToolStripMenuItem);
}
#endregion
#region IsRootScreenNode
else if (node.IsRootScreenNode())
{
menu.Items.Add(form.addScreenToolStripMenuItem);
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);
示例2: MoveCustomVariable
private static void MoveCustomVariable(TreeNode nodeMoving, TreeNode targetNode)
{
CustomVariable customVariable = nodeMoving.Tag as CustomVariable;
if (targetNode.IsRootEventsNode())
{
// The user dragged a variable onto the events node, so they want to make
// an event for this. We'll assume an "after" event since I think no one makes
// before events
if (customVariable != null)
{
customVariable.CreatesEvent = true;
FlatRedBall.Glue.Events.EventResponseSave eventResponseSave = new Events.EventResponseSave();
eventResponseSave.EventName = "After" + customVariable.Name + "Set";
eventResponseSave.SourceObject = null;
eventResponseSave.SourceObjectEvent = null;
eventResponseSave.SourceVariable = customVariable.Name;
eventResponseSave.BeforeOrAfter = BeforeOrAfter.After;
eventResponseSave.DelegateType = null;
RightClickHelper.AddEventToElementAndSave(EditorLogic.CurrentElement, eventResponseSave);
}
}
else if (targetNode.IsRootCustomVariablesNode())
{
// let's see if the user is moving a variable from one element to another
IElement sourceElement = nodeMoving.GetContainingElementTreeNode().Tag as IElement;
IElement targetElement = targetNode.GetContainingElementTreeNode().Tag as IElement;
if (sourceElement != targetElement)
{
// copying a variable from one element to another
// eventually we need to add some error checking here.
CustomVariable newVariable = customVariable.Clone();
targetElement.CustomVariables.Add(newVariable);
GlueCommands.Self.GenerateCodeCommands.GenerateElementCode(targetElement);
GlueCommands.Self.RefreshCommands.RefreshUi(targetElement);
}
}
}
示例3: MoveNamedObject
private static void MoveNamedObject(TreeNode treeNodeMoving, TreeNode targetNode)
{
if (targetNode != null)
{
NamedObjectSave targetNos = targetNode.Tag as NamedObjectSave;
NamedObjectSave movingNos = treeNodeMoving.Tag as NamedObjectSave;
bool succeeded = false;
if (targetNode == null)
{
// Didn't move on to anything
}
else if (targetNode.IsRootNamedObjectNode())
{
succeeded = MoveObjectOnObjectsRoot(treeNodeMoving, targetNode, movingNos, succeeded);
}
else if (targetNode.IsRootCustomVariablesNode())
{
MoveObjectOnRootCustomVariablesNode(treeNodeMoving, targetNode);
}
else if (targetNode.Tag is IElement)
{
succeeded = DragDropNosIntoElement(movingNos, targetNode.Tag as IElement);
}
else if (targetNode.IsRootEventsNode())
{
succeeded = DragDropNosOnRootEventsNode(treeNodeMoving, targetNode);
}
else if (targetNos != null && targetNos.SourceType == SourceType.FlatRedBallType)
{
string targetClassType = targetNos.SourceClassType;
#region Failure cases
if (string.IsNullOrEmpty(targetClassType))
{
MessageBox.Show("The target Object does not have a defined type. This operation is not valid");
}
#endregion
#region Moving on to a Layer
else if (targetClassType == "Layer")
{
// Only allow this if the NOS's are on the same object
if (ObjectFinder.Self.GetElementContaining(movingNos) ==
ObjectFinder.Self.GetElementContaining(targetNos))
{
succeeded = true;
movingNos.LayerOn = targetNos.InstanceName;
MainGlueWindow.Self.PropertyGrid.Refresh();
}
}
#endregion
#region Moving on to a PositionedObjectList
else if (targetClassType == "PositionedObjectList<T>")
{
succeeded = HandleDropOnList(treeNodeMoving, targetNode, targetNos, movingNos);
}
#endregion
}
else
{
MessageBox.Show("Invalid movement");
}
if (succeeded)
{
if (EditorLogic.CurrentElement != null)
{
ElementViewWindow.GenerateSelectedElementCode();
}
else
{
ContentLoadWriter.UpdateLoadGlobalContentCode();
}
ProjectManager.SaveProjects();
GluxCommands.Self.SaveGlux();
}
}
}
示例4: MoveStateCategory
private static void MoveStateCategory(TreeNode nodeMoving, TreeNode targetNode)
{
if (targetNode.IsRootCustomVariablesNode() || targetNode.IsCustomVariable())
{
// The user drag+dropped a state category into the variables
// Let's make sure that it's all in the same Element though:
if (targetNode.GetContainingElementTreeNode() == nodeMoving.GetContainingElementTreeNode())
{
StateSaveCategory category = nodeMoving.Tag as StateSaveCategory;
// expose a variable that exposes the category
CustomVariable customVariable = new CustomVariable();
if (category.SharesVariablesWithOtherCategories)
{
customVariable.Type = "VariableState";
customVariable.Name = "CurrentState";
}
else
{
customVariable.Type = category.Name;
customVariable.Name = "Current" + category.Name + "State";
}
IElement element = targetNode.GetContainingElementTreeNode().Tag as IElement;
element.CustomVariables.Add(customVariable);
GlueCommands.Self.GenerateCodeCommands.GenerateCurrentElementCode();
EditorLogic.CurrentElementTreeNode.UpdateReferencedTreeNodes();
}
}
}