• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DSEngine.EngineController类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Dynamo.DSEngine.EngineController的典型用法代码示例。如果您正苦于以下问题:C# EngineController类的具体用法?C# EngineController怎么用?C# EngineController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EngineController类属于Dynamo.DSEngine命名空间,在下文中一共展示了EngineController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: LiveRunnerServices

        public LiveRunnerServices(EngineController controller)
        {
            this.controller = controller;
            liveRunner = LiveRunnerFactory.CreateLiveRunner(controller);

            liveRunner.GraphUpdateReady += GraphUpdateReady;
            liveRunner.NodeValueReady += NodeValueReady;
        }
开发者ID:heegwon,项目名称:Dynamo,代码行数:8,代码来源:LiveRunnerServices.cs


示例2: QueryMirrorDataAsyncTask

        internal QueryMirrorDataAsyncTask(QueryMirrorDataParams initParams)
            : base(initParams.Scheduler)
        {
            if (initParams.EngineController == null)
                throw new ArgumentNullException("initParams.EngineController");
            if (string.IsNullOrEmpty(initParams.VariableName))
                throw new ArgumentNullException("initParams.VariableName");

            variableName = initParams.VariableName;
            engineController = initParams.EngineController;
        }
开发者ID:junmendoza,项目名称:Dynamo,代码行数:11,代码来源:QueryMirrorDataAsyncTask.cs


示例3: Initialize

        /// <summary>
        /// This method is called by task creator to associate the trace data with
        /// the current instance of virtual machine. The given WorkspaceModel can
        /// optionally contain saved trace data in a previous execution session. As
        /// a side-effect, this method resets "WorkspaceModel.PreloadedTraceData"
        /// data member to ensure the correctness of the execution flow.
        /// </summary>
        /// <param name="controller">Reference to the EngineController on which the 
        /// loaded trace data should be set.</param>
        /// <param name="workspace">The workspace from which the trace data should 
        /// be retrieved.</param>
        /// <returns>If the given WorkspaceModel contains saved trace data, this 
        /// method returns true, in which case the task needs to be scheduled.
        /// Otherwise, the method returns false.</returns>
        /// 
        internal bool Initialize(EngineController controller, WorkspaceModel workspace)
        {
            if (controller == null || (controller.LiveRunnerCore == null))
                return false;

            engineController = controller;
            traceData = workspace.PreloadedTraceData;

            TargetedWorkspace = workspace;
            workspace.PreloadedTraceData = null;
            return ((traceData != null) && traceData.Any());
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:27,代码来源:SetTraceDataAsyncTask.cs


示例4: CancelAsync

 public void CancelAsync(EngineController engineController)
 {
     if (Running)
     {
         cancelSet = true;
         engineController.LiveRunnerCore.RequestCancellation();
         
         // We need to wait for evaluation thread to complete after a cancellation
         // until the LR and Engine controller are reset properly
         if (evaluationThread != null)
             evaluationThread.Join();
     }
 }
开发者ID:whztt07,项目名称:Dynamo,代码行数:13,代码来源:DynamoRunner.cs


示例5: Initialize

        /// <summary>
        /// Call this method to intialize a CompileCustomNodeAsyncTask with an 
        /// EngineController, nodes from the corresponding CustomNodeWorkspaceModel,
        /// and inputs/outputs of the CustomNodeDefinition.
        /// </summary>
        /// <param name="initParams">Input parameters required for compilation of 
        /// the CustomNodeDefinition.</param>
        /// <returns>Returns true if GraphSyncData is generated successfully and 
        /// that the CompileCustomNodeAsyncTask should be scheduled for execution.
        /// Returns false otherwise.</returns>
        /// 
        internal bool Initialize(CompileCustomNodeParams initParams)
        {
            engineController = initParams.EngineController;

            try
            {
                graphSyncData = engineController.ComputeSyncData(initParams);
                return graphSyncData != null;
            }
            catch (Exception)
            {
                return false;
            }
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:25,代码来源:CompileCustomNodeAsyncTask.cs


示例6: Initialize

 /// <summary>
 /// This method is called by codes that intent to start a graph update.
 /// This method is called on the main thread where node collection in a 
 /// WorkspaceModel can be safely accessed.
 /// </summary>
 /// <param name="controller">Reference to an instance of EngineController 
 /// to assist in generating GraphSyncData object for the given set of nodes.
 /// </param>
 /// <param name="workspace">Reference to the WorkspaceModel from which a 
 /// set of updated nodes is computed. The EngineController generates the 
 /// resulting GraphSyncData from this list of updated nodes.</param>
 /// <param name="dynamoLogger"> Logs the error message</param>
 /// <returns>Returns the list of node id's that will be executed in the next run
 /// for execution).</returns>
 internal List<Guid> Initialize(EngineController controller, WorkspaceModel workspace)
 {
     try
     {
         engineController = controller;
         TargetedWorkspace = workspace;                
         modifiedNodes = ComputeModifiedNodes(workspace);                
         previewGraphData = engineController.PreviewGraphSyncData(modifiedNodes,verboseLogging);
         return previewGraphData;
     }
     catch (Exception e)
     {             
         return null;
     }
 }
开发者ID:junmendoza,项目名称:Dynamo,代码行数:29,代码来源:PreviewGraphAsyncTask.cs


示例7: Initialize

        /// <summary>
        /// This method is called by codes that intent to start a graph update.
        /// This method is called on the main thread where node collection in a 
        /// WorkspaceModel can be safely accessed.
        /// </summary>
        /// <param name="controller">Reference to an instance of EngineController 
        /// to assist in generating GraphSyncData object for the given set of nodes.
        /// </param>
        /// <param name="workspace">Reference to the WorkspaceModel from which a 
        /// set of updated nodes is computed. The EngineController generates the 
        /// resulting GraphSyncData from this list of updated nodes.</param>
        /// <returns>Returns true if there is any GraphSyncData, or false otherwise
        /// (in which case there will be no need to schedule UpdateGraphAsyncTask 
        /// for execution).</returns>
        /// 
        internal bool Initialize(EngineController controller, WorkspaceModel workspace)
        {
            try
            {
                engineController = controller;
                TargetedWorkspace = workspace;

                modifiedNodes = ComputeModifiedNodes(workspace);
                graphSyncData = engineController.ComputeSyncData(modifiedNodes);
                return graphSyncData != null;
            }
            catch (Exception)
            {
                return false;
            }
        }
开发者ID:whztt07,项目名称:Dynamo,代码行数:31,代码来源:UpdateGraphAsyncTask.cs


示例8: Initialize

        /// <summary>
        /// This method is called by code that intends to start a graph update.
        /// This method is called on the main thread where node collection in a 
        /// WorkspaceModel can be safely accessed.
        /// </summary>
        /// <param name="controller">Reference to an instance of EngineController 
        /// to assist in generating GraphSyncData object for the given set of nodes.
        /// </param>
        /// <param name="workspace">Reference to the WorkspaceModel from which a 
        /// set of updated nodes is computed. The EngineController generates the 
        /// resulting GraphSyncData from this list of updated nodes.</param>
        /// <returns>Returns true if there is any GraphSyncData, or false otherwise
        /// (in which case there will be no need to schedule UpdateGraphAsyncTask 
        /// for execution).</returns>
        /// 
        internal bool Initialize(EngineController controller, WorkspaceModel workspace)
        {
            try
            {
                engineController = controller;
                TargetedWorkspace = workspace;

                ModifiedNodes = ComputeModifiedNodes(workspace);
                graphSyncData = engineController.ComputeSyncData(workspace.Nodes, ModifiedNodes, verboseLogging);
                return graphSyncData != null;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("UpgradeGraphAsyncTask saw: " + e.ToString());
                return false;
            }
        }
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:32,代码来源:UpdateGraphAsyncTask.cs


示例9: GeneratedGraphicItems

        public static List<IGraphicItem> GeneratedGraphicItems(this NodeModel node, EngineController engineController)
        {
            var ids = node.GetAllOutportAstIdentifiers();

            var results = new List<IGraphicItem>();

            foreach (var id in ids)
            {
                var mirror = engineController.GetMirror(id);
                if (mirror == null) continue;

                var mirrorData = mirror.GetData();
                if (mirrorData == null) continue;

                GetGraphicItemsFromMirrorData(mirrorData, results);
            }

            return results;
        }
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:19,代码来源:NodeModelExtensions.cs


示例10: Initialize

        /// <summary>
        /// Call this method to intialize a CompileCustomNodeAsyncTask with an 
        /// EngineController and an GraphSyncData that is required to compile the 
        /// associated custom node.
        /// </summary>
        /// <param name="initParams">Input parameters required for custom node 
        /// graph updates.</param>
        /// <returns>Returns true if GraphSyncData is not empty and that the 
        /// CompileCustomNodeAsyncTask should be scheduled for execution. Returns
        /// false otherwise.</returns>
        /// 
        internal bool Initialize(CompileCustomNodeParams initParams)
        {
            if (initParams == null)
                throw new ArgumentNullException("initParams");

            engineController = initParams.EngineController;
            graphSyncData = initParams.SyncData;

            if (engineController == null)
                throw new ArgumentNullException("engineController");
            if (graphSyncData == null)
                throw new ArgumentNullException("graphSyncData");

            var added = graphSyncData.AddedSubtrees;
            var deleted = graphSyncData.DeletedSubtrees;
            var modified = graphSyncData.ModifiedSubtrees;

            // Returns true if there is any actual data.
            return ((added != null && added.Count > 0) ||
                    (modified != null && modified.Count > 0) ||
                    (deleted != null && deleted.Count > 0));
        }
开发者ID:junmendoza,项目名称:Dynamo,代码行数:33,代码来源:CompileCustomNodeAsyncTask.cs


示例11: RunTest

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

            var valueMap = new Dictionary<Guid, String>();
            if (node.OutPorts.Count > 0)
            {
                var firstNodeConnectors = node.AllConnectors.ToList(); //Get node connectors
                foreach (ConnectorModel connector in firstNodeConnectors)
                {
                    Guid guid = connector.Start.Owner.GUID;
                    if (!valueMap.ContainsKey(guid))
                    {
                        Object data = connector.Start.Owner.GetValue(0, engine).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(() =>
                {
                    DynamoModel.UndoRedoCommand undoCommand =
                        new DynamoModel.UndoRedoCommand(DynamoModel.UndoRedoCommand.Operation.Undo);

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

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

                DynamoViewModel.ExecuteCommand(runCancel);
            }));
            while (!DynamoViewModel.HomeSpace.RunSettings.RunEnabled)
            {
                Thread.Sleep(10);
            }

            writer.WriteLine("### - Beginning test of NumberSequence");
            if (node.OutPorts.Count > 0)
            {
                try
                {
                    var firstNodeConnectors = node.AllConnectors.ToList();
                    foreach (ConnectorModel connector in firstNodeConnectors)
                    {
                        String valmap = valueMap[connector.Start.Owner.GUID].ToString();
                        Object data = connector.Start.Owner.GetValue(0, engine).Data;
                        String nodeVal = data != null ? data.ToString() : "null";

                        if (valmap != nodeVal)
                        {
                            writer.WriteLine("!!!!!!!!!!! - test of NumberSequence 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 NumberSequence is failed");
                    writer.Flush();
                    return pass;
                }
            }
            writer.WriteLine("### - test of NumberSequence complete");
            writer.Flush();

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


示例12: RequestVisualUpdateAsync

        /// <summary>
        /// Call this method to asynchronously regenerate render package for 
        /// this node. This method accesses core properties of a NodeModel and 
        /// therefore is typically called on the main/UI thread.
        /// </summary>
        /// <param name="engine"></param>
        /// <param name="scheduler"></param>
        /// <param name="maxTessellationDivisions">The maximum number of 
        /// tessellation divisions to use for regenerating render packages.</param>
        public void RequestVisualUpdateAsync(IScheduler scheduler, EngineController engine, IRenderPackageFactory factory)
        {
            //if (Workspace.DynamoModel == null)
            //    return;

            // Imagine a scenario where "NodeModel.RequestVisualUpdateAsync" is being 
            // called in quick succession from the UI thread -- the first task may 
            // be updating '_renderPackages' when the second call gets here. In 
            // this case '_renderPackages' should be protected against concurrent 
            // accesses.
            // 
            lock (RenderPackagesMutex)
            {
                renderPackages.Clear();
                HasRenderPackages = false;
            }

            RequestVisualUpdateAsyncCore(scheduler, engine, factory);
        }
开发者ID:w-fish,项目名称:Dynamo,代码行数:28,代码来源:NodeModel.cs


示例13: ConvertNodesToCodeInternal

        internal void ConvertNodesToCodeInternal(EngineController engineController)
        {
            var selectedNodes = DynamoSelection.Instance
                                               .Selection
                                               .OfType<NodeModel>()
                                               .Where(n => n.IsConvertible);
            if (!selectedNodes.Any())
                return;

            var cliques = NodeToCodeUtils.GetCliques(selectedNodes).Where(c => !(c.Count == 1 && c.First() is CodeBlockNodeModel));
            var codeBlockNodes = new List<CodeBlockNodeModel>();

            //UndoRedo Action Group----------------------------------------------
            NodeToCodeUndoHelper undoHelper = new NodeToCodeUndoHelper();

            // using (UndoRecorder.BeginActionGroup())
            {
                foreach (var nodeList in cliques)
                {
                    //Create two dictionarys to store the details of the external connections that have to 
                    //be recreated after the conversion
                    var externalInputConnections = new Dictionary<ConnectorModel, string>();
                    var externalOutputConnections = new Dictionary<ConnectorModel, string>();

                    //Also collect the average X and Y co-ordinates of the different nodes
                    int nodeCount = nodeList.Count;

                    var nodeToCodeResult = engineController.ConvertNodesToCode(this.nodes, nodeList);

                    #region Step I. Delete all nodes and their connections

                    double totalX = 0, totalY = 0;

                    foreach (var node in nodeList)
                    {
                        #region Step I.A. Delete the connections for the node

                        foreach (var connector in node.AllConnectors.ToList())
                        {
                            if (!IsInternalNodeToCodeConnection(nodeList, connector))
                            {
                                //If the connector is an external connector, the save its details
                                //for recreation later
                                var startNode = connector.Start.Owner;
                                int index = startNode.OutPorts.IndexOf(connector.Start);
                                //We use the varibleName as the connection between the port of the old Node
                                //to the port of the new node.
                                var variableName = startNode.GetAstIdentifierForOutputIndex(index).Value;

                                //Store the data in the corresponding dictionary
                                if (startNode == node)
                                {
                                    if (nodeToCodeResult.OutputMap.ContainsKey(variableName))
                                        variableName = nodeToCodeResult.OutputMap[variableName];
                                    externalOutputConnections.Add(connector, variableName);
                                }
                                else
                                {
                                    if (nodeToCodeResult.InputMap.ContainsKey(variableName))
                                        variableName = nodeToCodeResult.InputMap[variableName];
                                    externalInputConnections.Add(connector, variableName);
                                }
                            }

                            //Delete the connector
                            undoHelper.RecordDeletion(connector);
                            connector.Delete();
                        }
                        #endregion

                        #region Step I.B. Delete the node
                        totalX += node.X;
                        totalY += node.Y;
                        undoHelper.RecordDeletion(node);
                        Nodes.Remove(node);
                        #endregion
                    }
                    #endregion

                    #region Step II. Create the new code block node
                    var outputVariables = externalOutputConnections.Values;
                    var newResult = NodeToCodeUtils.ConstantPropagationForTemp(nodeToCodeResult, outputVariables);
                    NodeToCodeUtils.ReplaceWithUnqualifiedName(engineController.LibraryServices.LibraryManagementCore, newResult.AstNodes);
                    var codegen = new ProtoCore.CodeGenDS(newResult.AstNodes);
                    var code = codegen.GenerateCode();

                    var codeBlockNode = new CodeBlockNodeModel(
                        code,
                        System.Guid.NewGuid(), 
                        totalX / nodeCount,
                        totalY / nodeCount, engineController.LibraryServices);
                    undoHelper.RecordCreation(codeBlockNode);
                    Nodes.Add(codeBlockNode);
                    this.RegisterNode(codeBlockNode);

                    codeBlockNodes.Add(codeBlockNode);
                    #endregion

                    #region Step III. Recreate the necessary connections
                    var newInputConnectors = ReConnectInputConnections(externalInputConnections, codeBlockNode);
//.........这里部分代码省略.........
开发者ID:ke-yu,项目名称:Dynamo,代码行数:101,代码来源:WorkspaceModel.cs


示例14: Compile

        /// <summary>
        /// Compiles this custom node definition, updating all UI instances to match
        /// inputs and outputs and registering new definition with the EngineController.
        /// </summary>
        public void Compile(DynamoModel dynamoModel, EngineController controller)
        {
            // If we are loading dyf file, dont compile it until all nodes are loaded
            // otherwise some intermediate function defintions will be created.
            // TODO: This is a hack, in reality we should be preventing this from being called at the Workspace.RequestSync() level --SJE
            if (IsBeingLoaded || IsProxy)
                return;

            #region Outputs and Inputs and UI updating

            #region Find outputs

            // Find output elements for the node
            List<Output> outputs = WorkspaceModel.Nodes.OfType<Output>().ToList();
 
            var topMost = new List<Tuple<int, NodeModel>>();

            List<string> outNames;

            // if we found output nodes, add select their inputs
            // these will serve as the function output
            if (outputs.Any())
            {
                topMost.AddRange(
                    outputs.Where(x => x.HasInput(0)).Select(x => Tuple.Create(0, x as NodeModel)));
                outNames = outputs.Select(x => x.Symbol).ToList();
            }
            else
            {
                outNames = new List<string>();

                // if there are no explicitly defined output nodes
                // get the top most nodes and set THEM as the output
                IEnumerable<NodeModel> topMostNodes = WorkspaceModel.GetTopMostNodes();

                var rtnPorts =
                    //Grab multiple returns from each node
                    topMostNodes.SelectMany(
                        topNode =>
                            //If the node is a recursive instance...
                            topNode is Function && (topNode as Function).Definition == this
                                // infinity output
                                ? new[] { new { portIndex = 0, node = topNode, name = "∞" } }
                                // otherwise, grab all ports with connected outputs and package necessary info
                                : topNode.OutPortData
                                    .Select(
                                        (port, i) =>
                                            new { portIndex = i, node = topNode, name = port.NickName })
                                    .Where(x => !topNode.HasOutput(x.portIndex)));

                foreach (var rtnAndIndex in rtnPorts.Select((rtn, i) => new { rtn, idx = i }))
                {
                    topMost.Add(Tuple.Create(rtnAndIndex.rtn.portIndex, rtnAndIndex.rtn.node));
                    outNames.Add(rtnAndIndex.rtn.name ?? rtnAndIndex.idx.ToString());
                }
            }

            var nameDict = new Dictionary<string, int>();
            foreach (var name in outNames)
            {
                if (nameDict.ContainsKey(name))
                    nameDict[name]++;
                else
                    nameDict[name] = 0;
            }

            nameDict = nameDict.Where(x => x.Value != 0).ToDictionary(x => x.Key, x => x.Value);

            outNames.Reverse();

            var keys = new List<string>();
            foreach (var name in outNames)
            {
                int amt;
                if (nameDict.TryGetValue(name, out amt))
                {
                    nameDict[name] = amt - 1;
                    keys.Add(name == "" ? amt + ">" : name + amt);
                }
                else
                    keys.Add(name);
            }

            keys.Reverse();

            ReturnKeys = keys;

            #endregion

            //Find function entry point, and then compile
            var inputNodes = WorkspaceModel.Nodes.OfType<Symbol>().ToList();
            var parameters = inputNodes.Select(x => x.GetAstIdentifierForOutputIndex(0).Value);
            Parameters = inputNodes.Select(x => x.InputSymbol);

            //Update existing function nodes which point to this function to match its changes
            var customNodeInstances = dynamoModel.AllNodes
//.........这里部分代码省略.........
开发者ID:whztt07,项目名称:Dynamo,代码行数:101,代码来源:CustomNodeDefinition.cs


示例15: ZeroTouchNodeController

 public ZeroTouchNodeController(
     EngineController engineController, FunctionDescriptor zeroTouchDef) :
         base(zeroTouchDef)
 {
     this.engineController = engineController;
 }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:6,代码来源:DSFunction.cs


示例16: RequestVisualUpdateAsyncCore

 protected override void RequestVisualUpdateAsyncCore(
     IScheduler scheduler, EngineController engine, IRenderPackageFactory factory)
 {
     // Do nothing
 }
开发者ID:qingemeng,项目名称:Dynamo,代码行数:5,代码来源:Watch.cs


示例17: ShutDown

            ShutDown(bool shutDownHost, EventArgs args = null)
        {
            EngineController.Dispose();
            EngineController = null;

            PreferenceSettings.Save();

            dynSettings.Controller.DynamoModel.OnCleanup(args);
            dynSettings.Controller = null;

            ((DynamoLogger)dynSettings.DynamoLogger).Dispose();
        }
开发者ID:heegwon,项目名称:Dynamo,代码行数:12,代码来源:DynamoController.cs


示例18: RequestVisualUpdateAsyncCore

            RequestVisualUpdateAsyncCore(IScheduler scheduler, EngineController engine, IRenderPackageFactory factory)
        {
            var initParams = new UpdateRenderPackageParams()
            {
                Node = this,
                RenderPackageFactory = factory,
                EngineController = engine,
                DrawableIds = GetDrawableIds(),
                PreviewIdentifierName = AstIdentifierForPreview.Name
            };

            var task = new UpdateRenderPackageAsyncTask(scheduler);
            if (task.Initialize(initParams))
            {
                task.Completed += OnRenderPackageUpdateCompleted;
                scheduler.ScheduleForExecution(task);
            }
        }
开发者ID:w-fish,项目名称:Dynamo,代码行数:18,代码来源:NodeModel.cs


示例19: HomeWorkspaceModel

 public HomeWorkspaceModel(EngineController engine, DynamoScheduler scheduler, 
     NodeFactory factory, bool verboseLogging, bool isTestMode, string fileName="")
     : this(
         engine,
         scheduler,
         factory,
         Enumerable.Empty<KeyValuePair<Guid, List<string>>>(),
         Enumerable.Empty<NodeModel>(),
         Enumerable.Empty<NoteModel>(),
         Enumerable.Empty<AnnotationModel>(),
         Enumerable.Empty<PresetModel>(),
         new ElementResolver(),
         new WorkspaceInfo(){FileName = fileName, Name = "Home"},
         verboseLogging, 
         isTestMode) { }
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:15,代码来源:HomeWorkspaceModel.cs


示例20: GetCachedValueFromEngine

        /// <summary>
        /// WARNING: This method is meant for unit test only. It directly accesses
        /// the EngineController for the mirror data without waiting for any 
        /// possible execution to complete (which, in single-threaded nature of 
        /// unit test, is an okay thing to do). The right way to get the cached 
        /// value for a NodeModel is by going through its RequestValueUpdateAsync
        /// method).
        /// </summary>
        /// <param name="engine">Instance of EngineController from which the node
        /// value is to be retrieved.</param>
        /// <returns>Returns the MirrorData if the node's value is computed, or 
        /// null otherwise.</returns>
        /// 
        internal MirrorData GetCachedValueFromEngine(EngineController engine)
        {
            if (cachedMirrorData != null)
                return cachedMirrorData;

            // Do not have an identifier for preview right now. For an example,
            // this can be happening at the beginning of a code block node creation.
            if (AstIdentifierForPreview.Value == null)
                return null;

            cachedMirrorData = null;

            var runtimeMirror = engine.GetMirror(AstIdentifierForPreview.Value);

            if (runtimeMirror != null)
                cachedMirrorData = runtimeMirror.GetData();

            return cachedMirrorData;
        }
开发者ID:w-fish,项目名称:Dynamo,代码行数:32,代码来源:NodeModel.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Engine.EngineController类代码示例发布时间:2022-05-24
下一篇:
C# Threading.DynamoScheduler类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap