Example #1
0
        /// <summary>
        /// Main execution method
        /// </summary>
        /// <param name="programGraph"> Visual program to execute </param>
        /// <param name="writeToConsole"> Method to writing to console </param>
        public void Execute(Graph programGraph, Action <string> writeToConsole)
        {
            writeToMessageBox = writeToConsole;
            graph             = programGraph;

            NodeViewModel curNode = GetInitNode();

            if (curNode == null)
            {
                return;
            }

            writeToMessageBox("Running your code");
            var client = new MultirotorClient();

            while (curNode.Name != "aFinalNode")
            {
                Execution.ExecuteNode(curNode, client);
                curNode = Execution.GetNextNode(curNode, client);
                if (curNode == null)
                {
                    return;
                }
                writeToMessageBox($"Node {curNode.Name} done");
            }
            client.Land();
            client.Dispose();
            writeToMessageBox("Program done");
        }
Example #2
0
 public override void ExecuteNode(NodeViewModel node, MultirotorClient client)
 => client.Land();