BF2Statistics.MainForm.LaunchEmuBtn_Click C# (CSharp) Method

LaunchEmuBtn_Click() private method

Event fired when the Launch emulator button is pushed
private LaunchEmuBtn_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private async void LaunchEmuBtn_Click(object sender, EventArgs e)
        {
            if (!GamespyEmulator.IsRunning)
            {
                // Make sure the Http web server is running, Cant generate PID's
                // for accounts if the ASP isnt up :P
                if (!HttpServer.IsRunning)
                {
                    DialogResult Res = MessageBox.Show(
                        "The Gamespy Server needs to be able to communicate with the ASP Stats server."
                        + Environment.NewLine.Repeat(1)
                        + "Would you like to start the ASP stats server now?",
                        "Asp Stats Server Required",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Warning
                    );

                    // Start HTTP server if the user requests
                    if (Res == DialogResult.Yes)
                        StartAspServerBtn_Click(sender, e);

                    return;
                }

                // Start the loading process
                ToggleGamespyEmuBtn.Enabled = false;
                ToggleGamespyServerBtn.Enabled = false;
                GamespyStatusPic.Image = Resources.loading;

                // Await Servers Async, Dont want MySQL locking up the GUI
                try
                {
                    await Task.Run(() => GamespyEmulator.Start());
                }
                catch (Exception E)
                {
                    // Exception message will already be there
                    GamespyStatusPic.Image = Resources.warning;
                    ToggleGamespyServerBtn.Enabled = true;
                    ToggleGamespyEmuBtn.Enabled = true;
                    Tipsy.SetToolTip(GamespyStatusPic, E.Message);

                    // Show the DB exception form if its a DB connection error
                    if (E is DbConnectException)
                        ExceptionForm.ShowDbConnectError(E as DbConnectException);
                }
            }
            else
            {
                GamespyEmulator.Shutdown();
                Tipsy.SetToolTip(GamespyStatusPic, "Gamespy server is currently offline.");
            }
        }
MainForm