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


C# DomNode.Update方法代码示例

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


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

示例1: CreateTestCircuitProgrammatically

        // Create circuit DOM hierarchy programmatically
        static public DomNode CreateTestCircuitProgrammatically(SchemaLoader schemaLoader)
        {
            var rootNode = new DomNode(Schema.circuitDocumentType.Type, Schema.circuitRootElement);        
            // create an empty root prototype folder( required child by schema)
            rootNode.SetChild(
                Schema.circuitDocumentType.prototypeFolderChild,
                new DomNode(Schema.prototypeFolderType.Type));
            
            var circuit = rootNode.Cast<Circuit>();

            var inputFiles = new DomNode(Schema.groupType.Type).Cast<Group>();
            inputFiles.Id = "groupInputFiles";
            inputFiles.Name = "Input Files".Localize();
            inputFiles.Bounds = new Rectangle(64, 96, 0, 0); // set node location, size will be auto-computed
 
            var firstWavgGroup = new DomNode(Schema.groupType.Type).Cast<Group>();
            firstWavgGroup.Id = "first.Wav";
            firstWavgGroup.Name = "first".Localize("as in, 'the first file'") + ".wav";

            var buttonType = schemaLoader.GetNodeType(Schema.NS + ButtonTypeName);
            var button1 = new DomNode(buttonType).Cast<Module>();
            button1.Id = "button1";
            button1.Bounds = new Rectangle(0, 0, 0, 0);

            var button2 = new DomNode(buttonType).Cast<Module>();
            button2.Bounds = new Rectangle(0, 64, 0, 0);
            button2.Id = "button2";

            firstWavgGroup.Elements.Add(button1);
            firstWavgGroup.Elements.Add(button2);
            firstWavgGroup.Expanded = true;
            firstWavgGroup.Update();


            var secondWavgGroup = new DomNode(Schema.groupType.Type).Cast<Group>();
            secondWavgGroup.Id = "second.Wav";
            secondWavgGroup.Name = "second".Localize("as in, 'the second file'") + ".wav";

            var button3 = new DomNode(buttonType).Cast<Module>();
            button3.Id = "button3";
            button3.Bounds = new Rectangle(0, 0, 0, 0);

            var button4 = new DomNode(buttonType).Cast<Module>();
            button4.Bounds = new Rectangle(0, 64, 0, 0);
            button4.Id = "button4";

            secondWavgGroup.Elements.Add(button3);
            secondWavgGroup.Elements.Add(button4);
            secondWavgGroup.Expanded = true;
            secondWavgGroup.Update();
            secondWavgGroup.Bounds = new Rectangle(0, 224, 0, 0);
  
            inputFiles.Elements.Add(firstWavgGroup);
            inputFiles.Elements.Add(secondWavgGroup);
            inputFiles.Update();
            inputFiles.Expanded = true;

            circuit.Elements.Add(inputFiles);


            var structure = new DomNode(Schema.groupType.Type).Cast<Group>();
            structure.Id = "structure".Localize("this is the name of a group of circuit elements; the name is arbitrary");
            structure.Name = "structure".Localize("this is the name of a group of circuit elements; the name is arbitrary");
            structure.Bounds = new Rectangle(352, 96, 0, 0); 
 

            var subStream0 = new DomNode(Schema.groupType.Type).Cast<Group>();
            subStream0.Id = "subStream0".Localize("this is the name of a group of circuit elements; the name is arbitrary");
            subStream0.Name = "sub-stream 0".Localize("this is the name of a group of circuit elements; the name is arbitrary");

            var lightType = schemaLoader.GetNodeType(Schema.NS + LightTypeName);

            var light1 = new DomNode(lightType).Cast<Module>();
            light1.Id = "light1";
            light1.Bounds = new Rectangle(0, 0, 0, 0);

            var light2 = new DomNode(lightType).Cast<Module>();
            light2.Id = "light2";
            light2.Bounds = new Rectangle(0, 64, 0, 0);

            var light3 = new DomNode(lightType).Cast<Module>();
            light3.Id = "light3";
            light3.Bounds = new Rectangle(0, 128, 0, 0);

            var light4 = new DomNode(lightType).Cast<Module>();
            light4.Id = "light4";
            light4.Bounds = new Rectangle(0, 192, 0, 0);

            var light5 = new DomNode(lightType).Cast<Module>();
            light5.Id = "light5";
            light5.Bounds = new Rectangle(0, 256, 0, 0);

            var light6 = new DomNode(lightType).Cast<Module>();
            light6.Id = "light6";
            light6.Bounds = new Rectangle(0, 320, 0, 0);


            subStream0.Elements.Add(light1);
            subStream0.Elements.Add(light2);
//.........这里部分代码省略.........
开发者ID:vincenthamm,项目名称:ATF,代码行数:101,代码来源:CircuitEditorTester.cs


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