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


C# GraphController.WaitForPreviewRequestCompletion方法代码示例

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


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

示例1: TestSimpleAddition

        public void TestSimpleAddition()
        {
            // 1. Create code block node with value of 123.
            // 2. Create "Add" function node.
            // 3. Drag to connect from output of code block node to first input of add function node.
            //
            string commands = @"
                CreateCodeBlockNode|d:15381.0|d:15112.0|s:Your code goes here
                BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                EndNodeEdit|u:0x10000001|s:3|b:True
                CreateCodeBlockNode|d:15339.0|d:15196.0|s:Your code goes here
                BeginNodeEdit|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text
                EndNodeEdit|u:0x10000002|s:5|b:True
                CreateFunctionNode|d:15497.0|d:15135.0|s:Special Nodes|s:+|s:double,double
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:15343.0|d:15113.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:15449.0|d:15129.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:15301.0|d:15199.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None|d:15436.0|d:15147.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None";

            GraphController controller = new GraphController(null);

            // Indicate that the test case is interested in the values of
            // all these nodes whose IDs are represented by the input array.
            controller.RegisterPreviewRequest(new uint[]
            {
                0x10000001,
                0x10000002,
                0x10000003
            });

            bool result = controller.RunCommands(commands);
            Assert.AreEqual(true, result);

            // WaitForPreviewRequestCompletion method internally creates a Task and
            // blocks on its 'Result' property until either it timed out, or all the
            // requested node values are computed.
            Assert.AreEqual(true, controller.WaitForPreviewRequestCompletion(100000));

            // These calls are just to validate requested node values.
            PreviewRequest requestedData = controller.GetPreviewRequest();
            ProtoCore.DSASM.StackValue value = requestedData.GetNodeValue(0x10000003);
            Assert.AreEqual(8, value.opdata);

            value = requestedData.GetNodeValue(0x10000001);
            Assert.AreEqual(3, value.opdata);

            value = requestedData.GetNodeValue(0x10000002);
            Assert.AreEqual(5, value.opdata);
        }
开发者ID:samuto,项目名称:designscript,代码行数:53,代码来源:AsynchronousTests.cs


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