Пример #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Initialise the update checker and set up its events.
            _updater = new Updater();
            _updater.UpdatesDetected += Updater_UpdatesDetected;
            _updater.Complete += Updater_NoUpdatesDetected;
            _updater.Error += Updater_Error;

            WaitForParent(); // Wait for parent process to die.

            // Start the update checker.
            _updater.Start();
        }
Пример #2
0
        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();
        }