-
Notifications
You must be signed in to change notification settings - Fork 0
/
AboutBoxForm.cs
144 lines (132 loc) · 4.74 KB
/
AboutBoxForm.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
using System;
using System.Globalization;
using System.Windows.Forms;
using Hipparcos_DB.Properties;
using MijoSoftware.AssemblyInformation;
namespace Hipparcos_DB
{
/// <summary>
/// AboutBoxForm : Form
/// </summary>
internal partial class AboutBoxForm : Form
{
/// <summary>
/// Settings
/// </summary>
private readonly Settings settings = new Settings();
/// <summary>
/// Culture info
/// </summary>
private static readonly CultureInfo culture = CultureInfo.CurrentUICulture;
/// <summary>
/// Constructor
/// </summary>
public AboutBoxForm()
{
InitializeComponent();
Text = string.Format(provider: culture, format: "Info about {0}", args: AssemblyInfo.AssemblyTitle);
labelProductName.Text = AssemblyInfo.AssemblyProduct;
labelVersion.Text = AssemblyInfo.AssemblyVersion;
labelCompanyName.Text = AssemblyInfo.AssemblyCompany;
labelCopyright.Text = AssemblyInfo.AssemblyCopyright;
textBoxDescription.Text = AssemblyInfo.AssemblyDescription;
switch (settings.UserStartPosition)
{
default: StartPosition = FormStartPosition.CenterParent; break;
case 1: StartPosition = FormStartPosition.CenterScreen; break;
}
}
/// <summary>
/// Set the information text in the status bar
/// </summary>
/// <param name="text">text to show</param>
private void SetStatusbar(string text) => toolStripStatusLabelInfo.Text = text;
/// <summary>
/// Clear the information text in the status bar
/// </summary>
private void ClearStatusbar() => toolStripStatusLabelInfo.Text = string.Empty;
/// <summary>
/// Load the window
/// </summary>
/// <param name="sender">object sender</param>
/// <param name="e">event arguments</param>
/// <remarks>The parameters <paramref name="sender"/> and <paramref name="e"/> are not needed, but must be indicated.</remarks>
private void AboutBoxForm_Load(object sender, EventArgs e) => ClearStatusbar();
#region Enter event handlers
/// <summary>
/// Set the information text in the status bar while entering a control
/// </summary>
/// <param name="sender">object sender</param>
/// <param name="e">event arguments</param>
/// <remarks>The parameter <paramref name="e"/> is not needed, but must be indicated.</remarks>
private void SetStatusbar_Enter(object sender, EventArgs e)
{
if (sender is Control control)
{
SetStatusbar(text: control.AccessibleDescription);
}
else if (sender is ToolStripButton toolStripButton)
{
SetStatusbar(text: toolStripButton.AccessibleDescription);
}
else if (sender is ToolStripMenuItem toolStripMenuItem)
{
SetStatusbar(text: toolStripMenuItem.AccessibleDescription);
}
else if (sender is ToolStripLabel toolStripLabel)
{
SetStatusbar(text: toolStripLabel.AccessibleDescription);
}
else if (sender is ToolStripComboBox toolStripComboBox)
{
SetStatusbar(text: toolStripComboBox.AccessibleDescription);
}
else if (sender is ToolStripDropDown toolStripDropDown)
{
SetStatusbar(text: toolStripDropDown.AccessibleDescription);
}
else if (sender is ToolStripDropDownButton toolStripDropDownButton)
{
SetStatusbar(text: toolStripDropDownButton.AccessibleDescription);
}
else if (sender is ToolStripDropDownItem toolStripDropDownItem)
{
SetStatusbar(text: toolStripDropDownItem.AccessibleDescription);
}
else if (sender is ToolStripDropDownMenu toolStripDropDownMenu)
{
SetStatusbar(text: toolStripDropDownMenu.AccessibleDescription);
}
else if (sender is ToolStripProgressBar toolStripProgressBar)
{
SetStatusbar(text: toolStripProgressBar.AccessibleDescription);
}
else if (sender is ToolStripSplitButton toolStripSplitButton)
{
SetStatusbar(text: toolStripSplitButton.AccessibleDescription);
}
else if (sender is ToolStripSeparator toolStripSeparator)
{
SetStatusbar(text: toolStripSeparator.AccessibleDescription);
}
else if (sender is ToolStripStatusLabel toolStripStatusLabel)
{
SetStatusbar(text: toolStripStatusLabel.AccessibleDescription);
}
else if (sender is ToolStripTextBox toolStripTextBox)
{
SetStatusbar(text: toolStripTextBox.AccessibleDescription);
}
}
#endregion
#region Leave event handlers
/// <summary>
/// Clear the information text in the status bar while leaving a control
/// </summary>
/// <param name="sender">object sender</param>
/// <param name="e">event arguments</param>
/// <remarks>The parameters <paramref name="sender"/> and <paramref name="e"/> are not needed, but must be indicated.</remarks>
private void ClearStatusbar_Leave(object sender, EventArgs e) => ClearStatusbar();
#endregion
}
}