windows: clean up about more

This commit is contained in:
Hylke Bons 2012-03-03 02:24:44 +00:00
parent 9a32211ecc
commit 6de6f965c4

View file

@ -16,12 +16,12 @@
using System; using System;
using System.ComponentModel
using System.Diagnostics; using System.Diagnostics;
using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace SparkleShare { namespace SparkleShare {
@ -30,11 +30,10 @@ namespace SparkleShare {
public SparkleAboutController Controller = new SparkleAboutController (); public SparkleAboutController Controller = new SparkleAboutController ();
private System.ComponentModel.IContainer components = null; private IContainer components;
private Label version; private Label version;
private Label copyright; private Label copyright;
private Label empty_label; private Label updates;
private Label SparkleShareVersion;
// Short alias for the translations // Short alias for the translations
@ -58,6 +57,8 @@ namespace SparkleShare {
AutoScaleDimensions = new SizeF (6F, 13F); AutoScaleDimensions = new SizeF (6F, 13F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size (640, 260); ClientSize = new Size (640, 260);
MaximumSize = Size;
MinimumSize = Size;
BackgroundImage = Icons.about; BackgroundImage = Icons.about;
FormBorderStyle = FormBorderStyle.FixedDialog; FormBorderStyle = FormBorderStyle.FixedDialog;
@ -67,7 +68,7 @@ namespace SparkleShare {
FormClosing += FormClosingEventHandler (Close); FormClosing += FormClosingEventHandler (Close);
Program.TranslateWinForm (this); CreateAbout ();
Controller.ShowWindowEvent += delegate { Controller.ShowWindowEvent += delegate {
@ -84,81 +85,66 @@ namespace SparkleShare {
Controller.NewVersionEvent += delegate (string new_version) { Controller.NewVersionEvent += delegate (string new_version) {
Invoke ((Action) delegate { Invoke ((Action) delegate {
this.version.Text = new_version; this.updates.Text = "A newer version (" + new_version + ") is available!";
}); });
}; };
Controller.VersionUpToDateEvent += delegate { Controller.VersionUpToDateEvent += delegate {
Invoke ((Action) delegate { Invoke ((Action) delegate {
this.version.Text = "You are running the latest version."; this.updates.Text = "You are running the latest version.";
}); });
}; };
Controller.CheckingForNewVersionEvent += delegate { Controller.CheckingForNewVersionEvent += delegate {
Invoke ((Action) delegate { Invoke ((Action) delegate {
this.version.Text = "Checking for updates..."; this.updates.Text = "Checking for updates...";
}); });
}; };
CreateAbout ();
} }
private void CreateAbout private void CreateAbout ()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager (typeof (SparkleAbout)); ComponentResourceManager resources =
this.version = new System.Windows.Forms.Label (); new ComponentResourceManager (typeof (SparkleAbout));
this.copyright = new System.Windows.Forms.Label ();
this.emptyLabel = new System.Windows.Forms.Label ();
this.SparkleShareVersion = new System.Windows.Forms.Label ();
this.SuspendLayout ();
this.version.AutoSize = true; SuspendLayout ();
this.version.BackColor = System.Drawing.Color.Transparent;
this.version.ForeColor = System.Drawing.Color.LightGray;
this.version.Location = new System.Drawing.Point (302, 102);
this.version.Name = "version";
this.version.Size = new System.Drawing.Size (34, 13);
this.version.TabIndex = 1;
this.version.Text = ".........";
this.copyright.BackColor = System.Drawing.Color.Transparent; this.version = new Label () {
this.copyright.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); AutoSize = true,
this.copyright.ForeColor = System.Drawing.Color.White; BackColor = Color.Transparent,
this.copyright.Location = new System.Drawing.Point (302, 135); ForeColor = Color.LightGray,
this.copyright.Name = "copyright"; Location = new Point (302, 102),
this.copyright.Size = new System.Drawing.Size (298, 84); Size = new Size (34, 13),
this.copyright.TabIndex = 2; Text = "version " + Controller.RunningVersion
this.copyright.Text = resources.GetString ("copyright.Text"); };
this.emptyLabel.AutoSize = true; this.updates = new Label () {
this.emptyLabel.Location = new System.Drawing.Point (16, 89); AutoSize = true,
this.emptyLabel.Name = "emptyLabel"; BackColor = Color.Transparent,
this.emptyLabel.Size = new System.Drawing.Size (0, 13); ForeColor = Color.White,
this.emptyLabel.TabIndex = 6; Location = new Point (302, 89),
Size = new Size (106, 13),
Text = "Checking for updates..."
};
this.SparkleShareVersion.AutoSize = true; this.copyright = new Label () {
this.SparkleShareVersion.BackColor = System.Drawing.Color.Transparent; BackColor = Color.Transparent,
this.SparkleShareVersion.ForeColor = System.Drawing.Color.White; Font = new Font ("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte) (0))),
this.SparkleShareVersion.Location = new System.Drawing.Point (302, 89); ForeColor = Color.White,
this.SparkleShareVersion.Name = "SparkleShareVersion"; Location = new Point (302, 135),
this.SparkleShareVersion.Size = new System.Drawing.Size (106, 13); Size = new Size (298, 84),
this.SparkleShareVersion.TabIndex = 1; Text = "Copyright © 2010" + DateTime.Now.Year + " Hylke Bons and others.\n" +
this.SparkleShareVersion.Text = "SparkleShareVersion"; "SparkleShare is Free and Open Source Software. You are free to use, modify, " +
"and redistribute it under the GNU General Public License version 3 or later."
};
Controls.Add (this.version);
Controls.Add (this.updates);
Controls.Add (this.copyright);
this.Controls.Add (this.SparkleShareVersion); ResumeLayout (false);
this.Controls.Add (this.emptyLabel); PerformLayout ();
this.Controls.Add (this.copyright);
this.Controls.Add (this.version);
this.ResumeLayout (false);
this.PerformLayout ();
this.SparkleShareVersion.Text = Controller.RunningVersion;
this.MaximumSize = this.Size;
this.MinimumSize = this.Size;
this.version.Text = "";
} }
@ -176,8 +162,8 @@ namespace SparkleShare {
args.CloseReason != CloseReason.TaskManagerClosing && args.CloseReason != CloseReason.TaskManagerClosing &&
args.CloseReason != CloseReason.WindowsShutDown) { args.CloseReason != CloseReason.WindowsShutDown) {
args.Cancel = true;
Controller.WindowClosed (); Controller.WindowClosed ();
args.Cancel = true;
} }
} }
} }