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


C# DomNode.InitializeExtensions方法代码示例

本文整理汇总了C#中DomNode.InitializeExtensions方法的典型用法代码示例。如果您正苦于以下问题:C# DomNode.InitializeExtensions方法的具体用法?C# DomNode.InitializeExtensions怎么用?C# DomNode.InitializeExtensions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DomNode的用法示例。


在下文中一共展示了DomNode.InitializeExtensions方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestDuplicateNames

        // Tests http://tracker.ship.scea.com/jira/browse/WWSATF-1370
        // Test adding two types of extensions that have the same Name but different FullName.
        public void TestDuplicateNames()
        {
            var domType = new DomNodeType("domType");
            var extension = new ExtensionInfo<TestExtensionInfo>();
            domType.Define(extension);

            var domDerivedType = new DomNodeType("domDerivedType", domType);
            var anotherExtension = new ExtensionInfo<AnotherName.TestExtensionInfo>();
            domDerivedType.Define(anotherExtension);

            var domNode = new DomNode(domDerivedType);
            domNode.InitializeExtensions();
            Assert.IsTrue(domNode.GetExtension(extension).GetType() == typeof(TestExtensionInfo));
            Assert.IsTrue(domNode.GetExtension(anotherExtension).GetType() == typeof(AnotherName.TestExtensionInfo));

            ExtensionInfo getInfo = domType.GetExtensionInfo("UnitTests.Atf.Dom.TestExtensionInfo");
            Assert.IsNotNull(getInfo);
            Assert.AreEqual(getInfo, extension);

            getInfo = domDerivedType.GetExtensionInfo("UnitTests.Atf.Dom.TestExtensionInfo");
            Assert.IsNotNull(getInfo);
            Assert.AreEqual(getInfo, extension);
            
            ExtensionInfo anotherGetInfo = domDerivedType.GetExtensionInfo("UnitTests.Atf.Dom.AnotherName.TestExtensionInfo");
            Assert.IsNotNull(anotherGetInfo);
            Assert.AreEqual(anotherGetInfo, anotherExtension);
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:29,代码来源:TestExtensionInfo.cs

示例2: DomNode

        /// <summary>
        /// Finish MEF intialization for the component by creating DomNode tree for application data.</summary>
        void IInitializable.Initialize()
        {
            m_mainform.Shown += (sender, e) =>
                {
                    // create root node.
                    var rootNode = new DomNode(Schema.gameType.Type, Schema.gameRootElement);
                    rootNode.SetAttribute(Schema.gameType.nameAttribute, "Game");

                    // create Orc game object and add it to rootNode.
                    var orc = CreateOrc();
                    rootNode.GetChildList(Schema.gameType.gameObjectChild).Add(orc);

                    // add a child Orc.
                    var orcChildList = orc.GetChildList(Schema.orcType.orcChild);
                    orcChildList.Add(CreateOrc("Child Orc1"));

                    rootNode.InitializeExtensions();

                    var edContext = rootNode.Cast<GameEditingContext>();
                    edContext.Set(orc);

                    // set active context and select orc object.
                    m_contextRegistry.ActiveContext = rootNode;
                    
                };
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:28,代码来源:Editor.cs

示例3: Create

 public static PrefabInstance Create(IPrefab prefab)
 {
     DomNode instNode = new DomNode(Schema.prefabInstanceType.Type);
     PrefabInstance inst = instNode.As<PrefabInstance>();
     inst.m_prefab = prefab;
     instNode.InitializeExtensions();
     inst.Resolve(null);
     return inst;
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:9,代码来源:PrefabInstance.cs

示例4: Create

        public static TerrainGob Create(string name, string hmPath, float cellSize)
        {            
            if (string.IsNullOrWhiteSpace(name))
                throw new ArgumentNullException(name);

            if (!File.Exists(hmPath))
                throw new ArgumentException(hmPath + " does not exist");
            
            Uri ur = new Uri(hmPath);
            DomNode terrainNode = new DomNode(Schema.terrainGobType.Type);            
            terrainNode.SetAttribute(Schema.terrainGobType.cellSizeAttribute, cellSize);
            terrainNode.SetAttribute(Schema.terrainGobType.heightMapAttribute, ur);
            terrainNode.InitializeExtensions();
            TerrainGob terrain = terrainNode.As<TerrainGob>();
            terrain.Name = name;
            return terrain;
        }
开发者ID:arsaccol,项目名称:LevelEditor,代码行数:17,代码来源:TerrainGob.cs

示例5: TestDataValidator

        public TestDataValidator()
        {
            m_childType = new DomNodeType("child");
            m_parentType = new DomNodeType("parent");
            m_parentType.Define(new ExtensionInfo<ValidationContext>());
            m_parentType.Define(new ExtensionInfo<DataValidator>());

            m_childCountRule = new ChildCountRule(2, 3);
            m_childInfo = new ChildInfo("child", m_childType, true);
            m_parentType.Define(m_childInfo);
            m_childInfo.AddRule(m_childCountRule);

            m_parent = new DomNode(m_parentType);
            m_parent.InitializeExtensions();

            m_validationContext = m_parent.As<ValidationContext>();

            m_child1 = new DomNode(m_childType);
            m_child2 = new DomNode(m_childType);
            m_child3 = new DomNode(m_childType);
            m_child4 = new DomNode(m_childType);
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:22,代码来源:TestDataValidator.cs

示例6: TestMoveDomNode

        public void TestMoveDomNode()
        {
            var root = new DomNode(RootType.Type, RootElement);

            root.InitializeExtensions();

            var folderChild1 = new DomNode(FolderType.Type);
            var folderChild2 = new DomNode(FolderType.Type);
            var itemChild1 = new DomNode(ItemType.Type);
            var itemChild2 = new DomNode(ItemType.Type);

            var validationContext = root.As<ValidationContext>();
            
            // Set up the tree:
            // root
            //     folder
            //         item
            //     folder1
            //         item

            validationContext.RaiseBeginning();

            root.SetAttribute(RootType.NameAttribute, "root");
            itemChild1.SetAttribute(ItemType.NameAttribute, "item");
            itemChild2.SetAttribute(ItemType.NameAttribute, "item");
            folderChild1.SetAttribute(FolderType.NameAttribute, "folder");
            folderChild2.SetAttribute(FolderType.NameAttribute, "folder");

            folderChild1.GetChildList(FolderType.ItemChild).Add(itemChild1);
            folderChild2.GetChildList(FolderType.ItemChild).Add(itemChild2);

            root.GetChildList(RootType.FolderChild).Add(folderChild1);
            root.GetChildList(RootType.FolderChild).Add(folderChild2);

            // renames all folders and items with unique paths
            validationContext.RaiseEnding();
            validationContext.RaiseEnded(); 

            // Move item from first folder to second folder
            // root
            //     folder
            //     folder1
            //         item
            //         item1

            validationContext.RaiseBeginning();

            itemChild1.RemoveFromParent();
            folderChild2.GetChildList(FolderType.ItemChild).Add(itemChild1);

            validationContext.RaiseEnding();
            validationContext.RaiseEnded();
            Assert.DoesNotThrow(() => ValidateSubtree(folderChild2));
            // Make sure that the existing child wasn't renamed. Only the moved child should be renamed.
            Assert.True((string)itemChild2.GetAttribute(ItemType.NameAttribute) == "item");

            // Rename 'item_1' to 'item'.
            validationContext.RaiseBeginning();

            itemChild1.SetAttribute(ItemType.NameAttribute, "item");

            validationContext.RaiseEnding();
            validationContext.RaiseEnded();
            Assert.DoesNotThrow(() => ValidateSubtree(folderChild2));

            // Make sure that the existing child wasn't renamed. Only the moved child should be renamed.
            Assert.True((string)itemChild2.GetAttribute(ItemType.NameAttribute) == "item");

            // Rename the root.
            validationContext.RaiseBeginning();

            root.SetAttribute(RootType.NameAttribute, "new_root");

            validationContext.RaiseEnding();
            validationContext.RaiseEnded();
            Assert.DoesNotThrow(() => ValidateSubtree(root));
            Assert.True((string)root.GetAttribute(RootType.NameAttribute) == "new_root");
        }
开发者ID:sbambach,项目名称:ATF,代码行数:78,代码来源:TestUniquePathIdValidator.cs

示例7: Create

 public static DecorationMap Create(Uri maskuri)
 {
     DomNode node = new DomNode(Schema.decorationMapType.Type);
     node.SetAttribute(Schema.decorationMapType.maskAttribute, maskuri);
     node.InitializeExtensions();
     DecorationMap map = node.As<DecorationMap>();
     map.Name = "DecorationMap";
     return map;
 }
开发者ID:arsaccol,项目名称:LevelEditor,代码行数:9,代码来源:LayerMap.cs

示例8: Clone

        /// <summary>
        /// Clones this control point</summary>
        /// <returns>Cloned control point</returns>
        public IControlPoint Clone()
        {
            DomNode node = new DomNode(UISchema.controlPointType.Type);
            // clone local attributes
            foreach (AttributeInfo attributeInfo in DomNode.Type.Attributes)
            {
                object value = DomNode.GetLocalAttribute(attributeInfo);
                if (value != null)
                    node.SetAttribute(attributeInfo, attributeInfo.Type.Clone(value));
            }

            node.InitializeExtensions();
            return node.As<IControlPoint>();
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:17,代码来源:ControlPoint.cs

示例9: CreateControlPoint

 /// <summary>
 /// Creates a control point</summary>
 /// <returns>Control point</returns>
 public IControlPoint CreateControlPoint()
 {
     DomNode node = new DomNode(UISchema.controlPointType.Type);
     node.InitializeExtensions();
     IControlPoint cpt = node.As<IControlPoint>();
     cpt.TangentInType = CurveTangentTypes.Spline;
     cpt.TangentIn = new Vec2F(0.5f, 0.5f);
     cpt.TangentOutType = CurveTangentTypes.Spline;
     cpt.TangentOut = new Vec2F(0.5f, 0.5f);
     return cpt;
 }
开发者ID:Joxx0r,项目名称:ATF,代码行数:14,代码来源:Curve.cs

示例10: CreateControlPoint

 /// <summary>
 /// Creates a control point</summary>
 /// <returns>Control point</returns>
 public IControlPoint CreateControlPoint()
 {
     DomNode node = new DomNode(Schema.controlPointType.Type);
     node.InitializeExtensions();
     IControlPoint cpt = node.As<IControlPoint>();
     cpt.Name = "ControlPoint";            
     return cpt;
 }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:11,代码来源:Curve.cs

示例11: OpenUntitled

        public static XLEPlacementDocument OpenUntitled()
        {
            var rootNode = new DomNode(Schema.placementsDocumentType.Type, Schema.placementsDocumentRootElement);

            var doc = rootNode.As<XLEPlacementDocument>();

            // Initialize Dom extensions now that the data is complete
            rootNode.InitializeExtensions();

            var docRegistry = GetDocRegistry(); 
            if (docRegistry != null) docRegistry.Add(doc);
            doc.Dirty = true;
            return doc;
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:14,代码来源:XLEPlacementsDocument.cs


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