private void ButtonBurn_Click(object sender, EventArgs e) { if (devicesComboBox.SelectedIndex == -1) { return; } if (_isBurning) { buttonBurn.Enabled = false; backgroundBurnWorker.CancelAsync(); } else { _isBurning = true; _closeMedia = true; _ejectMedia = checkBoxEject.Checked; EnableBurnUi(false); var discRecorder = (IDiscRecorder2)devicesComboBox.Items[devicesComboBox.SelectedIndex]; _burnData.UniqueRecorderId = discRecorder.ActiveDiscRecorder; backgroundBurnWorker.RunWorkerAsync(_burnData); BurnerNotifyIcon.BalloonTipText = "Burning start"; BurnerNotifyIcon.ShowBalloonTip(30000); } }
/// <summary> /// Completed the "Burn" thread /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BackgroundBurnWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { labelStatusText.Text = (int)e.Result == 0 ? "Finished Burning Disc!" : "Error Burning Disc!"; BurnerNotifyIcon.BalloonTipText = "Burning end"; BurnerNotifyIcon.ShowBalloonTip(30000); statusProgressBar.Value = 0; _isBurning = false; EnableBurnUi(true); buttonBurn.Enabled = true; }