123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678 |
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Runtime.InteropServices;
- using NEROLib;
- namespace LYFZ.NeroDiscBurn.NET
- {
- /// <summary>
- /// Summary description for BurnProgress.
- /// </summary>
- public class BurnProgressForm : System.Windows.Forms.Form
- {
- private NeroDrive m_drive;
- private Nero m_nero;
- private DateTime m_timeStart;
- private System.Timers.Timer m_timer;
- private WaitCDForm m_frmWaitCD;
- private bool m_bAborted;
- private _INeroDriveEvents_OnDoneBurnEventHandler m_evOnDoneBurn;
- private _INeroDriveEvents_OnProgressEventHandler m_evOnProgress;
- private _INeroDriveEvents_OnSubTaskProgressEventHandler m_evOnSubTaskProgress;
- private _INeroDriveEvents_OnAbortedEventHandler m_evOnAborted;
- private _INeroDriveEvents_OnAddLogLineEventHandler m_evOnAddLogLine;
- private _INeroDriveEvents_OnSetPhaseEventHandler m_evOnSetPhase;
- private _INeroDriveEvents_OnDisableAbortEventHandler m_evOnDisableAbort;
- private _INeroEvents_OnFileSelImageEventHandler m_evOnFileSelImage;
- private _INeroEvents_OnWaitCDEventHandler m_evOnWaitCD;
- private _INeroEvents_OnWaitCDDoneEventHandler m_evOnWaitCDDone;
- private _INeroEvents_OnWaitCDMediaInfoEventHandler m_evOnWaitCDMediaInfo;
- private _INeroEvents_OnNonEmptyCDRWEventHandler m_evOnNonEmptyCDRW;
- private System.Windows.Forms.ListView c_Events;
- private System.Windows.Forms.ColumnHeader columnHeader1;
- private System.Windows.Forms.ColumnHeader columnHeader2;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label c_TimeElapsed;
- private System.Windows.Forms.ProgressBar c_SubTask;
- private System.Windows.Forms.ProgressBar c_Task;
- private System.Windows.Forms.Label c_SubTaskPercent;
- private System.Windows.Forms.Label c_TaskPercent;
- private System.Windows.Forms.Button c_Done;
- private System.Windows.Forms.Button c_Cancel;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label c_Phase;
- private System.Windows.Forms.Button c_SaveLog;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
- public BurnProgressForm(NeroDrive drive, Nero nero)
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
- m_drive = drive;
- m_nero = nero;
- m_bAborted = false;
- }
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad (e);
- // Upon loading, create a new WaitCD form and subscribe to its
- // OnCancel event that we will use to abort the burning process.
- // //加载后,创建一个新的手表形态和订阅,我们将用它来中止刻录过程的OnCancel事件。
- m_frmWaitCD = new WaitCDForm ();
- m_frmWaitCD.OnCancel += new EventHandler(m_frmWaitCD_OnCancel);
- }
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.c_Events = new System.Windows.Forms.ListView();
- this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.label1 = new System.Windows.Forms.Label();
- this.c_TimeElapsed = new System.Windows.Forms.Label();
- this.c_SubTask = new System.Windows.Forms.ProgressBar();
- this.c_Task = new System.Windows.Forms.ProgressBar();
- this.c_SubTaskPercent = new System.Windows.Forms.Label();
- this.c_TaskPercent = new System.Windows.Forms.Label();
- this.c_Done = new System.Windows.Forms.Button();
- this.c_Cancel = new System.Windows.Forms.Button();
- this.label2 = new System.Windows.Forms.Label();
- this.c_Phase = new System.Windows.Forms.Label();
- this.c_SaveLog = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // c_Events
- //
- this.c_Events.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.columnHeader1,
- this.columnHeader2});
- this.c_Events.Location = new System.Drawing.Point(10, 9);
- this.c_Events.Name = "c_Events";
- this.c_Events.Size = new System.Drawing.Size(662, 181);
- this.c_Events.TabIndex = 8;
- this.c_Events.UseCompatibleStateImageBehavior = false;
- this.c_Events.View = System.Windows.Forms.View.Details;
- //
- // columnHeader1
- //
- this.columnHeader1.Text = "Time";
- this.columnHeader1.Width = 69;
- //
- // columnHeader2
- //
- this.columnHeader2.Text = "Events";
- this.columnHeader2.Width = 458;
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(470, 198);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(96, 17);
- this.label1.TabIndex = 2;
- this.label1.Text = "进度:";
- //
- // c_TimeElapsed
- //
- this.c_TimeElapsed.Location = new System.Drawing.Point(576, 198);
- this.c_TimeElapsed.Name = "c_TimeElapsed";
- this.c_TimeElapsed.Size = new System.Drawing.Size(96, 17);
- this.c_TimeElapsed.TabIndex = 3;
- this.c_TimeElapsed.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // c_SubTask
- //
- this.c_SubTask.Location = new System.Drawing.Point(58, 224);
- this.c_SubTask.Name = "c_SubTask";
- this.c_SubTask.Size = new System.Drawing.Size(614, 25);
- this.c_SubTask.TabIndex = 5;
- //
- // c_Task
- //
- this.c_Task.Location = new System.Drawing.Point(58, 258);
- this.c_Task.Name = "c_Task";
- this.c_Task.Size = new System.Drawing.Size(614, 25);
- this.c_Task.TabIndex = 7;
- //
- // c_SubTaskPercent
- //
- this.c_SubTaskPercent.Location = new System.Drawing.Point(10, 224);
- this.c_SubTaskPercent.Name = "c_SubTaskPercent";
- this.c_SubTaskPercent.Size = new System.Drawing.Size(48, 26);
- this.c_SubTaskPercent.TabIndex = 4;
- this.c_SubTaskPercent.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // c_TaskPercent
- //
- this.c_TaskPercent.Location = new System.Drawing.Point(10, 258);
- this.c_TaskPercent.Name = "c_TaskPercent";
- this.c_TaskPercent.Size = new System.Drawing.Size(48, 26);
- this.c_TaskPercent.TabIndex = 6;
- this.c_TaskPercent.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // c_Done
- //
- this.c_Done.DialogResult = System.Windows.Forms.DialogResult.OK;
- this.c_Done.Enabled = false;
- this.c_Done.Location = new System.Drawing.Point(490, 293);
- this.c_Done.Name = "c_Done";
- this.c_Done.Size = new System.Drawing.Size(90, 25);
- this.c_Done.TabIndex = 10;
- this.c_Done.Text = "Done";
- //
- // c_Cancel
- //
- this.c_Cancel.Location = new System.Drawing.Point(586, 293);
- this.c_Cancel.Name = "c_Cancel";
- this.c_Cancel.Size = new System.Drawing.Size(90, 25);
- this.c_Cancel.TabIndex = 11;
- this.c_Cancel.Text = "Cancel";
- this.c_Cancel.Click += new System.EventHandler(this.c_Cancel_Click);
- //
- // label2
- //
- this.label2.Location = new System.Drawing.Point(10, 198);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(48, 17);
- this.label2.TabIndex = 0;
- this.label2.Text = "执行阶段:";
- //
- // c_Phase
- //
- this.c_Phase.Location = new System.Drawing.Point(67, 198);
- this.c_Phase.Name = "c_Phase";
- this.c_Phase.Size = new System.Drawing.Size(384, 17);
- this.c_Phase.TabIndex = 1;
- //
- // c_SaveLog
- //
- this.c_SaveLog.Enabled = false;
- this.c_SaveLog.Location = new System.Drawing.Point(394, 293);
- this.c_SaveLog.Name = "c_SaveLog";
- this.c_SaveLog.Size = new System.Drawing.Size(90, 25);
- this.c_SaveLog.TabIndex = 9;
- this.c_SaveLog.Text = "Save Log";
- this.c_SaveLog.Click += new System.EventHandler(this.c_SaveLog_Click);
- //
- // BurnProgressForm
- //
- this.AcceptButton = this.c_Done;
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.ClientSize = new System.Drawing.Size(712, 346);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.c_Done);
- this.Controls.Add(this.c_SubTask);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.c_Events);
- this.Controls.Add(this.c_TimeElapsed);
- this.Controls.Add(this.c_Task);
- this.Controls.Add(this.c_SubTaskPercent);
- this.Controls.Add(this.c_TaskPercent);
- this.Controls.Add(this.c_Cancel);
- this.Controls.Add(this.c_Phase);
- this.Controls.Add(this.c_SaveLog);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.MaximizeBox = false;
- this.Name = "BurnProgressForm";
- this.ShowInTaskbar = false;
- this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
- this.Text = "BurnProgress";
- this.ResumeLayout(false);
- }
- #endregion
- // This is the function for burning an image.
- //
- public void BurnImage (string sImageFilename, NERO_BURN_FLAGS burnFlags, int iSpeedInKBS, NERO_MEDIA_TYPE mediaType, System.Windows.Forms.IWin32Window owner)
- {
- try
- {
- // First subscribe to all events of interest.
- //
- SubscribeToEvents (true);
- // Now, start burning.
- //
- m_drive.BurnImage2 (sImageFilename,
- (NERO_BURN_FLAGS) ((uint) burnFlags | (uint) NERO_BURN_FLAGS.NERO_BURN_FLAG_SPEED_IN_KBS),
- iSpeedInKBS,
- mediaType);
- this.ShowDialog (owner);
- }
- catch (COMException ex)
- {
- SubscribeToEvents (false);
- MessageBox.Show (this, ex.Message);
- }
- }
- public void BurnIsoAudio (string sArtist, string sTitle, NeroISOTrack isoTrack, NeroAudioTracks audioTracks, NeroCDStamp cdStamp, NERO_BURN_FLAGS nbf, int iSpeedInKBS, NERO_MEDIA_TYPE mediaType, System.Windows.Forms.IWin32Window owner)
- {
- try
- {
- // First subscribe to all events of interest.
- //首先订阅感兴趣的所有事件。
- //
- SubscribeToEvents (true);
- // If the iso track passed in has neither files nor folders,
- // don't use it.
- //
- if (isoTrack.RootFolder.Files.Count == 0 &&
- isoTrack.RootFolder.Folders.Count == 0)
- {
- isoTrack = null;
- }
- // Just pass on all the gathered parameters.
- //
- m_drive.BurnIsoAudioCD (sArtist, sTitle, false,
- isoTrack, audioTracks, cdStamp,
- (NERO_BURN_FLAGS) ((uint) nbf | (uint) NERO_BURN_FLAGS.NERO_BURN_FLAG_SPEED_IN_KBS),
- iSpeedInKBS,
- mediaType);
- this.ShowDialog (owner);
- }
- catch (COMException ex)
- {
- SubscribeToEvents (false);
- MessageBox.Show (this, ex.Message);
- }
- }
- private void m_drive_OnDoneBurn(ref NERO_BURN_ERROR StatusCode)
- {
- // When burning is over, make sure to unsubscribe from all
- // events.
- //
- SubscribeToEvents (false);
- // Show the appropriate message for success and failure.
- //
- if (StatusCode == NERO_BURN_ERROR.NERO_BURN_OK)
- {
- MessageBox.Show (this, "Burn process completed successfully!");
- }
- else
- {
- MessageBox.Show (this, "Burn process failed!\n" + StatusCode.ToString ());
- }
- // Disable the Cancel button and enable the Done
- // button.
- //
- c_Cancel.Enabled = false;
- c_Done.Enabled = true;
- c_SaveLog.Enabled = true;
- }
- private void c_Cancel_Click(object sender, System.EventArgs e)
- {
- // When a Cancel button is clicked, make sure to abort.
- //
- m_bAborted = true;
- m_nero.Abort ();
- }
- private void SubscribeToEvents (bool bSubscribe)
- {
- if (bSubscribe)
- {
- // Subscribe to NeroDrive events.
- //
- m_evOnDoneBurn = new _INeroDriveEvents_OnDoneBurnEventHandler(m_drive_OnDoneBurn);
- m_drive.OnDoneBurn += m_evOnDoneBurn;
- m_evOnProgress = new _INeroDriveEvents_OnProgressEventHandler(m_drive_OnProgress);
- m_drive.OnProgress += m_evOnProgress;
- m_evOnSubTaskProgress = new _INeroDriveEvents_OnSubTaskProgressEventHandler(m_drive_OnSubTaskProgress);
- m_drive.OnSubTaskProgress += m_evOnSubTaskProgress;
- m_evOnAborted = new _INeroDriveEvents_OnAbortedEventHandler(m_drive_OnAborted);
- m_drive.OnAborted += m_evOnAborted;
- m_evOnAddLogLine = new _INeroDriveEvents_OnAddLogLineEventHandler(m_drive_OnAddLogLine);
- m_drive.OnAddLogLine += m_evOnAddLogLine;
- m_evOnSetPhase = new _INeroDriveEvents_OnSetPhaseEventHandler(m_drive_OnSetPhase);
- m_drive.OnSetPhase += m_evOnSetPhase;
- m_evOnDisableAbort = new _INeroDriveEvents_OnDisableAbortEventHandler(m_drive_OnDisableAbort);
- m_drive.OnDisableAbort += m_evOnDisableAbort;
- // Subscribe to Nero events.
- //
- m_evOnFileSelImage = new _INeroEvents_OnFileSelImageEventHandler(m_nero_OnFileSelImage);
- m_nero.OnFileSelImage += m_evOnFileSelImage;
- m_evOnWaitCD = new _INeroEvents_OnWaitCDEventHandler(m_nero_OnWaitCD);
- m_nero.OnWaitCD += m_evOnWaitCD;
- m_evOnWaitCDDone = new _INeroEvents_OnWaitCDDoneEventHandler(m_nero_OnWaitCDDone);
- m_nero.OnWaitCDDone += m_evOnWaitCDDone;
- m_evOnWaitCDMediaInfo = new _INeroEvents_OnWaitCDMediaInfoEventHandler(m_nero_OnWaitCDMediaInfo);
- m_nero.OnWaitCDMediaInfo += m_evOnWaitCDMediaInfo;
- m_evOnNonEmptyCDRW = new _INeroEvents_OnNonEmptyCDRWEventHandler(m_nero_OnNonEmptyCDRW);
- m_nero.OnNonEmptyCDRW += m_evOnNonEmptyCDRW;
- // Start the timer that is responsible for displaying
- // the elapsed time during burning.
- //
- m_timeStart = DateTime.Now;
- m_timer = new System.Timers.Timer (500);
- m_timer.Elapsed += new System.Timers.ElapsedEventHandler(m_timer_Elapsed);
- m_timer.Start ();
- }
- else
- {
- // Stop the elapsed time timer.
- //
- m_timer.Stop ();
- // Unsubscribe from NeroDrive events.
- //
- m_drive.OnDoneBurn -= m_evOnDoneBurn;
- m_drive.OnProgress -= m_evOnProgress;
- m_drive.OnSubTaskProgress -= m_evOnSubTaskProgress;
- m_drive.OnAborted -= m_evOnAborted;
- m_drive.OnAddLogLine -= m_evOnAddLogLine;
- m_drive.OnSetPhase -= m_evOnSetPhase;
- m_drive.OnDisableAbort -= m_evOnDisableAbort;
- // Unsubscribe from Nero events.
- //
- m_nero.OnFileSelImage -= m_evOnFileSelImage;
- m_nero.OnWaitCD -= m_evOnWaitCD;
- m_nero.OnWaitCDDone -= m_evOnWaitCDDone;
- m_nero.OnWaitCDMediaInfo -= m_evOnWaitCDMediaInfo;
- m_nero.OnNonEmptyCDRW -= m_evOnNonEmptyCDRW;
- }
- }
- /// <summary>
- /// 映像刻录时设置文件保存位置
- /// </summary>
- /// <param name="Filename"></param>
- private void m_nero_OnFileSelImage(ref string Filename)
- {
- // This events asks us to supply the image filename to
- // save to if the chose recorder is "Image Recorder".
- // //这个事件要求我们提供的图像文件名//保存到如果选择的刻录机“映像刻录”。
- SaveFileDialog dlg = new SaveFileDialog ();
- dlg.DefaultExt = ".nrg";
- dlg.Filter = "NRG files (*.nrg)|*.nrg|All files (*.*)|*.*";
- // To cancel, assign empty string.
- //
- if (DialogResult.OK == dlg.ShowDialog (this))
- {
- Filename = dlg.FileName;
- }
- else
- {
- Filename = "";
- }
- }
- private void m_drive_OnProgress(ref int ProgressInPercent, ref bool Abort)
- {
- // This events gives us an opportunity to show progress
- // as well as abort if needed.
- //
- Abort = m_bAborted;
- c_Task.Value = ProgressInPercent;
- c_TaskPercent.Text = ProgressInPercent.ToString () + "%";
- }
- private void m_drive_OnSubTaskProgress(ref int ProgressInPercent, ref bool Abort)
- {
- // This event gives us the other task's progress.
- //
- Abort = m_bAborted;
- c_SubTask.Value = ProgressInPercent;
- c_SubTaskPercent.Text = ProgressInPercent.ToString () + "%";
- }
- /// <summary>
- /// 一个中止
- /// </summary>
- /// <param name="Abort"></param>
- private void m_drive_OnAborted(ref bool Abort)
- {
- // This is a general aborted event that is called
- // more frequently than other events that might
- // also give us a chance to abort.
- //
- Abort = m_bAborted;
- }
- private void m_drive_OnAddLogLine(ref NERO_TEXT_TYPE TextType, ref string Text)
- {
- // This one informs us of the important events during
- // the burn process. We simply add a line to the list
- // view with the current time beside it.
- //
- DateTime time = DateTime.Now;
-
- ListViewItem lvi = c_Events.Items.Add (time.ToLongTimeString ());
- lvi.SubItems.Add (Text);
- }
- private void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
- {
- // When the timer ticks, we should update the elapsed
- // time.
- //
- TimeSpan ts = System.DateTime.Now - m_timeStart;
-
- if (this.InvokeRequired)
- {
- this.Invoke(new UpdateControl(delegate()
- {
- c_TimeElapsed.Text = ts.Hours.ToString("00") + ":" + ts.Minutes.ToString("00") + ":" + ts.Seconds.ToString("00");
- }));
- }
- else
- {
- c_TimeElapsed.Text = ts.Hours.ToString("00") + ":" + ts.Minutes.ToString("00") + ":" + ts.Seconds.ToString("00");
- }
- }
- private void m_drive_OnSetPhase(ref string Text)
- {
- // When a new phase comes in, display it.
- //
-
- c_Phase.Text = Text;
-
- }
- private void m_nero_OnWaitCD(ref NERO_WAITCD_TYPE WaitCD, ref string WaitCDLocalizedText)
- {
- // Ok, so now we need to wait on a disc. Let's pass
- // the WaitCD form the text and show it (if not already
- // shown). Make sure to disable the parent (this window)
- // so that a modal behavior is simulated.
- //
- m_frmWaitCD.c_WaitCDText.Text = WaitCDLocalizedText;
- m_frmWaitCD.Owner = this;
- m_frmWaitCD.Show ();
- this.Enabled = false;
- }
- private void m_nero_OnWaitCDDone()
- {
- // When waiting on a disc is done, make sure to
- // enable us and hide the WaitCD form.
- //
- this.Enabled = true;
- m_frmWaitCD.Hide ();
- }
- private void m_nero_OnWaitCDMediaInfo(ref NERO_MEDIA_TYPE LastDetectedMedia, ref string LastDetectedMediaName, ref NERO_MEDIA_TYPE RequestedMedia, ref string RequestedMediaName)
- {
- // When this event is fired, we need to update the
- // information on the WaitCD form. Also, sometimes
- // this event can come before the actual OnWaitCD so
- // make sure that either of them is prepared to
- // show the WaitCD form.
- //
- m_frmWaitCD.c_LastDetectedMedia.Text = LastDetectedMediaName;
- m_frmWaitCD.c_RequestedMedia.Text = RequestedMediaName;
- m_frmWaitCD.Owner = this;
- m_frmWaitCD.Show ();
- this.Enabled = false;
- }
- private void m_frmWaitCD_OnCancel(object sender, EventArgs e)
- {
- // This handler is called when WaitCD form's Cancel button is
- // clicked. Make sure to abort.
- //
- m_bAborted = true;
- m_nero.Abort ();
- }
- private void m_nero_OnNonEmptyCDRW(ref NERO_RESPONSE Response)
- {
- // This event will be fired only if the proper conditions
- // are met AND if NERO_BURN_FLAGS.NERO_BURN_FLAG_DETECT_NON_EMPTY_CDRW
- // was specified to the burn fucntion. Ask if we should erase
- // the rewritable.
- //
- if (DialogResult.Yes != MessageBox.Show (this, "The rewritable disc is not empty. It needs to be erased in order to continue. Do you want to erase the disc?", "Erase?", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
- {
- // If the answer was NO, ask for a new disc.
- //
- Response = NERO_RESPONSE.NERO_RETURN_RESTART;
- }
- else
- {
- // If YES, then do erase the disc and continue burning
- // afterwards.
- //
- EraseProgressForm frm = new EraseProgressForm (m_drive, true, false);
- frm.ShowDialog (this);
- Response = NERO_RESPONSE.NERO_RETURN_CONTINUE;
- }
- }
- private void m_drive_OnDisableAbort(ref bool EnableAbort)
- {
- // This event will be fired at appropriate moments
- // only if NERO_BURN_FLAGS.NERO_BURN_FLAG_DISABLE_ABORT
- // was specified to the burning function. Make sure to
- // update the state of the Cancel button accordingly.
- //
- c_Cancel.Enabled = EnableAbort;
- }
- // This function burns a copy of a disc in source drive.
- //
- public void BurnDiscCopy (NeroDrive sourceDrive, bool bOnTheFly, string sImageFilepath, bool bDeleteImage, int iReadSpeed, int iNumberOfRetries, bool bIgnoreDataReadErrors, bool bIgnoreAudioReadErrors, bool bReadISRCAndMediaCatalogNumber, bool bRAWReadMode, NERO_BURN_FLAGS burnFlags, int iWriteSpeed, NERO_MEDIA_TYPE mediaType, System.Windows.Forms.IWin32Window owner)
- {
- try
- {
- // Subscribe to events and then pass all parameters to
- // the burning function.
- //
- SubscribeToEvents (true);
- m_drive.BurnDiscCopy (sourceDrive,
- bOnTheFly,
- sImageFilepath,
- bDeleteImage,
- iReadSpeed,
- iNumberOfRetries,
- bIgnoreDataReadErrors,
- bIgnoreAudioReadErrors,
- bReadISRCAndMediaCatalogNumber,
- bRAWReadMode,
- burnFlags,
- iWriteSpeed,
- mediaType);
- this.ShowDialog (owner);
- }
- catch (COMException ex)
- {
- SubscribeToEvents (false);
- MessageBox.Show (this, ex.Message);
- }
- }
- private void c_SaveLog_Click(object sender, System.EventArgs e)
- {
- // Ask for a filename to save to and then write the whole
- // log to the file.
- //
- SaveFileDialog dlg = new SaveFileDialog ();
- dlg.DefaultExt = ".log";
- dlg.Filter = "Log files (*.log)|*.log|All files (*.*)|*.*";
- if (DialogResult.OK == dlg.ShowDialog (this))
- {
- System.IO.StreamWriter fs = new System.IO.StreamWriter (dlg.FileName);
- fs.Write (m_nero.ErrorLog);
- }
- }
- public void BurnNeroBurnContext (NeroVisionAPI.INeroBurnContext pBurnContext, NERO_BURN_FLAGS burnFlags, int iWriteSpeed, System.Windows.Forms.IWin32Window owner)
- {
- try
- {
- // Subscribe to events and then pass all parameters to
- // the burning function.
- //
- SubscribeToEvents (true);
- m_drive.BurnNVAPI (pBurnContext,
- burnFlags,
- iWriteSpeed);
- this.ShowDialog (owner);
- }
- catch (COMException ex)
- {
- SubscribeToEvents (false);
- MessageBox.Show (this, ex.Message);
- }
- }
- }
- }
|