protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (CheckForDuplicateProcess())
{
MessageBox.Show("Server Density is already running. Click its icon in the system tray to view your configuration.", "Server Density", MessageBoxButtons.OK, MessageBoxIcon.Information);
Close();
return;
}
AgentConfiguration config = AgentConfiguration.Load();
_url.Text = config.Url;
_agentKey.Text = config.AgentKey;
_iis.Checked = config.IISChecks;
_pluginDirectory.Text = config.PluginDirectory;
_plugins.Checked = !string.IsNullOrEmpty(config.PluginDirectory);
_mongoDBConnectionString.Text = config.MongoDBConnectionString;
_mongoDB.Checked = !string.IsNullOrEmpty(config.MongoDBConnectionString);
_dbStats.Checked = config.MongoDBDBStats;
_replSet.Checked = config.MongoDBReplSet;
_sqlServer.Checked = config.SQLServerChecks;
_customPrefix.Checked = !string.IsNullOrEmpty(config.CustomPrefix);
_customPrefixValue.Text = config.CustomPrefix;
_eventViewer.Checked = config.EventViewer;
// Initialise and start the background update checker.
_updater = new Updater();
_updater.UpdatesDetected += Updater_UpdatesDetected;
_updater.Start();
}