About.cs

00001 using System;
00002 using System.Collections.Generic;
00003 using System.ComponentModel;
00004 using System.Drawing;
00005 using System.Windows.Forms;
00006 using System.Reflection;
00007 
00008 namespace Client
00009 {
00013     partial class About : Form
00014     {
00018         public About()
00019         {
00020             InitializeComponent();
00021 
00022             //  Initialize the AboutBox to display the product information from the assembly information.
00023             //  Change assembly information settings for your application through either:
00024             //  - Project->Properties->Application->Assembly Information
00025             //  - AssemblyInfo.cs
00026             this.Text = String.Format("About {0}", AssemblyTitle);
00027             this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
00028             this.labelCopyright.Text = AssemblyCopyright;
00029             this.labelCompanyName.Text = AssemblyCompany;
00030         }
00031 
00032         #region Assembly Attribute Accessors
00033 
00037         public string AssemblyTitle
00038         {
00039             get
00040             {
00041                 // Get all Title attributes on this assembly
00042                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
00043                 // If there is at least one Title attribute
00044                 if (attributes.Length > 0)
00045                 {
00046                     // Select the first one
00047                     AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
00048                     // If it is not an empty string, return it
00049                     if (titleAttribute.Title != "")
00050                         return titleAttribute.Title;
00051                 }
00052                 // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name
00053                 return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
00054             }
00055         }
00056 
00060         public string AssemblyVersion
00061         {
00062             get
00063             {
00064                 return Assembly.GetExecutingAssembly().GetName().Version.ToString();
00065             }
00066         }
00067 
00071         public string AssemblyCopyright
00072         {
00073             get
00074             {
00075                 // Get all Copyright attributes on this assembly
00076                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
00077                 // If there aren't any Copyright attributes, return an empty string
00078                 if (attributes.Length == 0)
00079                     return "";
00080                 // If there is a Copyright attribute, return its value
00081                 return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
00082             }
00083         }
00084 
00088         public string AssemblyCompany
00089         {
00090             get
00091             {
00092                 // Get all Company attributes on this assembly
00093                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
00094                 // If there aren't any Company attributes, return an empty string
00095                 if (attributes.Length == 0)
00096                     return "";
00097                 // If there is a Company attribute, return its value
00098                 return ((AssemblyCompanyAttribute)attributes[0]).Company;
00099             }
00100         }
00101         #endregion
00102     }
00103 }

Generated on Thu Dec 21 06:21:54 2006 for SCRAML by  doxygen 1.5.1-p1