private async Task<int> StartBurnProcess(IDiscRecorder2 discRecorder, bool ejectMedia,
            IList<MediaFile> mediaItems, IMAPI_BURN_VERIFICATION_LEVEL verificationLevel,
            CancellationToken cancellationToken, IProgress<BurnData> progress)
        {
            IsBurning = true;
            this.ejectMedia = ejectMedia;
            this.burnProgress = progress;
            this.mediaItems = mediaItems;
            this.cancellationToken = cancellationToken;

            burnData = new BurnData();
            burnData.uniqueRecorderId = discRecorder.ActiveDiscRecorder;

            var burnResult = await Task.Run(() => DoBurn(burnData.uniqueRecorderId));

            progress.Report(burnData);

            IsBurning = false;

            return burnResult;
        }
 public HRESULT put_BurnVerificationLevel(IMAPI_BURN_VERIFICATION_LEVEL value)
 {
     return(((delegate * unmanaged <IBurnVerification *, IMAPI_BURN_VERIFICATION_LEVEL, int>)(lpVtbl[3]))((IBurnVerification *)Unsafe.AsPointer(ref this), value));
 }
        private int DoBurn(string activeDiscRecorder, IMAPI_BURN_VERIFICATION_LEVEL verificationLevel)
        {
            MsftDiscRecorder2 discRecorder = null;
            MsftDiscFormat2Data discFormatData = null;
            int result = 0;

            try
            {
                discRecorder = new MsftDiscRecorder2();
                discRecorder.InitializeDiscRecorder(burnData.uniqueRecorderId);

                discFormatData = new MsftDiscFormat2Data
                {
                    Recorder = discRecorder,
                    ClientName = "ClientName",
                    ForceMediaToBeClosed = closeMedia
                };

                var burnVerification = (IBurnVerification)discFormatData;
                burnVerification.BurnVerificationLevel = verificationLevel;

                object[] multisessionInterfaces = null;
                if (!discFormatData.MediaHeuristicallyBlank)
                    multisessionInterfaces = discFormatData.MultisessionInterfaces;

                IStream fileSystem;
                if (!CreateMediaFileSystem(discRecorder, multisessionInterfaces, out fileSystem))
                    return -1;

                discFormatData.Update += discFormatData_Update;

                try
                {
                    discFormatData.Write(fileSystem);
                    result = 0;
                }
                catch (COMException ex)
                {
                    result = ex.ErrorCode;
                    MessageBox.Show(ex.Message, "IDiscFormat2Data.Write failed",
                        MessageBoxButton.OK, MessageBoxImage.Stop);
                }
                finally
                {
                    if (fileSystem != null)
                        Marshal.FinalReleaseComObject(fileSystem);
                }

                discFormatData.Update -= discFormatData_Update;

                if (ejectMedia)
                    discRecorder.EjectMedia();
            }
            catch (COMException exception)
            {
                MessageBox.Show(exception.Message);
                result = exception.ErrorCode;
            }
            finally
            {
                if (discRecorder != null)
                    Marshal.ReleaseComObject(discRecorder);

                if (discFormatData != null)
                    Marshal.ReleaseComObject(discFormatData);
            }

            return result;
        }
Beispiel #4
0
 /// <summary>
 /// Get the burn verification level when the user changes the selection
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void comboBoxVerification_SelectedIndexChanged(object sender, EventArgs e)
 {
     _verificationLevel = (IMAPI_BURN_VERIFICATION_LEVEL)comboBoxVerification.SelectedIndex;
 }
Beispiel #5
0
 /// <summary>
 /// Get the burn verification level when the user changes the selection
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void comboBoxVerification_SelectedIndexChanged(object sender, EventArgs e)
 {
     m_verificationLevel = (IMAPI_BURN_VERIFICATION_LEVEL)comboBoxVerification.SelectedIndex;
 }