BF2Statistics.MainForm.InstallButton_Click C# (CSharp) Method

InstallButton_Click() private method

When the Install button is clicked, its checked whether the BF2statisticsConfig.py file is located in the "python/bf2" directory, and either installs or removes the bf2statistics python
private InstallButton_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private async void InstallButton_Click(object sender, EventArgs e)
        {
            // Display the LoadingForm. This is a Modal so the mainform is locked
            LoadingForm.ShowScreen(this, true);
            SetNativeEnabled(false);

            // Install or Remove files
            try
            {
                // Put this in a task incase the HDD is being slow (busy)
                await Task.Run(() =>
                {
                    if (!StatsPython.Installed)
                        StatsPython.BackupAndInstall();
                    else
                        StatsPython.RemoveAndRestore();
                });
            }
            catch (Exception E)
            {
                Program.ErrorLog.Write("ERROR: [BF2sPythonInstall] " + E.Message);
                throw;
            }
            finally
            {
                // Unlock now that we are done
                CheckPythonStatus();
                SetNativeEnabled(true);
                LoadingForm.CloseForm();
            }
        }
MainForm