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


C# NamedObjectSave.CanBeInList方法代码示例

本文整理汇总了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");
            }
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:16,代码来源:NamedObjectSaveTests.cs

示例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;
        }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:46,代码来源:ElementViewWindow.DragDrop.cs


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