using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using QC.QsprShared.Trace;

namespace QC.QTMApplication;

public class About : Form
{
	private Panel panelCenter;

	private ListBox lstPlugins;

	private Label lblPlugins;

	private Label lblLastModified;

	private Label lblVersion;

	private GroupBox groupBox1;

	private Label lblName;

	private Label lblPluginVersion;

	private Button btnOk;

	private Label lblCopyright;

	private Label lblCompany;

	private Label lblQTMCopyRight;

	private Label lblModified;

	private Label label4;

	private PictureBox pictureBox;

	private Label linkQTM;

	private LinkLabel linkContact;

	private Container components;

	public About()
	{
		InitializeComponent();
	}

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

	private void InitializeComponent()
	{
		System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(QC.QTMApplication.About));
		this.panelCenter = new System.Windows.Forms.Panel();
		this.linkContact = new System.Windows.Forms.LinkLabel();
		this.linkQTM = new System.Windows.Forms.Label();
		this.pictureBox = new System.Windows.Forms.PictureBox();
		this.label4 = new System.Windows.Forms.Label();
		this.lblQTMCopyRight = new System.Windows.Forms.Label();
		this.btnOk = new System.Windows.Forms.Button();
		this.groupBox1 = new System.Windows.Forms.GroupBox();
		this.lblName = new System.Windows.Forms.Label();
		this.lblModified = new System.Windows.Forms.Label();
		this.lblCopyright = new System.Windows.Forms.Label();
		this.lblCompany = new System.Windows.Forms.Label();
		this.lblPluginVersion = new System.Windows.Forms.Label();
		this.lblVersion = new System.Windows.Forms.Label();
		this.lblLastModified = new System.Windows.Forms.Label();
		this.lblPlugins = new System.Windows.Forms.Label();
		this.lstPlugins = new System.Windows.Forms.ListBox();
		this.panelCenter.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.pictureBox).BeginInit();
		this.groupBox1.SuspendLayout();
		base.SuspendLayout();
		this.panelCenter.Controls.Add(this.linkContact);
		this.panelCenter.Controls.Add(this.linkQTM);
		this.panelCenter.Controls.Add(this.pictureBox);
		this.panelCenter.Controls.Add(this.label4);
		this.panelCenter.Controls.Add(this.lblQTMCopyRight);
		this.panelCenter.Controls.Add(this.btnOk);
		this.panelCenter.Controls.Add(this.groupBox1);
		this.panelCenter.Controls.Add(this.lblVersion);
		this.panelCenter.Controls.Add(this.lblLastModified);
		this.panelCenter.Controls.Add(this.lblPlugins);
		this.panelCenter.Controls.Add(this.lstPlugins);
		this.panelCenter.Dock = System.Windows.Forms.DockStyle.Fill;
		this.panelCenter.Location = new System.Drawing.Point(0, 0);
		this.panelCenter.Name = "panelCenter";
		this.panelCenter.Size = new System.Drawing.Size(433, 332);
		this.panelCenter.TabIndex = 1;
		this.linkContact.AutoSize = true;
		this.linkContact.Location = new System.Drawing.Point(89, 310);
		this.linkContact.Name = "linkContact";
		this.linkContact.Size = new System.Drawing.Size(29, 13);
		this.linkContact.TabIndex = 13;
		this.linkContact.TabStop = true;
		this.linkContact.Text = "label";
		this.linkContact.Visible = false;
		this.linkContact.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(linkContact_LinkClicked);
		this.linkQTM.AutoSize = true;
		this.linkQTM.ForeColor = System.Drawing.SystemColors.Highlight;
		this.linkQTM.Location = new System.Drawing.Point(123, 8);
		this.linkQTM.Name = "linkQTM";
		this.linkQTM.Size = new System.Drawing.Size(198, 13);
		this.linkQTM.TabIndex = 12;
		this.linkQTM.TabStop = true;
		this.linkQTM.Text = "Qualcomm Sequence Profiling Resource";
		this.pictureBox.Image = (System.Drawing.Image)resources.GetObject("pictureBox.Image");
		this.pictureBox.Location = new System.Drawing.Point(12, 8);
		this.pictureBox.Name = "pictureBox";
		this.pictureBox.Size = new System.Drawing.Size(60, 60);
		this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
		this.pictureBox.TabIndex = 10;
		this.pictureBox.TabStop = false;
		this.label4.Location = new System.Drawing.Point(32, 311);
		this.label4.Name = "label4";
		this.label4.Size = new System.Drawing.Size(48, 16);
		this.label4.TabIndex = 9;
		this.label4.Text = "Contact:";
		this.label4.Visible = false;
		this.lblQTMCopyRight.Location = new System.Drawing.Point(83, 40);
		this.lblQTMCopyRight.Name = "lblQTMCopyRight";
		this.lblQTMCopyRight.Size = new System.Drawing.Size(317, 20);
		this.lblQTMCopyRight.TabIndex = 7;
		this.lblQTMCopyRight.Text = "Copyright © 2007-2016 Qualcomm Technologies, Inc.";
		this.lblQTMCopyRight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
		this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
		this.btnOk.Location = new System.Drawing.Point(336, 304);
		this.btnOk.Name = "btnOk";
		this.btnOk.Size = new System.Drawing.Size(75, 23);
		this.btnOk.TabIndex = 6;
		this.btnOk.Text = "Ok";
		this.btnOk.UseVisualStyleBackColor = true;
		this.btnOk.Click += new System.EventHandler(btnOk_Click);
		this.groupBox1.Controls.Add(this.lblName);
		this.groupBox1.Controls.Add(this.lblModified);
		this.groupBox1.Controls.Add(this.lblCopyright);
		this.groupBox1.Controls.Add(this.lblCompany);
		this.groupBox1.Controls.Add(this.lblPluginVersion);
		this.groupBox1.Location = new System.Drawing.Point(16, 184);
		this.groupBox1.Name = "groupBox1";
		this.groupBox1.Size = new System.Drawing.Size(400, 112);
		this.groupBox1.TabIndex = 5;
		this.groupBox1.TabStop = false;
		this.groupBox1.Text = "Product Details";
		this.lblName.Location = new System.Drawing.Point(16, 24);
		this.lblName.Name = "lblName";
		this.lblName.Size = new System.Drawing.Size(368, 16);
		this.lblName.TabIndex = 0;
		this.lblModified.Location = new System.Drawing.Point(16, 88);
		this.lblModified.Name = "lblModified";
		this.lblModified.Size = new System.Drawing.Size(368, 16);
		this.lblModified.TabIndex = 4;
		this.lblCopyright.Location = new System.Drawing.Point(16, 72);
		this.lblCopyright.Name = "lblCopyright";
		this.lblCopyright.Size = new System.Drawing.Size(368, 16);
		this.lblCopyright.TabIndex = 3;
		this.lblCompany.Location = new System.Drawing.Point(16, 56);
		this.lblCompany.Name = "lblCompany";
		this.lblCompany.Size = new System.Drawing.Size(368, 16);
		this.lblCompany.TabIndex = 2;
		this.lblPluginVersion.Location = new System.Drawing.Point(16, 40);
		this.lblPluginVersion.Name = "lblPluginVersion";
		this.lblPluginVersion.Size = new System.Drawing.Size(368, 16);
		this.lblPluginVersion.TabIndex = 1;
		this.lblVersion.Location = new System.Drawing.Point(80, 24);
		this.lblVersion.Name = "lblVersion";
		this.lblVersion.Size = new System.Drawing.Size(275, 16);
		this.lblVersion.TabIndex = 4;
		this.lblVersion.Text = "Version 1.0.0.0";
		this.lblVersion.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
		this.lblLastModified.Location = new System.Drawing.Point(103, 60);
		this.lblLastModified.Name = "lblLastModified";
		this.lblLastModified.Size = new System.Drawing.Size(240, 16);
		this.lblLastModified.TabIndex = 3;
		this.lblLastModified.Text = "Last Modified";
		this.lblLastModified.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
		this.lblPlugins.Location = new System.Drawing.Point(16, 80);
		this.lblPlugins.Name = "lblPlugins";
		this.lblPlugins.Size = new System.Drawing.Size(100, 16);
		this.lblPlugins.TabIndex = 1;
		this.lblPlugins.Text = "Available Plugins ";
		this.lstPlugins.Location = new System.Drawing.Point(16, 96);
		this.lstPlugins.Name = "lstPlugins";
		this.lstPlugins.Size = new System.Drawing.Size(400, 82);
		this.lstPlugins.TabIndex = 0;
		this.lstPlugins.SelectedIndexChanged += new System.EventHandler(lstPlugins_SelectedIndexChanged);
		this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
		this.BackColor = System.Drawing.Color.White;
		base.ClientSize = new System.Drawing.Size(433, 332);
		base.Controls.Add(this.panelCenter);
		base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
		base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
		base.MaximizeBox = false;
		base.MinimizeBox = false;
		base.Name = "About";
		base.ShowIcon = false;
		base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
		this.Text = "About Qualcomm Sequence Profiling Resource";
		base.Load += new System.EventHandler(About_Load);
		this.panelCenter.ResumeLayout(false);
		this.panelCenter.PerformLayout();
		((System.ComponentModel.ISupportInitialize)this.pictureBox).EndInit();
		this.groupBox1.ResumeLayout(false);
		base.ResumeLayout(false);
	}

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

	private void About_Load(object sender, EventArgs e)
	{
		lblVersion.Text = "Version " + base.ProductVersion;
		FileInfo fileInfo = new FileInfo(Assembly.GetExecutingAssembly().Location);
		lblLastModified.Text = "Last Modified " + fileInfo.LastWriteTime.ToString();
		LoadModules();
	}

	private void LoadModules()
	{
		try
		{
			string[] files = Directory.GetFiles(Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), QSPRMainWindow.FeatureConfigInfo.PluginsDirectory), "*.dll");
			string[] array = files;
			foreach (string fileName in array)
			{
				try
				{
					FileInfo fileInfo = new FileInfo(fileName);
					lstPlugins.Items.Add(fileInfo.Name);
				}
				catch (Exception ex)
				{
					TraceMessage.Write(ToString(), "LoadModules " + ex.Message, TraceMessageType.Exception);
				}
			}
			if (lstPlugins.Items.Count > 0)
			{
				lstPlugins.SelectedIndex = 0;
			}
		}
		catch (Exception ex2)
		{
			TraceMessage.Write(ToString(), "LoadModules failed, " + ex2.Message + ex2.InnerException, TraceMessageType.Exception);
		}
	}

	private void lstPlugins_SelectedIndexChanged(object sender, EventArgs e)
	{
		string fileName = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), Path.Combine(QSPRMainWindow.FeatureConfigInfo.PluginsDirectory, lstPlugins.SelectedItem.ToString().Trim()));
		FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(fileName);
		lblName.Text = versionInfo.ProductName;
		lblPluginVersion.Text = "Version " + versionInfo.ProductVersion;
		FileInfo fileInfo = new FileInfo(fileName);
		lblModified.Text = "Last Modified " + fileInfo.LastWriteTime.ToString();
		lblCompany.Text = versionInfo.CompanyName;
		lblCopyright.Text = versionInfo.LegalCopyright;
	}

	private void linkQTM_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
	{
		try
		{
			Process.Start("http://qtm/");
		}
		catch (Exception ex)
		{
			TraceMessage.Write(ToString(), "linkQTM_LinkClicked " + ex.Message, TraceMessageType.Exception);
		}
	}

	private void linkContact_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
	{
		try
		{
			Process.Start("mailto:cte-help@qualcomm.com");
		}
		catch (Exception ex)
		{
			TraceMessage.Write(ToString(), "linkContact_LinkClicked " + ex.Message, TraceMessageType.Exception);
		}
	}
}
