Subversion Repositories general

Rev

Rev 1237 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1194 dev 1
using System;
2
using System.ComponentModel;
3
using System.Data;
4
using System.Drawing;
5
using System.Text;
6
using System.Windows.Forms;
1237 dev 7
using System.Reflection;
1194 dev 8
 
9
namespace TCPproxy
10
{
1196 dev 11
	public class AboutForm : Form
1194 dev 12
	{
1196 dev 13
		private System.ComponentModel.IContainer components = null;
1237 dev 14
        private Label copyrightLabel;
1200 dev 15
		private Button okButton;
16
		private LinkLabel homePageLabel;
1237 dev 17
        private Label versionLabel;
18
        private Label appNameLabel;
1196 dev 19
 
20
		#region Windows Form Designer generated code
21
 
22
		/// <summary>
23
		/// Required method for Designer support - do not modify
24
		/// the contents of this method with the code editor.
25
		/// </summary>
26
		private void InitializeComponent()
27
		{
1237 dev 28
            this.copyrightLabel = new System.Windows.Forms.Label();
29
            this.okButton = new System.Windows.Forms.Button();
30
            this.homePageLabel = new System.Windows.Forms.LinkLabel();
31
            this.versionLabel = new System.Windows.Forms.Label();
32
            this.appNameLabel = new System.Windows.Forms.Label();
33
            this.SuspendLayout();
34
            // 
35
            // copyrightLabel
36
            // 
37
            this.copyrightLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
38
                        | System.Windows.Forms.AnchorStyles.Right)));
39
            this.copyrightLabel.Location = new System.Drawing.Point(32, 89);
40
            this.copyrightLabel.Name = "copyrightLabel";
41
            this.copyrightLabel.Size = new System.Drawing.Size(248, 49);
42
            this.copyrightLabel.TabIndex = 1;
43
            this.copyrightLabel.Text = "Copyright [copyright notice]";
44
            this.copyrightLabel.UseMnemonic = false;
45
            // 
46
            // okButton
47
            // 
48
            this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
49
            this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
50
            this.okButton.Location = new System.Drawing.Point(206, 172);
51
            this.okButton.Name = "okButton";
52
            this.okButton.Size = new System.Drawing.Size(75, 23);
53
            this.okButton.TabIndex = 3;
54
            this.okButton.Text = "OK";
55
            // 
56
            // homePageLabel
57
            // 
58
            this.homePageLabel.AutoSize = true;
59
            this.homePageLabel.Location = new System.Drawing.Point(32, 147);
60
            this.homePageLabel.Name = "homePageLabel";
61
            this.homePageLabel.Size = new System.Drawing.Size(229, 13);
62
            this.homePageLabel.TabIndex = 4;
63
            this.homePageLabel.TabStop = true;
64
            this.homePageLabel.Text = "http://www.26th.net/public/projects/tcpproxy/";
65
            this.homePageLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.homePageLabel_LinkClicked);
66
            // 
67
            // versionLabel
68
            // 
69
            this.versionLabel.AutoSize = true;
70
            this.versionLabel.Location = new System.Drawing.Point(32, 64);
71
            this.versionLabel.Name = "versionLabel";
72
            this.versionLabel.Size = new System.Drawing.Size(111, 13);
73
            this.versionLabel.TabIndex = 5;
74
            this.versionLabel.Text = "Version [build number]";
75
            this.versionLabel.UseMnemonic = false;
76
            // 
77
            // appNameLabel
78
            // 
79
            this.appNameLabel.AutoSize = true;
80
            this.appNameLabel.Font = new System.Drawing.Font("Arial", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
81
            this.appNameLabel.Location = new System.Drawing.Point(30, 9);
82
            this.appNameLabel.Name = "appNameLabel";
83
            this.appNameLabel.Size = new System.Drawing.Size(72, 29);
84
            this.appNameLabel.TabIndex = 8;
85
            this.appNameLabel.Text = "[title]";
86
            this.appNameLabel.UseMnemonic = false;
87
            // 
88
            // AboutForm
89
            // 
90
            this.AcceptButton = this.okButton;
91
            this.CancelButton = this.okButton;
92
            this.ClientSize = new System.Drawing.Size(293, 207);
93
            this.Controls.Add(this.appNameLabel);
94
            this.Controls.Add(this.versionLabel);
95
            this.Controls.Add(this.homePageLabel);
96
            this.Controls.Add(this.okButton);
97
            this.Controls.Add(this.copyrightLabel);
98
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
99
            this.MaximizeBox = false;
100
            this.MinimizeBox = false;
101
            this.Name = "AboutForm";
102
            this.ShowInTaskbar = false;
103
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
104
            this.Text = "About [title]";
105
            this.Load += new System.EventHandler(this.AboutForm_Load);
106
            this.ResumeLayout(false);
107
            this.PerformLayout();
108
 
1196 dev 109
		}
110
 
111
		#endregion
112
 
1194 dev 113
		public AboutForm()
114
		{
115
			InitializeComponent();
116
		}
117
 
1196 dev 118
		protected override void Dispose(bool disposing)
119
		{
120
			if(disposing && (components != null)) {
121
				components.Dispose();
122
			}
123
			base.Dispose(disposing);
124
		}
125
 
1194 dev 126
		private void homePageLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
127
		{
128
			homePageLabel.LinkVisited = true;
129
			System.Diagnostics.Process.Start(homePageLabel.Text);
130
		}
1237 dev 131
 
132
        private void AboutForm_Load(object sender, EventArgs e)
133
        {
1238 dev 134
            Assembly     running = Assembly.GetExecutingAssembly();
135
            AssemblyName name    = running.GetName();
1237 dev 136
 
137
            // get version
138
            versionLabel.Text = string.Format("Version {0}.{1}.{2}",
139
                name.Version.Major, name.Version.Minor, name.Version.Build);
140
 
141
            // get other info
142
            string copyright = "";
143
            string title = "";
144
            foreach (object a in running.GetCustomAttributes(false))
145
            {
146
                if (a is AssemblyCopyrightAttribute)
147
                {
148
                    copyright = (a as AssemblyCopyrightAttribute).Copyright;
149
                }
150
                else if (a is AssemblyTitleAttribute)
151
                {
152
                    title = (a as AssemblyTitleAttribute).Title;
153
                }
154
            }
155
 
156
            // show
1238 dev 157
            this.Text           = string.Format("About {0}", title);
158
			appNameLabel.Text   = title;
1237 dev 159
            copyrightLabel.Text = copyright;
160
        }
1194 dev 161
	}
162
}