private void buildBtn_Click(object sender, EventArgs e) { string errors = checkBuildErrors(); if (errors.Length > 1) { MetroMessageBox.Show(this, errors, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } if (pendingChanges && promptSaveChanges() == System.Windows.Forms.DialogResult.Cancel) { return; } SpinnerScaleTimer.Start(); builder = new BackgroundWorker(); builder.DoWork += builder_DoWork; builder.RunWorkerCompleted += builder_RunWorkerCompleted; builder.ProgressChanged += builder_ProgressChanged; builder.WorkerReportsProgress = true; SpinnerScaleTimer.Start(); builder.RunWorkerAsync(); }
void builder_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { SpinnerScaleTimer.Start(); statusLbl.Text = "Ready!"; SystemSound sound = SystemSounds.Asterisk; sound.Play(); this.TopMost = true; this.TopMost = false; }