Example #1
0
            public override void Execute()
            {
                NodesToCodeCompletedEventArgs args = null;

                // Gather a list of node IDs to be sent back.
                List<uint> inputNodeIds = new List<uint>();
                foreach (SnapshotNode node in snapshotNodes)
                    inputNodeIds.Add(node.Id);

                lock (runner.operationsMutex)
                {
                    try
                    {
                        // Do the thing you do...
                        List<SnapshotNode> outputNodes = GraphToDSCompiler.GraphUtilities.NodeToCodeBlocks(snapshotNodes, runner.graphCompiler);
                        args = new NodesToCodeCompletedEventArgs(inputNodeIds,
                            outputNodes, EventStatus.OK, "Yay, it works!");
                    }
                    catch (Exception exception)
                    {
                        args = new NodesToCodeCompletedEventArgs(inputNodeIds,
                            null, EventStatus.Error, exception.Message);
                    }
                }

                // Notify the listener (e.g. UI) of the completion.
                if (null != runner.NodesToCodeCompleted)
                    runner.NodesToCodeCompleted(this, args);
            }
Example #2
0
            public override void Execute()
            {
                NodesToCodeCompletedEventArgs args = null;
                List<ProtoCore.AST.AssociativeAST.AssociativeNode> astList = new List<ProtoCore.AST.AssociativeAST.AssociativeNode>();

                if (subtrees != null)
                {
                    foreach (var tree in subtrees)
                    {
                        Validity.Assert(tree.AstNodes != null && tree.AstNodes.Count > 0);
                        astList.AddRange(tree.AstNodes);
                    }
                }

                lock (runner.operationsMutex)
                {
                    try
                    {
                        string code = new ProtoCore.CodeGenDS(astList).GenerateCode();
                        args = new NodesToCodeCompletedEventArgs(code, EventStatus.OK, "Node to code task complete.");
                    }
                    catch (Exception exception)
                    {
                        args = new NodesToCodeCompletedEventArgs(string.Empty, EventStatus.Error, exception.Message);
                    }
                }

                // Notify the listener
                if (null != runner.NodesToCodeCompleted)
                {
                    runner.NodesToCodeCompleted(this, args);
                }
            }
            public override void Execute()
            {
                NodesToCodeCompletedEventArgs args = null;

                // Gather a list of node IDs to be sent back.
                List <uint> inputNodeIds = new List <uint>();

                foreach (SnapshotNode node in snapshotNodes)
                {
                    inputNodeIds.Add(node.Id);
                }

                lock (runner.operationsMutex)
                {
                    try
                    {
                        // Do the thing you do...
                        List <SnapshotNode> outputNodes = GraphToDSCompiler.GraphUtilities.NodeToCodeBlocks(snapshotNodes, runner.graphCompiler);
                        args = new NodesToCodeCompletedEventArgs(inputNodeIds,
                                                                 outputNodes, EventStatus.OK, "Yay, it works!");
                    }
                    catch (Exception exception)
                    {
                        args = new NodesToCodeCompletedEventArgs(inputNodeIds,
                                                                 null, EventStatus.Error, exception.Message);
                    }
                }

                // Notify the listener (e.g. UI) of the completion.
                if (null != runner.NodesToCodeCompleted)
                {
                    runner.NodesToCodeCompleted(this, args);
                }
            }
Example #4
0
            public override void Execute()
            {
                NodesToCodeCompletedEventArgs args = null;
                List <ProtoCore.AST.AssociativeAST.AssociativeNode> astList = new List <ProtoCore.AST.AssociativeAST.AssociativeNode>();

                if (subtrees != null)
                {
                    foreach (var tree in subtrees)
                    {
                        Validity.Assert(tree.AstNodes != null && tree.AstNodes.Count > 0);
                        astList.AddRange(tree.AstNodes);
                    }
                }

                lock (runner.operationsMutex)
                {
                    try
                    {
                        string code = new ProtoCore.CodeGenDS(astList).GenerateCode();
                        args = new NodesToCodeCompletedEventArgs(code, EventStatus.OK, "Node to code task complete.");
                    }
                    catch (Exception exception)
                    {
                        args = new NodesToCodeCompletedEventArgs(string.Empty, EventStatus.Error, exception.Message);
                    }
                }

                // Notify the listener
                if (null != runner.NodesToCodeCompleted)
                {
                    runner.NodesToCodeCompleted(this, args);
                }
            }