using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using MultiLanguageManger;

namespace QC.QMSCT;

public class AboutForm : Form
{
	private IContainer components;

	private Button button_OK;

	private Label label_QmsctVersion;

	private Label label_QmsctDate;

	private Label label_VersionLabel;

	private Label label_DateLabel;

	private GroupBox groupBox_VersionInfo;

	public AboutForm()
	{
		InitializeComponent();
	}

	private void AboutForm_Load(object sender, EventArgs e)
	{
		try
		{
			string text = Application.StartupPath + "\\QMSCT.exe";
			if (text != null)
			{
				FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(text);
				label_QmsctVersion.Text = versionInfo.FileDescription + "- Version " + versionInfo.FileVersion;
				DateTime lastWriteTime = File.GetLastWriteTime(text);
				label_QmsctDate.Text = "Built on " + lastWriteTime.ToShortDateString() + " " + lastWriteTime.ToShortTimeString();
			}
			else
			{
				MessageBox.Show(CommonResource.BoxMsgFailToFindExec + text);
			}
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
	}

	private void button_OK_Click(object sender, EventArgs e)
	{
		Close();
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.button_OK = new System.Windows.Forms.Button();
		this.label_QmsctVersion = new System.Windows.Forms.Label();
		this.label_QmsctDate = new System.Windows.Forms.Label();
		this.label_VersionLabel = new System.Windows.Forms.Label();
		this.label_DateLabel = new System.Windows.Forms.Label();
		this.groupBox_VersionInfo = new System.Windows.Forms.GroupBox();
		this.groupBox_VersionInfo.SuspendLayout();
		base.SuspendLayout();
		this.button_OK.Location = new System.Drawing.Point(139, 76);
		this.button_OK.Name = "button_OK";
		this.button_OK.Size = new System.Drawing.Size(145, 23);
		this.button_OK.TabIndex = 0;
		this.button_OK.Text = "OK";
		this.button_OK.UseVisualStyleBackColor = true;
		this.button_OK.Click += new System.EventHandler(button_OK_Click);
		this.label_QmsctVersion.AutoSize = true;
		this.label_QmsctVersion.Location = new System.Drawing.Point(75, 16);
		this.label_QmsctVersion.Name = "label_QmsctVersion";
		this.label_QmsctVersion.Size = new System.Drawing.Size(35, 13);
		this.label_QmsctVersion.TabIndex = 1;
		this.label_QmsctVersion.Text = "label1";
		this.label_QmsctDate.AutoSize = true;
		this.label_QmsctDate.Location = new System.Drawing.Point(75, 43);
		this.label_QmsctDate.Name = "label_QmsctDate";
		this.label_QmsctDate.Size = new System.Drawing.Size(35, 13);
		this.label_QmsctDate.TabIndex = 2;
		this.label_QmsctDate.Text = "label1";
		this.label_VersionLabel.AutoSize = true;
		this.label_VersionLabel.Location = new System.Drawing.Point(9, 16);
		this.label_VersionLabel.Name = "label_VersionLabel";
		this.label_VersionLabel.Size = new System.Drawing.Size(45, 13);
		this.label_VersionLabel.TabIndex = 3;
		this.label_VersionLabel.Text = "Version:";
		this.label_DateLabel.AutoSize = true;
		this.label_DateLabel.Location = new System.Drawing.Point(9, 43);
		this.label_DateLabel.Name = "label_DateLabel";
		this.label_DateLabel.Size = new System.Drawing.Size(33, 13);
		this.label_DateLabel.TabIndex = 4;
		this.label_DateLabel.Text = "Date:";
		this.groupBox_VersionInfo.Controls.Add(this.label_VersionLabel);
		this.groupBox_VersionInfo.Controls.Add(this.label_DateLabel);
		this.groupBox_VersionInfo.Controls.Add(this.label_QmsctVersion);
		this.groupBox_VersionInfo.Controls.Add(this.label_QmsctDate);
		this.groupBox_VersionInfo.Location = new System.Drawing.Point(3, -2);
		this.groupBox_VersionInfo.Name = "groupBox_VersionInfo";
		this.groupBox_VersionInfo.Size = new System.Drawing.Size(426, 72);
		this.groupBox_VersionInfo.TabIndex = 5;
		this.groupBox_VersionInfo.TabStop = false;
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(434, 105);
		base.Controls.Add(this.groupBox_VersionInfo);
		base.Controls.Add(this.button_OK);
		base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
		base.Name = "AboutForm";
		this.Text = "About QMSCT";
		base.Load += new System.EventHandler(AboutForm_Load);
		this.groupBox_VersionInfo.ResumeLayout(false);
		this.groupBox_VersionInfo.PerformLayout();
		base.ResumeLayout(false);
	}
}
