PageRenderTime 19ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/DemoCartaoCidadao/frmAbout.cs

#
C# | 103 lines | 95 code | 8 blank | 0 comment | 11 complexity | 1bb9c9930bd350049339028cd6827083 MD5 | raw file
Possible License(s): LGPL-3.0
  1using System;
  2using System.Collections.Generic;
  3using System.ComponentModel;
  4using System.Drawing;
  5using System.Reflection;
  6using System.Windows.Forms;
  7
  8namespace DemoCartaoCidadao
  9{
 10  partial class frmAbout : Form
 11  {
 12    public frmAbout()
 13    {
 14      InitializeComponent();
 15      this.Text = String.Format("Acerca de {0}", AssemblyTitle);
 16      this.labelProductName.Text = AssemblyProduct;
 17      this.labelVersion.Text = String.Format("Versão {0}", AssemblyVersion);
 18      this.labelCopyright.Text = AssemblyCopyright;
 19      this.labelCompanyName.Text = AssemblyCompany;
 20      this.textBoxDescription.Text = AssemblyDescription;
 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}