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