worktimehero

git clone https://git.clttr.info/worktimehero.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

AboutBox.cs (3353B)


      1 using System;
      2 using System.Collections.Generic;
      3 using System.ComponentModel;
      4 using System.Drawing;
      5 using System.Linq;
      6 using System.Reflection;
      7 using System.Threading.Tasks;
      8 using System.Windows.Forms;
      9 
     10 namespace WorkTimeHero
     11 {
     12     partial class AboutBox : Form
     13     {
     14         public AboutBox()
     15         {
     16             InitializeComponent();
     17             this.Text = String.Format("About {0}", AssemblyTitle);
     18             this.labelProductName.Text = AssemblyProduct;
     19             this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
     20             this.labelCopyright.Text = AssemblyCopyright;
     21         }
     22 
     23         #region Assembly Attribute Accessors
     24 
     25         public string AssemblyTitle
     26         {
     27             get
     28             {
     29                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
     30                 if (attributes.Length > 0)
     31                 {
     32                     AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
     33                     if (titleAttribute.Title != "")
     34                     {
     35                         return titleAttribute.Title;
     36                     }
     37                 }
     38                 return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
     39             }
     40         }
     41 
     42         public string AssemblyVersion
     43         {
     44             get
     45             {
     46                 return Assembly.GetExecutingAssembly().GetName().Version.ToString();
     47             }
     48         }
     49 
     50         public string AssemblyDescription
     51         {
     52             get
     53             {
     54                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
     55                 if (attributes.Length == 0)
     56                 {
     57                     return "";
     58                 }
     59                 return ((AssemblyDescriptionAttribute)attributes[0]).Description;
     60             }
     61         }
     62 
     63         public string AssemblyProduct
     64         {
     65             get
     66             {
     67                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
     68                 if (attributes.Length == 0)
     69                 {
     70                     return "";
     71                 }
     72                 return ((AssemblyProductAttribute)attributes[0]).Product;
     73             }
     74         }
     75 
     76         public string AssemblyCopyright
     77         {
     78             get
     79             {
     80                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
     81                 if (attributes.Length == 0)
     82                 {
     83                     return "";
     84                 }
     85                 return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
     86             }
     87         }
     88 
     89         public string AssemblyCompany
     90         {
     91             get
     92             {
     93                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
     94                 if (attributes.Length == 0)
     95                 {
     96                     return "";
     97                 }
     98                 return ((AssemblyCompanyAttribute)attributes[0]).Company;
     99             }
    100         }
    101         #endregion
    102     }
    103 }