forked from ArduPilot/MissionPlanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScriptConsole.cs
59 lines (51 loc) · 1.66 KB
/
ScriptConsole.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MissionPlanner
{
public partial class ScriptConsole : Form
{
private static int consoleNumber = 0;
private Script readingScript;
Utilities.StringRedirectWriter writer;
public ScriptConsole()
{
InitializeComponent();
}
private void ScriptConsole_Load(object sender, EventArgs e)
{
//Make the title unique
//in the future it might be nice to show if the script is running
//or stopped in the title too.
Text = Text + " - Run " + consoleNumber++;
}
/// <summary>
/// Set the script this console should display the output
/// to. The script must have been set to "redirect"
/// </summary>
/// <param name="script">the python script instance</param>
public void SetScript(Script script)
{
readingScript = script;
writer = readingScript.OutputWriter;
//Only enable if writer is not null
updateoutput.Enabled = (writer != null);//*/
}
private void BUT_clear_Click(object sender, EventArgs e)
{
textOutput.Text = "";
}
private void updateoutput_Tick(object sender, EventArgs e)
{
if (autoscrollCheckbox.Checked)
textOutput.AppendText(writer.RetrieveWrittenString());
else
textOutput.Text += writer.RetrieveWrittenString();
}
}
}