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


C# NodeModel.GetValue方法代码示例

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


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

示例1: RunTest

        public override bool RunTest(NodeModel node, StreamWriter writer)
        {
            bool pass = false;

            var valueMap = new Dictionary<Guid, String>();
            if (node.OutPorts.Count > 0)
            {
                Guid guid = node.GUID;
                Object data = node.GetValue(0).Data;
                String val = data != null ? data.ToString() : "null";
                valueMap.Add(guid, val);
                writer.WriteLine(guid + " :: " + val);
                writer.Flush();
            }

            int numberOfUndosNeeded = Mutate(node);
            Thread.Sleep(100);

            writer.WriteLine("### - Beginning undo");
            for (int iUndo = 0; iUndo < numberOfUndosNeeded; iUndo++)
            {
                DynamoViewModel.UIDispatcher.Invoke(new Action(() =>
                {
                    DynamoViewModel.UndoRedoCommand undoCommand =
                        new DynamoViewModel.UndoRedoCommand(
                            DynamoViewModel.UndoRedoCommand.Operation.Undo);

                    DynamoViewModel.ExecuteCommand(undoCommand);
                }));
                Thread.Sleep(100);
            }
            writer.WriteLine("### - undo complete");
            writer.Flush();

            writer.WriteLine("### - undo complete");
            writer.Flush();
            writer.WriteLine("### - Beginning re-exec");

            DynamoViewModel.UIDispatcher.Invoke(new Action(() =>
            {
                DynamoViewModel.RunCancelCommand runCancel =
                    new DynamoViewModel.RunCancelCommand(false, false);

                DynamoViewModel.ExecuteCommand(runCancel);
            }));
            Thread.Sleep(10);

            while (DynamoViewModel.Model.Runner.Running)
            {
                Thread.Sleep(10);
            }
            writer.WriteLine("### - re-exec complete");
            writer.Flush();
            writer.WriteLine("### - Beginning readback");

            writer.WriteLine("### - Beginning test of String");
            if (node.OutPorts.Count > 0)
            {
                try
                {
                    String valmap = valueMap[node.GUID].ToString();
                    Object data = node.GetValue(0).Data;
                    String nodeVal = data != null ? data.ToString() : "null";

                    if (valmap != nodeVal)
                    {
                        writer.WriteLine("!!!!!!!!!!! - test of String is failed");
                        writer.WriteLine(node.GUID);

                        writer.WriteLine("Was: " + nodeVal);
                        writer.WriteLine("Should have been: " + valmap);
                        writer.Flush();
                        return pass;
                    }
                }
                catch (Exception)
                {
                    writer.WriteLine("!!!!!!!!!!! - test of String is failed");
                    writer.Flush();
                    return pass;
                }
            }
            writer.WriteLine("### - test of Number complete");
            writer.Flush();

            return pass = true;
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:87,代码来源:StringInputMutator.cs


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