//----------------------------------------------------------------------- // // Copyright © 2012 Nils Hammar. All rights reserved. // //----------------------------------------------------------------------- /* * Software to access vehicle information via the OBD-II connector. * * Copyright © 2012 Nils Hammar * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Alternative licensing is possible, see the licensing document. * * The above text may not be removed or modified. */ namespace UserInterface.GUI { using System; using System.Reflection; using System.Windows.Forms; /// /// About box implementation. /// public partial class AboutBox1 : Form { /// /// Copyright notice. /// private const string COPYRIGHT_NOTICE_RTF = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1053{\\fonttbl{\\f0\\fswiss\\fprq2\\fcharset0 Arial;}{\\f1\\fnil\\fcharset0 Calibri;}}\r\n" + "{\\colortbl ;\\red0\\green0\\blue255;}\r\n" + "{\\*\\generator Msftedit 5.41.21.2510;}\\viewkind4\\uc1\\pard\\lang2057\\b\\f0\\fs18 Software to access vehicle information via the OBD-II connector.\\par\r\n" + "\\b0\\par\r\n" + "Copyright \\'a9 2012 Nils Hammar\\par\r\n" + "\\par\r\n" + "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\\par\r\n" + "\\par\r\n" + "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\\par\r\n" + "\\par\r\n" + "You should have received a copy of the GNU General Public License along with this program. \\lang1053 If not, see {\\field{\\*\\fldinst{HYPERLINK \"http://www.gnu.org/licenses/\"}}{\\fldrslt{\\ul\\cf1 http://www.gnu.org/licenses/}}}\\f0\\fs18 .\\par\r\n" + "\\par\r\n" + "\\lang2057 Alternative licensing is possible, see the licensing document.\\par\r\n" + "\\pard\\sa200\\sl276\\slmult1\\lang29\\f1\\fs22\\par\r\n" + "}\r\n"; /// /// Initializes a new instance of the class. /// public AboutBox1() { this.InitializeComponent(); this.Text = string.Format("About {0}", AboutBox1.AssemblyTitle); this.labelProductName.Text = AboutBox1.AssemblyProduct; this.labelVersion.Text = string.Format("Version {0}", AboutBox1.AssemblyVersion); this.labelCopyright.Text = AboutBox1.AssemblyCopyright; this.labelCompanyName.Text = AboutBox1.AssemblyCompany; this.richTextBox1.Rtf = COPYRIGHT_NOTICE_RTF; } #region Assembly Attribute Accessors /// /// Gets Assembly Company /// public static string AssemblyCompany { get { object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); if (attributes.Length == 0) { return string.Empty; } return ((AssemblyCompanyAttribute)attributes[0]).Company; } } /// /// Gets Title of the assembly. /// public static string AssemblyTitle { get { object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); if (attributes.Length > 0) { AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; if (!string.IsNullOrEmpty(titleAttribute.Title)) { return titleAttribute.Title; } } return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().CodeBase); } } /// /// Gets Assembly version. /// public static string AssemblyVersion { get { return Assembly.GetEntryAssembly().GetName().Version.ToString(); } } /// /// Gets Assembly Description. /// public static string AssemblyDescription { get { object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); if (attributes.Length == 0) { return string.Empty; } return ((AssemblyDescriptionAttribute)attributes[0]).Description; } } /// /// Gets Assembly Product. /// public static string AssemblyProduct { get { object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); if (attributes.Length == 0) { return string.Empty; } return ((AssemblyProductAttribute)attributes[0]).Product; } } /// /// Gets Assembly Copyright. /// public static string AssemblyCopyright { get { object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); if (attributes.Length == 0) { return string.Empty; } return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; } } #endregion /// /// OK button clicked. /// /// Sending object. /// Event data. private void okButton_Click(object sender, EventArgs e) { this.Close(); } /// /// Handle click on link. /// /// Sending object. /// Event data. private void richTextBox1_LinkClicked(object sender, LinkClickedEventArgs e) { System.Diagnostics.Process.Start(e.LinkText); } } }