private void RunWindow(Thread appThread, Action <object, EventArgs> onFormLoad) { form = new TextForm(); form.Load += (sender, e) => { appThread.Start(); onFormLoad(sender, e); }; form.Height = 600; form.Width = 800; // makes form visible Application.Run(form); }
// for Mono executable public static void Main() { Program program = new TextWindow.Program(); TextForm form = program.GetForm(); Thread appThread = new Thread((ThreadStart) delegate { /* * while (true) { // for testing * WriteLine ("Echo: " + ReadLine()); * } */ java.lang.System.setOut(new java.io.PrintStream (new Program.ConsoleOut(form.Writer), true)); java.lang.System.setErr(java.lang.System.@out); edu.wpi.disco.Disco.main(new String[0]); ((edu.wpi.disco.Disco)edu.wpi.cetask.TaskEngine.ENGINE).getInteraction().getConsole() .setReader(new Program.ConsoleReader(form)); }); appThread.IsBackground = true; program.RunWindow(appThread, (sender, e) => { }); }
public ConsoleReader(TextForm form) { this.form = form; }