//////////////////////////////////////////////////////////////////// // Description: we subclass TextWriter so we can make Console.Write be forwarded // to both a WPF control and still write to the std console // Passed: the Dispatcher object from your wpf Window, & your wpf textbox control // Return: new TextBoxStreamWriter object ///////////////////////////////////////////////////////////////////// public TextBoxStreamWriter(Dispatcher dispatcher, TextBox output, bool stebinpipe1 = false) { txtBoxOutput = output; StandardOut = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = true }; this.Dispatcher = dispatcher; if (stebinpipe1) { StebinPipe1.SetOut(this); } else { Console.SetOut(this); } }
private void StebinLog(object o) { StebinPipe1.WriteLine(o.ToString()); }