BF2Statistics.ManageStatsDBForm.ImportASPBtn_Click C# (CSharp) Method

ImportASPBtn_Click() private method

Imports ASP created BAK files (Mysql Out FILE)
private ImportASPBtn_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private async void ImportASPBtn_Click(object sender, EventArgs e)
        {
            // Open File Select Dialog
            FolderSelectDialog Dialog = new FolderSelectDialog();
            Dialog.Title = "Select ASP Database Backup Folder";
            Dialog.InitialDirectory = Path.Combine(Paths.DocumentsFolder, "Database Backups");
            if (Dialog.ShowDialog())
            {
                // Get files list from path
                string path = Dialog.SelectedPath;
                string[] BakFiles = Directory.GetFiles(path, "*.bak");
                if (BakFiles.Length > 0)
                {
                    // Open the database connection
                    StatsDatabase Database = null;
                    try {
                        Database = new StatsDatabase();
                    }
                    catch (Exception Ex)
                    {
                        if (Ex is DbConnectException)
                        {
                            ExceptionForm.ShowDbConnectError(Ex as DbConnectException);
                            return;
                        }

                        MessageBox.Show(
                            "Unable to connect to database\r\n\r\nMessage: " + Ex.Message,
                            "Database Connection Error",
                            MessageBoxButtons.OK, MessageBoxIcon.Error
                        );
                        return;
                    }
                    finally
                    {
                        if (Database == null)
                        {
                            // Stop the ASP server, and close this form
                            HttpServer.Stop();
                            this.Close();
                        }
                    }

                    // Show task dialog
                    TaskForm.Show(this, "Importing Stats", "Importing ASP Stats Bak Files...", false);
                    this.Enabled = false;

                    // Don't block the GUI
                    await Task.Run(() => ImportFromBakup(BakFiles, Database));

                    // Alert user and close task form
                    Notify.Show("Stats imported successfully!", "Operation Successful", AlertType.Success);
                    TaskForm.CloseForm();
                    this.Enabled = true;

                    // Displose Connection
                    Database.Dispose();
                }
                else
                {
                    // Alert the user and tell them they failed
                    MessageBox.Show(
                        "Unable to locate any .bak files in this folder. Please select an ASP created database backup folder that contains backup files.", 
                        "Backup Error", 
                        MessageBoxButtons.OK, 
                        MessageBoxIcon.Error
                    );
                }
            }
        }