-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAbout.cs
56 lines (46 loc) · 1.87 KB
/
About.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace BroDisplaySetup
{
public partial class About : Form
{
public About()
{
InitializeComponent();
}
private void About_Load(object sender, EventArgs e)
{
// Retrieve the program name
string programName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
// Get the assembly where the attribute is defined (usually the executing assembly)
Assembly assembly = Assembly.GetExecutingAssembly();
// Get the AssemblyInformationalVersionAttribute
AssemblyInformationalVersionAttribute versionAttribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
AssemblyCopyrightAttribute copyrightAttribute = assembly.GetCustomAttribute<AssemblyCopyrightAttribute>();
// Access the attribute value
string programVersion = versionAttribute?.InformationalVersion;
// Access the copyright value
string copyright = copyrightAttribute?.Copyright;
// Set the form's title with program name and version in parentheses
this.Text = $"Om {programName} ({programVersion})";
GplV3TextBox.Text = $"{programName} ({programVersion})\r\n{copyright}\r\n\r\n" + Properties.Resources.GPLv3;
GplV3TextBox.SelectionLength = 0;
GplV3TextBox.Select(0, 0);
okButton.Focus();
}
private void okButton_Click(object sender, EventArgs e)
{
this.Close();
this.Dispose();
}
}
}