Ejemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            TextWriter _writer = new TextBoxStreamWriter(outputTB);

            // Redirect the out Console stream
            Console.SetOut(_writer);
            Console.WriteLine("Welcome to CubeBot CP! Console output will be redirected here unless disabled.");
        }
Ejemplo n.º 2
0
 private void guna2Button1_Click_1(object sender, EventArgs e)
 {
     if (guna2Button1.Checked == false)
     {
         guna2Button1.Text = "Disable Output (Speeds Things Up)";
         // Instantiate the writer
         TextWriter _writer = new TextBoxStreamWriter(outputTB);
         // Redirect the out Console stream
         Console.SetOut(_writer);
         Console.WriteLine("Console output is now set to textbox.");
     }
     else
     {
         guna2Button1.Text = "Enable Output (Useful for debugging)";
         StreamWriter standardOutput = new StreamWriter(Console.OpenStandardOutput());
         standardOutput.AutoFlush = true;
         Console.SetOut(standardOutput);
     }
 }