本文整理汇总了C#中FlatRedBall.Glue.SaveClasses.NamedObjectSave.CanBeInList方法的典型用法代码示例。如果您正苦于以下问题:C# NamedObjectSave.CanBeInList方法的具体用法?C# NamedObjectSave.CanBeInList怎么用?C# NamedObjectSave.CanBeInList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlatRedBall.Glue.SaveClasses.NamedObjectSave
的用法示例。
在下文中一共展示了NamedObjectSave.CanBeInList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestInheritance
public void TestInheritance()
{
NamedObjectSave baseListNos = new NamedObjectSave();
baseListNos.SourceType = SourceType.FlatRedBallType;
baseListNos.SourceClassType = "PositionedObjectList";
baseListNos.SourceClassGenericType = mEntitySave.Name;
NamedObjectSave derivedNos = new NamedObjectSave();
derivedNos.SourceType = SourceType.Entity;
derivedNos.SourceClassType = mDerivedEntitySave.Name;
if (derivedNos.CanBeInList(baseListNos) == false)
{
throw new Exception("CanBeInList doesn't properly follow inheritance");
}
}
示例2: HandleDropOnList
private static bool HandleDropOnList(TreeNode treeNodeMoving, TreeNode targetNode, NamedObjectSave targetNos, NamedObjectSave movingNos)
{
bool succeeded = true;
#region Failure cases
if (string.IsNullOrEmpty(targetNos.SourceClassGenericType))
{
MessageBox.Show("The target Object has not been given a list type yet");
}
else if (movingNos.CanBeInList(targetNos) == false)
{
MessageBox.Show("The Object you are moving is of type " + movingNos.SourceClassType +
" but the list is of type " + targetNos.SourceClassGenericType);
}
else if (treeNodeMoving.Parent.IsRootNamedObjectNode() == false)
{
MessageBox.Show("The Object you are moving is already part of a list, so it can't be moved");
}
#endregion
else
{
succeeded = true;
// Get the old parent of the moving NOS
TreeNode parentTreeNode = treeNodeMoving.Parent;
if (parentTreeNode.IsNamedObjectNode())
{
NamedObjectSave parentNos = parentTreeNode.Tag as NamedObjectSave;
parentNos.ContainedObjects.Remove(movingNos);
}
else
{
EditorLogic.CurrentElement.NamedObjects.Remove(movingNos);
}
parentTreeNode.Nodes.Remove(treeNodeMoving);
targetNode.Nodes.Add(treeNodeMoving);
// Add the NOS to the tree node moving on
targetNos.ContainedObjects.Add(movingNos);
}
return succeeded;
}