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