Mercurial > repos > RelicTools > SGAExplorer
diff DebugWindow.cs @ 0:b586cccc3d59 default tip
First commit under GPLv3!
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 06 Oct 2018 20:15:02 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DebugWindow.cs Sat Oct 06 20:15:02 2018 +0100 @@ -0,0 +1,115 @@ +// This file is a part of the SGA Explorer app and is copyright 2006-2018 IBBoard. +// +// The file and the library/program it is in are licensed under the GNU GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; + +namespace IBBoard.Relic.SGAExplorer +{ + /// <summary> + /// Summary description for DebugWindow. + /// </summary> + public class DebugWindow : System.Windows.Forms.Form + { + private System.Windows.Forms.TextBox txtDebugOutput; + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.Container components = null; + + public DebugWindow() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + ClearText(); + txtDebugOutput.Text = "SGA Explorer Debug information. Application started at "+DateTime.Now.ToString()+Environment.NewLine+txtDebugOutput.Text; + this.GotFocus+=new EventHandler(DebugWindow_GotFocus); + } + + /// <summary> + /// Clean up any resources being used. + /// </summary> + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(DebugWindow)); + this.txtDebugOutput = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // txtDebugOutput + // + this.txtDebugOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtDebugOutput.Location = new System.Drawing.Point(0, 0); + this.txtDebugOutput.Multiline = true; + this.txtDebugOutput.Name = "txtDebugOutput"; + this.txtDebugOutput.ReadOnly = true; + this.txtDebugOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtDebugOutput.Size = new System.Drawing.Size(420, 272); + this.txtDebugOutput.TabIndex = 0; + this.txtDebugOutput.TabStop = false; + this.txtDebugOutput.Text = ""; + // + // DebugWindow + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(416, 270); + this.Controls.Add(this.txtDebugOutput); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "DebugWindow"; + this.ShowInTaskbar = false; + this.Text = "Debug"; + this.Closing += new System.ComponentModel.CancelEventHandler(this.DebugWindow_Closing); + this.ResumeLayout(false); + + } + #endregion + + public void AddText(string text) + { + txtDebugOutput.Text+= text; + txtDebugOutput.Select(txtDebugOutput.Text.Length, 0); + txtDebugOutput.ScrollToCaret(); + } + + public void ClearText() + { + txtDebugOutput.Text = "Last cleared: "+DateTime.Now.ToString()+Environment.NewLine+Environment.NewLine; + } + + private void DebugWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + this.Hide(); + e.Cancel = true; + } + + private void DebugWindow_GotFocus(object sender, EventArgs e) + { + txtDebugOutput.Select(0,0); + } + } +}