]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.cs
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / math / dot_net_example / distribution_explorer / AboutDistributionExplorer.cs
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Windows.Forms;
6 using System.Reflection;
7
8 namespace distribution_explorer
9 {
10 partial class AboutDistributionExplorer : Form
11 {
12 public AboutDistributionExplorer()
13 {
14 InitializeComponent();
15
16 // Initialize the AboutBox to display the product information from the assembly information.
17 // Change assembly information settings for your application through either:
18 // - Project->Properties->Application->Assembly Information
19 // - AssemblyInfo.cs
20 this.Text = String.Format("About {0}", AssemblyTitle);
21 this.labelProductName.Text = AssemblyProduct;
22 this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
23 this.labelCopyright.Text = AssemblyCopyright;
24 this.labelCompanyName.Text = AssemblyCompany;
25 this.textBoxDescription.Text = AssemblyDescription;
26 }
27
28 #region Assembly Attribute Accessors
29
30 public string AssemblyTitle
31 {
32 get
33 {
34 // Get all Title attributes on this assembly
35 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
36 // If there is at least one Title attribute
37 if (attributes.Length > 0)
38 {
39 // Select the first one
40 AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
41 // If it is not an empty string, return it
42 if (titleAttribute.Title != "")
43 return titleAttribute.Title;
44 }
45 // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name
46 return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
47 }
48 }
49
50 public string AssemblyVersion
51 {
52 get
53 {
54 return Assembly.GetExecutingAssembly().GetName().Version.ToString();
55 }
56 }
57
58 public string AssemblyDescription
59 {
60 get
61 {
62 // Get all Description attributes on this assembly
63 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
64 // If there aren't any Description attributes, return an empty string
65 if (attributes.Length == 0)
66 return "";
67 // If there is a Description attribute, return its value
68 return ((AssemblyDescriptionAttribute)attributes[0]).Description;
69 }
70 }
71
72 public string AssemblyProduct
73 {
74 get
75 {
76 // Get all Product attributes on this assembly
77 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
78 // If there aren't any Product attributes, return an empty string
79 if (attributes.Length == 0)
80 return "";
81 // If there is a Product attribute, return its value
82 return ((AssemblyProductAttribute)attributes[0]).Product;
83 }
84 }
85
86 public string AssemblyCopyright
87 {
88 get
89 {
90 // Get all Copyright attributes on this assembly
91 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
92 // If there aren't any Copyright attributes, return an empty string
93 if (attributes.Length == 0)
94 return "";
95 // If there is a Copyright attribute, return its value
96 return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
97 }
98 }
99
100 public string AssemblyCompany
101 {
102 get
103 {
104 // Get all Company attributes on this assembly
105 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
106 // If there aren't any Company attributes, return an empty string
107 if (attributes.Length == 0)
108 return "";
109 // If there is a Company attribute, return its value
110 return ((AssemblyCompanyAttribute)attributes[0]).Company;
111 }
112 }
113 #endregion
114 }
115 }