comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:b586cccc3d59
1 // This file is a part of the SGA Explorer app and is copyright 2006-2018 IBBoard.
2 //
3 // 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.
4 using System;
5 using System.Drawing;
6 using System.Collections;
7 using System.ComponentModel;
8 using System.Windows.Forms;
9
10 namespace IBBoard.Relic.SGAExplorer
11 {
12 /// <summary>
13 /// Summary description for DebugWindow.
14 /// </summary>
15 public class DebugWindow : System.Windows.Forms.Form
16 {
17 private System.Windows.Forms.TextBox txtDebugOutput;
18 /// <summary>
19 /// Required designer variable.
20 /// </summary>
21 private System.ComponentModel.Container components = null;
22
23 public DebugWindow()
24 {
25 //
26 // Required for Windows Form Designer support
27 //
28 InitializeComponent();
29
30 ClearText();
31 txtDebugOutput.Text = "SGA Explorer Debug information. Application started at "+DateTime.Now.ToString()+Environment.NewLine+txtDebugOutput.Text;
32 this.GotFocus+=new EventHandler(DebugWindow_GotFocus);
33 }
34
35 /// <summary>
36 /// Clean up any resources being used.
37 /// </summary>
38 protected override void Dispose( bool disposing )
39 {
40 if( disposing )
41 {
42 if(components != null)
43 {
44 components.Dispose();
45 }
46 }
47 base.Dispose( disposing );
48 }
49
50 #region Windows Form Designer generated code
51 /// <summary>
52 /// Required method for Designer support - do not modify
53 /// the contents of this method with the code editor.
54 /// </summary>
55 private void InitializeComponent()
56 {
57 System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(DebugWindow));
58 this.txtDebugOutput = new System.Windows.Forms.TextBox();
59 this.SuspendLayout();
60 //
61 // txtDebugOutput
62 //
63 this.txtDebugOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
64 | System.Windows.Forms.AnchorStyles.Left)
65 | System.Windows.Forms.AnchorStyles.Right)));
66 this.txtDebugOutput.Location = new System.Drawing.Point(0, 0);
67 this.txtDebugOutput.Multiline = true;
68 this.txtDebugOutput.Name = "txtDebugOutput";
69 this.txtDebugOutput.ReadOnly = true;
70 this.txtDebugOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
71 this.txtDebugOutput.Size = new System.Drawing.Size(420, 272);
72 this.txtDebugOutput.TabIndex = 0;
73 this.txtDebugOutput.TabStop = false;
74 this.txtDebugOutput.Text = "";
75 //
76 // DebugWindow
77 //
78 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
79 this.ClientSize = new System.Drawing.Size(416, 270);
80 this.Controls.Add(this.txtDebugOutput);
81 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
82 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
83 this.Name = "DebugWindow";
84 this.ShowInTaskbar = false;
85 this.Text = "Debug";
86 this.Closing += new System.ComponentModel.CancelEventHandler(this.DebugWindow_Closing);
87 this.ResumeLayout(false);
88
89 }
90 #endregion
91
92 public void AddText(string text)
93 {
94 txtDebugOutput.Text+= text;
95 txtDebugOutput.Select(txtDebugOutput.Text.Length, 0);
96 txtDebugOutput.ScrollToCaret();
97 }
98
99 public void ClearText()
100 {
101 txtDebugOutput.Text = "Last cleared: "+DateTime.Now.ToString()+Environment.NewLine+Environment.NewLine;
102 }
103
104 private void DebugWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
105 {
106 this.Hide();
107 e.Cancel = true;
108 }
109
110 private void DebugWindow_GotFocus(object sender, EventArgs e)
111 {
112 txtDebugOutput.Select(0,0);
113 }
114 }
115 }