/// <summary>Actually executes this Response, writing to Console.Out, Console.Error, and exiting the process using the ExitCode</summary> /// <remarks> /// You can call response.Execute(false) and we'll return the ExitCode instead of actually exiting the current process. /// </remarks> public virtual int Execute(bool exit) { if (STDOUT.Length > 0) { Console.Out.Write(STDOUT.ToString()); } if (STDERR.Length > 0) { Console.Error.Write(STDERR.ToString()); } if (exit) { Environment.Exit(ExitCode); } return(ExitCode); }
public Form1() { this.tvpc = new TVPC(512, 512, 32, 32, ScrollConstraint.CenterTile); this.tvpc.padding_px = 0; this.tvpc.Location = new Point(10, 10); //this.tvpc.Anchor = AnchorStyles.Left | AnchorStyles.Right; // Not working right...may indicate a bug in TVPC somewhere... this.tvpc.TabIndex = 0; this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.richTextBox1.Location = new Point(10 + 512 + 10, 10); this.richTextBox1.Size = new System.Drawing.Size(400, 512); this.richTextBox1.BackColor = SystemColors.ControlDark; this.Controls.Add(richTextBox1); stdout = new STDOUT(richTextBox1); // set up printf() for the richTextBox... this.label1 = new Label(); this.label1.BackColor = SystemColors.ControlDark; this.label1.Location = new System.Drawing.Point(12, 512 + 10 + 10); this.label1.Size = new System.Drawing.Size(600, 2 * 13); this.label1.TabIndex = 1; // label1.Text Is set later in Accumulate() this.Controls.Add(this.label1); this.Controls.Add(this.tvpc); this.ClientSize = new System.Drawing.Size(1024, 768); this.Text = "Main Window Title"; this.Shown += this.OnShown; // Will execute once, AFTER Load and Activate events // Note: The order of (Load, Activated, Shown) can be altered, if a MessageBox() is invoked, therefore: do not use MessageBox() this.Paint += this.OnPaint; // Using this to test TileSprite.GDI_Draw_Tile() Application.Idle += Application_Idle; sw.Start(); // start the Stopwatch, which is used to alter the label1.Text via Accumulate() and Animate() // Set up key handling by the Form: // (Some mode-specific key handling may still be done by individual controls) // In addition to the setup here, contained controls (such as this.tvpc) // may need to handle the PreviewKeyDown event, as seen in TVPC.cs OnPreviewKeyDown() this.KeyPreview = true; this.KeyDown += new KeyEventHandler(OnKeyDown); // When additional controls are added into this Form, revisit this if needed... }
public virtual Response PrependToOutput(string str, params object[] objects) { STDOUT.Insert(0, string.Format(str, objects)); return(this); }
public virtual Response AppendToOutput(string str, params object[] objects) { STDOUT.Append(string.Format(str, objects)); return(this); }