#region License
// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
// This source code is made available under the terms of the GNU Lesser General Public License v3.0
// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using MiniSqlQuery.Core;
using MiniSqlQuery.Properties;
namespace MiniSqlQuery
{
/// The about form.
internal partial class AboutForm : Form
{
/// The _services.
private readonly IApplicationServices _services;
/// Initializes a new instance of the class.
/// The services.
public AboutForm(IApplicationServices services) : this()
{
_services = services;
}
/// Initializes a new instance of the class.
public AboutForm()
{
InitializeComponent();
pic.Image = ImageResource.ApplicationIcon;
Text = String.Format("关于 {0}", AssemblyTitle);
labelProductName.Text = AssemblyTitle;
labelVersion.Text = String.Format("版本 {0}", AssemblyVersion);
labelCopyright.Text = AssemblyCopyright;
textBoxDescription.Text = AssemblyDescription;
}
/// Gets AssemblyCompany.
public string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
if (attributes.Length == 0)
{
return string.Empty;
}
return ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}
/// Gets AssemblyCopyright.
public string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length == 0)
{
return string.Empty;
}
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}
/// Gets AssemblyDescription.
public string AssemblyDescription
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute),
false);
if (attributes.Length == 0)
{
return string.Empty;
}
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
}
}
/// Gets AssemblyProduct.
public string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if (attributes.Length == 0)
{
return string.Empty;
}
return ((AssemblyProductAttribute)attributes[0]).Product;
}
}
/// Gets AssemblyTitle.
public string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != string.Empty)
{
return titleAttribute.Title;
}
}
return Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
}
}
/// Gets AssemblyVersion.
public string AssemblyVersion
{
get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); }
}
/// The about form_ load.
/// The sender.
/// The e.
private void AboutForm_Load(object sender, EventArgs e)
{
List plugins = new List(_services.Plugins.Values);
pluginList.SetDataSource(plugins.ToArray());
webBrowser1.DocumentText = Resources.ReadMe;
txtChangeLog.Text = Resources.ChangeLog;
txtLicense.Text = Resources.LicenseMiniSqlQuery;
}
/// The label version_ click.
/// The sender.
/// The e.
private void labelVersion_Click(object sender, EventArgs e)
{
}
/// The ok button_ click.
/// The sender.
/// The e.
private void okButton_Click(object sender, EventArgs e)
{
Close();
}
}
}