Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3.1/sources/HeuristicLab.PluginInfrastructure.GUI/AboutBox.cs @ 11700

Last change on this file since 11700 was 2, checked in by swagner, 17 years ago

Added HeuristicLab 3.0 sources from former SVN repository at revision 52

File size: 4.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.ComponentModel;
25using System.Drawing;
26using System.Windows.Forms;
27using System.Reflection;
28
29namespace HeuristicLab.PluginInfrastructure.GUI {
30  partial class AboutBox : Form {
31    public AboutBox() {
32      InitializeComponent();
33
34      //  Initialize the AboutBox to display the product information from the assembly information.
35      //  Change assembly information settings for your application through either:
36      //  - Project->Properties->Application->Assembly Information
37      //  - AssemblyInfo.cs
38      this.Text = String.Format("About {0}", AssemblyTitle);
39      this.labelProductName.Text = AssemblyProduct;
40      this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
41      this.labelCopyright.Text = AssemblyCopyright;
42      this.labelCompanyName.Text = AssemblyCompany;
43      this.textBoxDescription.Text = AssemblyDescription;
44    }
45
46    #region Assembly Attribute Accessors
47
48    public string AssemblyTitle {
49      get {
50        // Get all Title attributes on this assembly
51        object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
52        // If there is at least one Title attribute
53        if(attributes.Length > 0) {
54          // Select the first one
55          AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
56          // If it is not an empty string, return it
57          if(titleAttribute.Title != "")
58            return titleAttribute.Title;
59        }
60        // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name
61        return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
62      }
63    }
64
65    public string AssemblyVersion {
66      get {
67        return Assembly.GetExecutingAssembly().GetName().Version.ToString();
68      }
69    }
70
71    public string AssemblyDescription {
72      get {
73        // Get all Description attributes on this assembly
74        object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
75        // If there aren't any Description attributes, return an empty string
76        if(attributes.Length == 0)
77          return "";
78        // If there is a Description attribute, return its value
79        return ((AssemblyDescriptionAttribute)attributes[0]).Description;
80      }
81    }
82
83    public string AssemblyProduct {
84      get {
85        // Get all Product attributes on this assembly
86        object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
87        // If there aren't any Product attributes, return an empty string
88        if(attributes.Length == 0)
89          return "";
90        // If there is a Product attribute, return its value
91        return ((AssemblyProductAttribute)attributes[0]).Product;
92      }
93    }
94
95    public string AssemblyCopyright {
96      get {
97        // Get all Copyright attributes on this assembly
98        object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
99        // If there aren't any Copyright attributes, return an empty string
100        if(attributes.Length == 0)
101          return "";
102        // If there is a Copyright attribute, return its value
103        return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
104      }
105    }
106
107    public string AssemblyCompany {
108      get {
109        // Get all Company attributes on this assembly
110        object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
111        // If there aren't any Company attributes, return an empty string
112        if(attributes.Length == 0)
113          return "";
114        // If there is a Company attribute, return its value
115        return ((AssemblyCompanyAttribute)attributes[0]).Company;
116      }
117    }
118    #endregion
119  }
120}
Note: See TracBrowser for help on using the repository browser.