Skip to content

Commit

Permalink
Add AboutBox with links back to mine and koolkdev's GitHub pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
OtherworldBob committed Dec 5, 2017
1 parent 53162ae commit 1af714b
Show file tree
Hide file tree
Showing 7 changed files with 936 additions and 32 deletions.
167 changes: 167 additions & 0 deletions ManiacEditor/AboutBox.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions ManiacEditor/AboutBox.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
using System;
using System.Diagnostics;
using System.Reflection;
using System.Windows.Forms;

namespace ManiacEditor
{
partial class AboutBox : Form
{
public AboutBox()
{
InitializeComponent();
Text = String.Format("About {0}", AssemblyTitle);
labelProductName.Text = AssemblyProduct;
labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
labelCopyright.Text = AssemblyCopyright;
llAbout.Links.Clear();
var koolkdevLink = new LinkLabel.Link(136, 8, "https://github.com/koolkdev/ManiacEditor") { Description = "koolkdev's GitHub page." };
var otherworldbobLink = new LinkLabel.Link(197, 13, "https://github.com/OtherworldBob/ManiacEditor") { Description = "OtherworldBob's GitHub page." };

llAbout.Links.Add(koolkdevLink);
llAbout.Links.Add(otherworldbobLink);
}

#region Assembly Attribute Accessors

public string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != "")
{
return titleAttribute.Title;
}
}
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
}
}

public string AssemblyVersion
{
get
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}

public string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyProductAttribute)attributes[0]).Product;
}
}

public string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}
#endregion

private void llAbout_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
try
{
Process.Start(e.Link.LinkData.ToString());
e.Link.Visited = true;
}
catch (Exception ex)
{
MessageBox.Show("Failed to open the link. " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
Loading

0 comments on commit 1af714b

Please sign in to comment.