annotate ServerMonitor/Forms/AboutForm.cs @ 23:3866c19535fd

Fix NullReferenceException when checks are executed on a brand new server.
author Brad Greco <brad@bgreco.net>
date Thu, 30 May 2019 21:40:27 -0400
parents b21318f6e3f1
children f6235dc0a8ec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
1 using ServerMonitorApp.Properties;
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
2 using System;
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
3 using System.Diagnostics;
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
4 using System.Reflection;
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
5 using System.Windows.Forms;
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
6
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
7 namespace ServerMonitorApp
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
8 {
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
9 /// <summary>Program About form.</summary>
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
10 public partial class AboutForm : Form
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
11 {
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
12 public AboutForm()
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
13 {
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
14 InitializeComponent();
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
15 }
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
16
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
17 private void AboutForm_Load(object sender, EventArgs e)
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
18 {
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
19 Icon = Resources.icon;
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
20 NameLabel.Text += " " + Assembly.GetExecutingAssembly().GetName().Version.ToString(2);
20
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
21 // Remove initial focus on the first link causing an dotted outline.
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
22 ActiveControl = NameLabel;
19
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
23 }
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
24
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
25 /// <summary>Hides the form when ESC is pressed.</summary>
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
26 protected override bool ProcessDialogKey(Keys keyData)
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
27 {
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
28 if (keyData == Keys.Escape)
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
29 {
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
30 Close();
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
31 return true;
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
32 }
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
33 return base.ProcessDialogKey(keyData);
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
34 }
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
35
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
36 private void HomePageLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
37 {
20
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
38 Process.Start("https://bgreco.net/servermonitor");
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
39 }
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
40
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
41 private void SshNetLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
42 {
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
43 Process.Start("https://github.com/sshnet/SSH.NET");
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
44 }
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
45
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
46 private void NAppUpdateLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
47 {
b21318f6e3f1 About window tweaks
Brad Greco <brad@bgreco.net>
parents: 19
diff changeset
48 Process.Start("https://github.com/synhershko/NAppUpdate");
19
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
49 }
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
50 }
b3128fe10d57 Add About form and license.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
51 }