-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from Mijo-Software/mjohne-patch-1
Add files via upload
- Loading branch information
Showing
24 changed files
with
1,735 additions
and
433 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Windows.Forms; | ||
|
||
namespace DisksizeWatcher | ||
{ | ||
partial class AboutBoxForm : Form | ||
{ | ||
/// <summary> | ||
/// Set a specific text to the status bar | ||
/// </summary> | ||
/// <param name="text">text with some information</param> | ||
private void SetStatusbarText(string text) | ||
{ | ||
labelInformation.Enabled = !string.IsNullOrEmpty(value: text); | ||
labelInformation.Text = text; | ||
} | ||
|
||
public AboutBoxForm() | ||
{ | ||
InitializeComponent(); | ||
Text = $"Info about {AssemblyTitle}"; | ||
labelProductName.Text = AssemblyProduct; | ||
labelVersion.Text = $"Version {AssemblyVersion}"; | ||
labelCopyright.Text = AssemblyCopyright; | ||
labelCompanyName.Text = AssemblyCompany; | ||
textBoxDescription.Text = AssemblyDescription; | ||
} | ||
|
||
#region Assemblyattributaccessoren | ||
|
||
public string AssemblyTitle | ||
{ | ||
get | ||
{ | ||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); | ||
if (attributes.Length > 0) | ||
{ | ||
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; | ||
if (titleAttribute.Title != string.Empty) | ||
{ | ||
return titleAttribute.Title; | ||
} | ||
} | ||
return Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); | ||
} | ||
} | ||
|
||
public string AssemblyVersion | ||
{ | ||
get | ||
{ | ||
return Assembly.GetExecutingAssembly().GetName().Version.ToString(); | ||
} | ||
} | ||
|
||
public string AssemblyDescription | ||
{ | ||
get | ||
{ | ||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); | ||
if (attributes.Length == 0) | ||
{ | ||
return string.Empty; | ||
} | ||
return ((AssemblyDescriptionAttribute)attributes[0]).Description; | ||
} | ||
} | ||
|
||
public string AssemblyProduct | ||
{ | ||
get | ||
{ | ||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); | ||
if (attributes.Length == 0) | ||
{ | ||
return string.Empty; | ||
} | ||
return ((AssemblyProductAttribute)attributes[0]).Product; | ||
} | ||
} | ||
|
||
public string AssemblyCopyright | ||
{ | ||
get | ||
{ | ||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); | ||
if (attributes.Length == 0) | ||
{ | ||
return string.Empty; | ||
} | ||
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; | ||
} | ||
} | ||
|
||
public string AssemblyCompany | ||
{ | ||
get | ||
{ | ||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); | ||
if (attributes.Length == 0) | ||
{ | ||
return string.Empty; | ||
} | ||
return ((AssemblyCompanyAttribute)attributes[0]).Company; | ||
} | ||
} | ||
#endregion | ||
|
||
/// <summary> | ||
/// Load the form | ||
/// </summary> | ||
/// <param name="sender">object sender</param> | ||
/// <param name="e">event arguments</param> | ||
/// <remarks>The parameters <paramref name="e"/> and <paramref name="sender"/> are not needed, but must be indicated.</remarks> | ||
private void AboutBoxForm_Load(object sender, System.EventArgs e) => SetStatusbarText(text: string.Empty); | ||
|
||
/// <summary> | ||
/// Detect the accessibility description to set as information text in the status bar | ||
/// </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) | ||
{ | ||
string text = string.Empty; | ||
switch (sender) | ||
{ | ||
case Control control: | ||
text = control.AccessibleDescription; | ||
break; | ||
case ToolStripSplitButton toolStripSplitButton: | ||
text = toolStripSplitButton.AccessibleDescription; | ||
break; | ||
case ToolStripButton toolStripButton: | ||
text = toolStripButton.AccessibleDescription; | ||
break; | ||
case ToolStripLabel toolStripLabel: | ||
text = toolStripLabel.AccessibleDescription; | ||
break; | ||
case ToolStripMenuItem toolStripMenuItem: | ||
text = toolStripMenuItem.AccessibleDescription; | ||
break; | ||
} | ||
SetStatusbarText(text: text); | ||
} | ||
|
||
/// <summary> | ||
/// Clear the information text of the status bar | ||
/// </summary> | ||
/// <param name="sender">object sender</param> | ||
/// <param name="e">event arguments</param> | ||
/// <remarks>The parameters <paramref name="e"/> and <paramref name="sender"/> are not needed, but must be indicated.</remarks> | ||
private void ClearStatusbar_Leave(object sender, EventArgs e) => SetStatusbarText(text: string.Empty); | ||
} | ||
} |
Oops, something went wrong.