Example #1
0
        private void DoQuickTest(MediaWriterDisc disc)
        {
            DriveService.SelectedDrive.AutoEject = false;

            DriveService.SelectedDrive.TestBurnDisc(disc);

            UpdateUI( );

            _progressCompletedEvent.WaitOne( );
        }
Example #2
0
        private void _btnWrite_Click(object sender, System.EventArgs e)
        {
            MediaWriterDisc burnDisc = gBurnerDrive.CreateDisc();

            progressBar1.Value = 0;

            try
            {
                if (!CheckInputPath(_txtInputPath.Text))
                {
                    return;
                }
                burnDisc.SourcePathName = _txtInputPath.Text;
                burnDisc.VolumeName     = _txtVolumeName.Text;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " occurred while setting the source. Operation canceled.");
                EnableCtrls();
                return;
            }

            try
            {
                if (String.Empty != _txtISOOutput.Text)
                {
                    burnDisc.OutputPathName = _txtISOOutput.Text;
                    gBurnerDrive.CreateISO(burnDisc);
                }
                else
                {
                    gBurnerDrive.BurnDisc(burnDisc);
                }
                EnableCtrls();
                while (gBurnerDrive.State == MediaWriterState.StateWriting)
                {
                    Application.DoEvents();
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " occurred while starting write. Operation canceled.");
            }
            EnableCtrls();
        }
Example #3
0
        private void StartTesting(object state)
        {
            using (MediaWriterDisc disc = GetMediaDisc( ))
            {
                IsProcessing = true;

                DriveService.SelectedDrive.OnProgress += new EventHandler <MediaWriterProgressEventArgs> (SelectedDrive_OnProgress);

                try
                {
                    DriveService.SelectedDrive.AutoEject = false;

                    __FinalState = MediaWriterProgress.OperationProgressIdle;

                    DriveService.SelectedDrive.TestBurnDisc(disc);

                    UpdateUI( );

                    _progressCompletedEvent.WaitOne( );

                    if (__FinalState == MediaWriterProgress.OperationProgressAborted)
                    {
                        OnTestAborted( );
                    }
                    else
                    {
                        OnTestCompleted( );
                    }
                }
                catch (Exception exception)
                {
                    OnTestFailed(exception);
                }
                finally
                {
                    //TODO:remove this when they fix the media writer problem
                    Thread.Sleep(_statusUpdateTime);
                    DriveService.SelectedDrive.OnProgress -= new EventHandler <MediaWriterProgressEventArgs> (SelectedDrive_OnProgress);

                    IsProcessing = false;
                }
            }
        }
Example #4
0
        private void StartBurning(object state)
        {
            try
            {
                IsProcessing = true;

                DriveService.SelectedDrive.OnProgress += new EventHandler <MediaWriterProgressEventArgs> (SelectedDrive_OnProgress);

                for (int numberOfCopies = 1; numberOfCopies <= __ActiveMediaObject.RequestInformation.NumberOfCopies; numberOfCopies++)
                {
                    using (MediaWriterDisc disc = GetMediaDisc( ))
                    {
                        __FinalState = MediaWriterProgress.OperationProgressIdle;

                        if (CanTest && View.AutoTest)
                        {
                            DoQuickTest(disc);
                        }

                        DriveService.SelectedDrive.AutoEject = View.AutoEject;

                        if (__FinalState == MediaWriterProgress.OperationProgressAborted)
                        {
                            OnBurnAborted( );

                            break;
                        }

                        DriveService.SelectedDrive.BurnDisc(disc);

                        UpdateUI( );

                        _progressCompletedEvent.WaitOne( );

                        if (__FinalState == MediaWriterProgress.OperationProgressAborted)
                        {
                            OnBurnAborted( );

                            break;
                        }
                        else
                        {
                            if (numberOfCopies == __ActiveMediaObject.RequestInformation.NumberOfCopies)
                            {
                                OnBurnCompleted( );
                            }
                            else
                            {
                                if (!RequestUserFofNewDisc( ))
                                {
                                    OnBurnAborted( );

                                    break;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                OnBurnFailed(exception);
            }
            finally
            {
                //TODO:remove this when they fix the media writer problem
                Thread.Sleep(_statusUpdateTime);
                DriveService.SelectedDrive.OnProgress -= new EventHandler <MediaWriterProgressEventArgs> (SelectedDrive_OnProgress);

                IsProcessing = false;
            }
        }