home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 72 / IOPROG_72.ISO / soft / c++ / NCTDiscWriter2.exe / {app} / MS VB.Net Samples / TestVBNETDataCDWriter / frmWrite.vb < prev    next >
Encoding:
Text File  |  2003-04-08  |  24.0 KB  |  609 lines

  1. Public Class frmWrite
  2.     Inherits System.Windows.Forms.Form
  3.     Dim WriteInProgress As Boolean
  4.     Dim writeSpeed As Integer
  5.     Dim speed As Integer
  6.     Public frm As Form1
  7.  
  8. #Region " Windows Form Designer generated code "
  9.  
  10.     Public Sub New()
  11.         MyBase.New()
  12.  
  13.         'This call is required by the Windows Form Designer.
  14.         InitializeComponent()
  15.  
  16.         'Add any initialization after the InitializeComponent() call
  17.  
  18.     End Sub
  19.  
  20.     'Form overrides dispose to clean up the component list.
  21.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  22.         If disposing Then
  23.             If Not (components Is Nothing) Then
  24.                 components.Dispose()
  25.             End If
  26.         End If
  27.         MyBase.Dispose(disposing)
  28.     End Sub
  29.  
  30.     'Required by the Windows Form Designer
  31.     Private components As System.ComponentModel.IContainer
  32.  
  33.     'NOTE: The following procedure is required by the Windows Form Designer
  34.     'It can be modified using the Windows Form Designer.  
  35.     'Do not modify it using the code editor.
  36.     Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
  37.     Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
  38.     Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox
  39.     Friend WithEvents Label1 As System.Windows.Forms.Label
  40.     Friend WithEvents speedCombo As System.Windows.Forms.ComboBox
  41.     Friend WithEvents TestWriteCheck As System.Windows.Forms.CheckBox
  42.     Friend WithEvents FinilizeCDCheck As System.Windows.Forms.CheckBox
  43.     Friend WithEvents Label2 As System.Windows.Forms.Label
  44.     Friend WithEvents OptimalSpeedCheck As System.Windows.Forms.CheckBox
  45.     Friend WithEvents ProgressBar3 As System.Windows.Forms.ProgressBar
  46.     Friend WithEvents optJoliet As System.Windows.Forms.RadioButton
  47.     Friend WithEvents optISOLevel1 As System.Windows.Forms.RadioButton
  48.     Friend WithEvents optISOLevel2 As System.Windows.Forms.RadioButton
  49.     Friend WithEvents Label3 As System.Windows.Forms.Label
  50.     Friend WithEvents txtDiscLabel As System.Windows.Forms.TextBox
  51.     Friend WithEvents optDataMode1 As System.Windows.Forms.RadioButton
  52.     Friend WithEvents optDataMode2 As System.Windows.Forms.RadioButton
  53.     Friend WithEvents frmProgress As System.Windows.Forms.GroupBox
  54.     Friend WithEvents WriteBtn As System.Windows.Forms.Button
  55.     Friend WithEvents CancelBtn As System.Windows.Forms.Button
  56.     Friend WithEvents Label4 As System.Windows.Forms.Label
  57.     Friend WithEvents Label5 As System.Windows.Forms.Label
  58.     Friend WithEvents Label6 As System.Windows.Forms.Label
  59.     Friend WithEvents Label7 As System.Windows.Forms.Label
  60.     Friend WithEvents driveStatusLbl As System.Windows.Forms.Label
  61.     Friend WithEvents driveBufferLbl As System.Windows.Forms.Label
  62.     Friend WithEvents driveEstBlocksLbl As System.Windows.Forms.Label
  63.     Friend WithEvents driveWritedBlocksLbl As System.Windows.Forms.Label
  64.     Friend WithEvents ProgressBar2 As System.Windows.Forms.ProgressBar
  65.     Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar
  66.     Friend WithEvents ProgressLbl As System.Windows.Forms.Label
  67.     Friend WithEvents Label9 As System.Windows.Forms.Label
  68.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  69.         Me.GroupBox1 = New System.Windows.Forms.GroupBox()
  70.         Me.ProgressBar3 = New System.Windows.Forms.ProgressBar()
  71.         Me.OptimalSpeedCheck = New System.Windows.Forms.CheckBox()
  72.         Me.Label2 = New System.Windows.Forms.Label()
  73.         Me.FinilizeCDCheck = New System.Windows.Forms.CheckBox()
  74.         Me.TestWriteCheck = New System.Windows.Forms.CheckBox()
  75.         Me.speedCombo = New System.Windows.Forms.ComboBox()
  76.         Me.Label1 = New System.Windows.Forms.Label()
  77.         Me.GroupBox2 = New System.Windows.Forms.GroupBox()
  78.         Me.txtDiscLabel = New System.Windows.Forms.TextBox()
  79.         Me.Label3 = New System.Windows.Forms.Label()
  80.         Me.optISOLevel2 = New System.Windows.Forms.RadioButton()
  81.         Me.optISOLevel1 = New System.Windows.Forms.RadioButton()
  82.         Me.optJoliet = New System.Windows.Forms.RadioButton()
  83.         Me.GroupBox3 = New System.Windows.Forms.GroupBox()
  84.         Me.optDataMode2 = New System.Windows.Forms.RadioButton()
  85.         Me.optDataMode1 = New System.Windows.Forms.RadioButton()
  86.         Me.frmProgress = New System.Windows.Forms.GroupBox()
  87.         Me.Label9 = New System.Windows.Forms.Label()
  88.         Me.ProgressLbl = New System.Windows.Forms.Label()
  89.         Me.ProgressBar1 = New System.Windows.Forms.ProgressBar()
  90.         Me.ProgressBar2 = New System.Windows.Forms.ProgressBar()
  91.         Me.driveWritedBlocksLbl = New System.Windows.Forms.Label()
  92.         Me.driveEstBlocksLbl = New System.Windows.Forms.Label()
  93.         Me.driveBufferLbl = New System.Windows.Forms.Label()
  94.         Me.driveStatusLbl = New System.Windows.Forms.Label()
  95.         Me.Label7 = New System.Windows.Forms.Label()
  96.         Me.Label6 = New System.Windows.Forms.Label()
  97.         Me.Label5 = New System.Windows.Forms.Label()
  98.         Me.Label4 = New System.Windows.Forms.Label()
  99.         Me.WriteBtn = New System.Windows.Forms.Button()
  100.         Me.CancelBtn = New System.Windows.Forms.Button()
  101.         Me.GroupBox1.SuspendLayout()
  102.         Me.GroupBox2.SuspendLayout()
  103.         Me.GroupBox3.SuspendLayout()
  104.         Me.frmProgress.SuspendLayout()
  105.         Me.SuspendLayout()
  106.         '
  107.         'GroupBox1
  108.         '
  109.         Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.ProgressBar3, Me.OptimalSpeedCheck, Me.Label2, Me.FinilizeCDCheck, Me.TestWriteCheck, Me.speedCombo, Me.Label1})
  110.         Me.GroupBox1.Location = New System.Drawing.Point(6, 6)
  111.         Me.GroupBox1.Name = "GroupBox1"
  112.         Me.GroupBox1.Size = New System.Drawing.Size(168, 205)
  113.         Me.GroupBox1.TabIndex = 0
  114.         Me.GroupBox1.TabStop = False
  115.         Me.GroupBox1.Text = "Burn Options"
  116.         '
  117.         'ProgressBar3
  118.         '
  119.         Me.ProgressBar3.Location = New System.Drawing.Point(3, 195)
  120.         Me.ProgressBar3.Maximum = 64
  121.         Me.ProgressBar3.Minimum = 1
  122.         Me.ProgressBar3.Name = "ProgressBar3"
  123.         Me.ProgressBar3.Size = New System.Drawing.Size(164, 8)
  124.         Me.ProgressBar3.TabIndex = 6
  125.         Me.ProgressBar3.Value = 1
  126.         Me.ProgressBar3.Visible = False
  127.         '
  128.         'OptimalSpeedCheck
  129.         '
  130.         Me.OptimalSpeedCheck.Location = New System.Drawing.Point(147, 174)
  131.         Me.OptimalSpeedCheck.Name = "OptimalSpeedCheck"
  132.         Me.OptimalSpeedCheck.Size = New System.Drawing.Size(15, 14)
  133.         Me.OptimalSpeedCheck.TabIndex = 5
  134.         Me.OptimalSpeedCheck.Text = "CheckBox1"
  135.         '
  136.         'Label2
  137.         '
  138.         Me.Label2.Location = New System.Drawing.Point(11, 175)
  139.         Me.Label2.Name = "Label2"
  140.         Me.Label2.Size = New System.Drawing.Size(124, 15)
  141.         Me.Label2.TabIndex = 4
  142.         Me.Label2.Text = "Detect Speed Optimals:"
  143.         '
  144.         'FinilizeCDCheck
  145.         '
  146.         Me.FinilizeCDCheck.Location = New System.Drawing.Point(12, 98)
  147.         Me.FinilizeCDCheck.Name = "FinilizeCDCheck"
  148.         Me.FinilizeCDCheck.Size = New System.Drawing.Size(88, 20)
  149.         Me.FinilizeCDCheck.TabIndex = 3
  150.         Me.FinilizeCDCheck.Text = "Finalise Disc"
  151.         '
  152.         'TestWriteCheck
  153.         '
  154.         Me.TestWriteCheck.Location = New System.Drawing.Point(12, 74)
  155.         Me.TestWriteCheck.Name = "TestWriteCheck"
  156.         Me.TestWriteCheck.Size = New System.Drawing.Size(87, 17)
  157.         Me.TestWriteCheck.TabIndex = 2
  158.         Me.TestWriteCheck.Text = "Test Write"
  159.         '
  160.         'speedCombo
  161.         '
  162.         Me.speedCombo.Location = New System.Drawing.Point(57, 33)
  163.         Me.speedCombo.Name = "speedCombo"
  164.         Me.speedCombo.Size = New System.Drawing.Size(105, 21)
  165.         Me.speedCombo.TabIndex = 1
  166.         Me.speedCombo.Text = "Speed"
  167.         '
  168.         'Label1
  169.         '
  170.         Me.Label1.Location = New System.Drawing.Point(13, 34)
  171.         Me.Label1.Name = "Label1"
  172.         Me.Label1.Size = New System.Drawing.Size(44, 18)
  173.         Me.Label1.TabIndex = 0
  174.         Me.Label1.Text = "Speed:"
  175.         '
  176.         'GroupBox2
  177.         '
  178.         Me.GroupBox2.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtDiscLabel, Me.Label3, Me.optISOLevel2, Me.optISOLevel1, Me.optJoliet})
  179.         Me.GroupBox2.Location = New System.Drawing.Point(175, 6)
  180.         Me.GroupBox2.Name = "GroupBox2"
  181.         Me.GroupBox2.Size = New System.Drawing.Size(332, 146)
  182.         Me.GroupBox2.TabIndex = 1
  183.         Me.GroupBox2.TabStop = False
  184.         Me.GroupBox2.Text = "Disc Compilation"
  185.         '
  186.         'txtDiscLabel
  187.         '
  188.         Me.txtDiscLabel.Location = New System.Drawing.Point(83, 113)
  189.         Me.txtDiscLabel.Name = "txtDiscLabel"
  190.         Me.txtDiscLabel.Size = New System.Drawing.Size(240, 20)
  191.         Me.txtDiscLabel.TabIndex = 4
  192.         Me.txtDiscLabel.Text = "New Disc"
  193.         Me.txtDiscLabel.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
  194.         '
  195.         'Label3
  196.         '
  197.         Me.Label3.Location = New System.Drawing.Point(14, 116)
  198.         Me.Label3.Name = "Label3"
  199.         Me.Label3.Size = New System.Drawing.Size(61, 18)
  200.         Me.Label3.TabIndex = 3
  201.         Me.Label3.Text = "Disc Label:"
  202.         '
  203.         'optISOLevel2
  204.         '
  205.         Me.optISOLevel2.Location = New System.Drawing.Point(14, 81)
  206.         Me.optISOLevel2.Name = "optISOLevel2"
  207.         Me.optISOLevel2.Size = New System.Drawing.Size(308, 19)
  208.         Me.optISOLevel2.TabIndex = 2
  209.         Me.optISOLevel2.Text = "ISO Level 2   (Maximum 31 chars)"
  210.         '
  211.         'optISOLevel1
  212.         '
  213.         Me.optISOLevel1.Location = New System.Drawing.Point(14, 57)
  214.         Me.optISOLevel1.Name = "optISOLevel1"
  215.         Me.optISOLevel1.Size = New System.Drawing.Size(307, 17)
  216.         Me.optISOLevel1.TabIndex = 1
  217.         Me.optISOLevel1.Text = "ISO Level 1   (Maximum 11 =   8 + 3 chars)"
  218.         '
  219.         'optJoliet
  220.         '
  221.         Me.optJoliet.Checked = True
  222.         Me.optJoliet.Location = New System.Drawing.Point(13, 33)
  223.         Me.optJoliet.Name = "optJoliet"
  224.         Me.optJoliet.Size = New System.Drawing.Size(309, 16)
  225.         Me.optJoliet.TabIndex = 0
  226.         Me.optJoliet.TabStop = True
  227.         Me.optJoliet.Text = "Joliet              (Multilanguage Support)"
  228.         '
  229.         'GroupBox3
  230.         '
  231.         Me.GroupBox3.Controls.AddRange(New System.Windows.Forms.Control() {Me.optDataMode2, Me.optDataMode1})
  232.         Me.GroupBox3.Location = New System.Drawing.Point(176, 159)
  233.         Me.GroupBox3.Name = "GroupBox3"
  234.         Me.GroupBox3.Size = New System.Drawing.Size(335, 52)
  235.         Me.GroupBox3.TabIndex = 2
  236.         Me.GroupBox3.TabStop = False
  237.         Me.GroupBox3.Text = "Format"
  238.         '
  239.         'optDataMode2
  240.         '
  241.         Me.optDataMode2.Location = New System.Drawing.Point(183, 26)
  242.         Me.optDataMode2.Name = "optDataMode2"
  243.         Me.optDataMode2.Size = New System.Drawing.Size(143, 16)
  244.         Me.optDataMode2.TabIndex = 1
  245.         Me.optDataMode2.Text = "Data Mode 2/XA"
  246.         '
  247.         'optDataMode1
  248.         '
  249.         Me.optDataMode1.Checked = True
  250.         Me.optDataMode1.Location = New System.Drawing.Point(17, 24)
  251.         Me.optDataMode1.Name = "optDataMode1"
  252.         Me.optDataMode1.Size = New System.Drawing.Size(118, 18)
  253.         Me.optDataMode1.TabIndex = 0
  254.         Me.optDataMode1.TabStop = True
  255.         Me.optDataMode1.Text = "Data Mode 1"
  256.         '
  257.         'frmProgress
  258.         '
  259.         Me.frmProgress.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label9, Me.ProgressLbl, Me.ProgressBar1, Me.ProgressBar2, Me.driveWritedBlocksLbl, Me.driveEstBlocksLbl, Me.driveBufferLbl, Me.driveStatusLbl, Me.Label7, Me.Label6, Me.Label5, Me.Label4})
  260.         Me.frmProgress.Location = New System.Drawing.Point(6, 221)
  261.         Me.frmProgress.Name = "frmProgress"
  262.         Me.frmProgress.Size = New System.Drawing.Size(622, 116)
  263.         Me.frmProgress.TabIndex = 3
  264.         Me.frmProgress.TabStop = False
  265.         Me.frmProgress.Text = "Progress"
  266.         '
  267.         'Label9
  268.         '
  269.         Me.Label9.Location = New System.Drawing.Point(12, 92)
  270.         Me.Label9.Name = "Label9"
  271.         Me.Label9.Size = New System.Drawing.Size(97, 16)
  272.         Me.Label9.TabIndex = 11
  273.         Me.Label9.Text = "Disk Total:"
  274.         '
  275.         'ProgressLbl
  276.         '
  277.         Me.ProgressLbl.Location = New System.Drawing.Point(12, 74)
  278.         Me.ProgressLbl.Name = "ProgressLbl"
  279.         Me.ProgressLbl.Size = New System.Drawing.Size(97, 16)
  280.         Me.ProgressLbl.TabIndex = 10
  281.         Me.ProgressLbl.Text = "Write:"
  282.         '
  283.         'ProgressBar1
  284.         '
  285.         Me.ProgressBar1.Location = New System.Drawing.Point(121, 95)
  286.         Me.ProgressBar1.Name = "ProgressBar1"
  287.         Me.ProgressBar1.Size = New System.Drawing.Size(495, 15)
  288.         Me.ProgressBar1.TabIndex = 9
  289.         '
  290.         'ProgressBar2
  291.         '
  292.         Me.ProgressBar2.Location = New System.Drawing.Point(121, 74)
  293.         Me.ProgressBar2.Name = "ProgressBar2"
  294.         Me.ProgressBar2.Size = New System.Drawing.Size(494, 15)
  295.         Me.ProgressBar2.TabIndex = 8
  296.         '
  297.         'driveWritedBlocksLbl
  298.         '
  299.         Me.driveWritedBlocksLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
  300.         Me.driveWritedBlocksLbl.Location = New System.Drawing.Point(510, 46)
  301.         Me.driveWritedBlocksLbl.Name = "driveWritedBlocksLbl"
  302.         Me.driveWritedBlocksLbl.Size = New System.Drawing.Size(104, 18)
  303.         Me.driveWritedBlocksLbl.TabIndex = 7
  304.         Me.driveWritedBlocksLbl.Text = "0"
  305.         Me.driveWritedBlocksLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
  306.         '
  307.         'driveEstBlocksLbl
  308.         '
  309.         Me.driveEstBlocksLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
  310.         Me.driveEstBlocksLbl.Location = New System.Drawing.Point(510, 22)
  311.         Me.driveEstBlocksLbl.Name = "driveEstBlocksLbl"
  312.         Me.driveEstBlocksLbl.Size = New System.Drawing.Size(104, 18)
  313.         Me.driveEstBlocksLbl.TabIndex = 6
  314.         Me.driveEstBlocksLbl.Text = "0"
  315.         Me.driveEstBlocksLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
  316.         '
  317.         'driveBufferLbl
  318.         '
  319.         Me.driveBufferLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
  320.         Me.driveBufferLbl.Location = New System.Drawing.Point(120, 48)
  321.         Me.driveBufferLbl.Name = "driveBufferLbl"
  322.         Me.driveBufferLbl.Size = New System.Drawing.Size(104, 18)
  323.         Me.driveBufferLbl.TabIndex = 5
  324.         Me.driveBufferLbl.Text = "0"
  325.         Me.driveBufferLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
  326.         '
  327.         'driveStatusLbl
  328.         '
  329.         Me.driveStatusLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
  330.         Me.driveStatusLbl.Location = New System.Drawing.Point(120, 24)
  331.         Me.driveStatusLbl.Name = "driveStatusLbl"
  332.         Me.driveStatusLbl.Size = New System.Drawing.Size(104, 18)
  333.         Me.driveStatusLbl.TabIndex = 4
  334.         Me.driveStatusLbl.Text = "Idle"
  335.         Me.driveStatusLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
  336.         '
  337.         'Label7
  338.         '
  339.         Me.Label7.Location = New System.Drawing.Point(397, 50)
  340.         Me.Label7.Name = "Label7"
  341.         Me.Label7.Size = New System.Drawing.Size(106, 16)
  342.         Me.Label7.TabIndex = 3
  343.         Me.Label7.Text = "Current Block:"
  344.         '
  345.         'Label6
  346.         '
  347.         Me.Label6.Location = New System.Drawing.Point(397, 24)
  348.         Me.Label6.Name = "Label6"
  349.         Me.Label6.Size = New System.Drawing.Size(105, 16)
  350.         Me.Label6.TabIndex = 2
  351.         Me.Label6.Text = "Estimated Blocks:"
  352.         '
  353.         'Label5
  354.         '
  355.         Me.Label5.Location = New System.Drawing.Point(11, 46)
  356.         Me.Label5.Name = "Label5"
  357.         Me.Label5.Size = New System.Drawing.Size(97, 18)
  358.         Me.Label5.TabIndex = 1
  359.         Me.Label5.Text = "Buffer (%):"
  360.         '
  361.         'Label4
  362.         '
  363.         Me.Label4.Location = New System.Drawing.Point(11, 22)
  364.         Me.Label4.Name = "Label4"
  365.         Me.Label4.Size = New System.Drawing.Size(97, 16)
  366.         Me.Label4.TabIndex = 0
  367.         Me.Label4.Text = "Drive Status:"
  368.         '
  369.         'WriteBtn
  370.         '
  371.         Me.WriteBtn.Location = New System.Drawing.Point(520, 9)
  372.         Me.WriteBtn.Name = "WriteBtn"
  373.         Me.WriteBtn.Size = New System.Drawing.Size(96, 23)
  374.         Me.WriteBtn.TabIndex = 4
  375.         Me.WriteBtn.Text = "Write"
  376.         '
  377.         'CancelBtn
  378.         '
  379.         Me.CancelBtn.Location = New System.Drawing.Point(520, 37)
  380.         Me.CancelBtn.Name = "CancelBtn"
  381.         Me.CancelBtn.Size = New System.Drawing.Size(96, 23)
  382.         Me.CancelBtn.TabIndex = 5
  383.         Me.CancelBtn.Text = "Cancel"
  384.         '
  385.         'frmWrite
  386.         '
  387.         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
  388.         Me.ClientSize = New System.Drawing.Size(631, 342)
  389.         Me.ControlBox = False
  390.         Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.CancelBtn, Me.WriteBtn, Me.frmProgress, Me.GroupBox3, Me.GroupBox2, Me.GroupBox1})
  391.         Me.Name = "frmWrite"
  392.         Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
  393.         Me.Text = "frmWrite"
  394.         Me.GroupBox1.ResumeLayout(False)
  395.         Me.GroupBox2.ResumeLayout(False)
  396.         Me.GroupBox3.ResumeLayout(False)
  397.         Me.frmProgress.ResumeLayout(False)
  398.         Me.ResumeLayout(False)
  399.  
  400.     End Sub
  401.  
  402. #End Region
  403.  
  404.     Private Sub frmWrite_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  405.         frm = Me.Owner
  406.         frm.frmWrite1 = Me
  407.         writeSpeed = frm.DataCDWriter1.driveMaxWSpeed
  408.         WriteInProgress = False
  409.         LoadSpeedCombo()
  410.     End Sub
  411.  
  412.     Private Sub optISOLevel1_Click()
  413.         frm.DataCDWriter1.volumeFileSystem = NCTDISCWRITERLib.FILE_SYSTEM.ISO_LEVEL_1
  414.     End Sub
  415.  
  416.     Private Sub optISOLevel2_Click()
  417.         frm.DataCDWriter1.volumeFileSystem = NCTDISCWRITERLib.FILE_SYSTEM.ISO_LEVEL_2
  418.     End Sub
  419.  
  420.     Private Sub optJoliet_Click()
  421.         frm.DataCDWriter1.volumeFileSystem = NCTDISCWRITERLib.FILE_SYSTEM.JOLIET
  422.     End Sub
  423.  
  424.     Public Sub OperationProgress(ByVal Percent As Integer)
  425.         If frm.err = True Or WriteInProgress = False Then
  426.             driveStatusLbl.Text = "Idle"
  427.             StopWrite()
  428.             Exit Sub
  429.         End If
  430.  
  431.         Select Case frm.DataCDWriter1.driveOperation
  432.             Case NCTDISCWRITERLib.OPERATION.WRITE_DISC
  433.                 Select Case frm.DataCDWriter1.writePhase
  434.                     Case NCTDISCWRITERLib.WRITE_PHASE.FILL_BUFFER
  435.                         driveStatusLbl.Text = "Fill Buffer..."
  436.                     Case NCTDISCWRITERLib.WRITE_PHASE.WRITE_TRACK
  437.                         driveStatusLbl.Text = "Write Track..."
  438.                     Case NCTDISCWRITERLib.WRITE_PHASE.CLOSE_TRACK
  439.                         driveStatusLbl.Text = "Close Track..."
  440.                 End Select
  441.                 ProgressBar1.Value = Percent * 2 / 3
  442.                 ProgressBar2.Value = Percent
  443.                 driveEstBlocksLbl.Text = frm.DataCDWriter1.writeTotalBlocks
  444.                 driveWritedBlocksLbl.Text = frm.DataCDWriter1.writeCurrentBlock
  445.                 driveBufferLbl.Text = frm.DataCDWriter1.driveBufferUsagePercent
  446.             Case NCTDISCWRITERLib.OPERATION.FINALIZE_DISC
  447.                 driveStatusLbl.Text = "Finalise Disc..."
  448.                 ProgressLbl.Text = "Finalise:"
  449.                 CancelBtn.Enabled = False
  450.                 ProgressBar1.Value = 100 * 2 / 3 + Percent / 3 - 5
  451.                 ProgressBar2.Value = Percent
  452.                 driveWritedBlocksLbl.Text = frm.DataCDWriter1.writeCurrentBlock
  453.                 If Percent = 100 Then
  454.                     ProgressBar2.Value = 100
  455.                     ProgressBar1.Value = 100
  456.                     driveStatusLbl.Text = "Idle"
  457.                     MsgBox("Write Complete!")
  458.                     StopWrite()
  459.                     Exit Sub
  460.                 End If
  461.         End Select
  462.  
  463.         Application.DoEvents()
  464.     End Sub
  465.     Private Sub StopWrite()
  466.         ProgressLbl.Text = "Write Tracks:"
  467.         driveEstBlocksLbl.Text = 0
  468.         driveWritedBlocksLbl.Text = 0
  469.         driveBufferLbl.Text = 0
  470.         ProgressBar1.Value = 0
  471.         ProgressBar2.Value = 0
  472.         frm.RefreshDiskInfo()
  473.         WriteInProgress = False
  474.         WriteBtn.Enabled = True
  475.         CancelBtn.Enabled = True
  476.         frm.err = False
  477.         Active()
  478.     End Sub
  479.  
  480.     Private Sub speedCombo_Click()
  481.         Dim idx As Integer
  482.  
  483.         idx = speedCombo.SelectedIndex
  484.         speed = speedCombo.Items.Item(idx)
  485.         frm.DataCDWriter1.writeSpeed = speed
  486.     End Sub
  487.  
  488.     Private Sub Inactive()
  489.         OptimalSpeedCheck.Enabled = False
  490.         speedCombo.Enabled = False
  491.         WriteBtn.Enabled = False
  492.         optJoliet.Enabled = False
  493.         optISOLevel1.Enabled = False
  494.         optISOLevel2.Enabled = False
  495.         txtDiscLabel.Enabled = False
  496.         TestWriteCheck.Enabled = False
  497.         FinilizeCDCheck.Enabled = False
  498.         optDataMode1.Enabled = False
  499.         optDataMode2.Enabled = False
  500.  
  501.  
  502.     End Sub
  503.  
  504.     Private Sub Active()
  505.         speedCombo.Enabled = True
  506.         WriteBtn.Enabled = True
  507.         optJoliet.Enabled = True
  508.         optISOLevel1.Enabled = True
  509.         optISOLevel2.Enabled = True
  510.         txtDiscLabel.Enabled = True
  511.         TestWriteCheck.Enabled = True
  512.         FinilizeCDCheck.Enabled = True
  513.         optDataMode1.Enabled = True
  514.         optDataMode2.Enabled = True
  515.         OptimalSpeedCheck.Enabled = True
  516.  
  517.     End Sub
  518.  
  519.     Private Sub CancelBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancelBtn.Click
  520.         If WriteInProgress = True Then
  521.             frm.DataCDWriter1.StopWrite()
  522.             driveStatusLbl.Text = "Idle"
  523.             StopWrite()
  524.         Else
  525.             Me.Hide()
  526.         End If
  527.     End Sub
  528.  
  529.     Public Sub LoadSpeedCombo()
  530.  
  531.         speedCombo.Items.Clear()
  532.         ProgressBar3.Visible = True
  533.  
  534.         If OptimalSpeedCheck.Checked <> 0 Then
  535.             For speed = 64 To 1 Step -1
  536.                 frm.DataCDWriter1.writeSpeed = speed
  537.                 ProgressBar3.Value = 65 - speed
  538.                 If frm.DataCDWriter1.writeSpeed = speed Then
  539.                     speedCombo.Items.Add(speed)
  540.                 End If
  541.             Next
  542.         Else
  543.             For speed = frm.DataCDWriter1.driveMaxWSpeed To 1 Step -2
  544.                 speedCombo.Items.Add(speed)
  545.             Next
  546.         End If
  547.  
  548.         If speedCombo.Items.Count() > 0 Then
  549.             speedCombo.SelectedIndex = 0
  550.         End If
  551.  
  552.         ProgressBar3.Value = 1
  553.         ProgressBar3.Visible = False
  554.  
  555.     End Sub
  556.  
  557.     Private Sub OptimalSpeedCheck_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OptimalSpeedCheck.CheckedChanged
  558.         LoadSpeedCombo()
  559.     End Sub
  560.  
  561.     Private Sub WriteBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WriteBtn.Click
  562.         Dim test As Boolean
  563.         Dim finalize As Boolean
  564.         Dim idx As Integer
  565.  
  566.         Inactive()
  567.  
  568.         idx = 0
  569.         speed = speedCombo.Items.Item(idx)
  570.         frm.DataCDWriter1.writeSpeed = speed
  571.         frm.DataCDWriter1.volumeLabel = txtDiscLabel.Text
  572.  
  573.         driveStatusLbl.Text = "Prepare..."
  574.         Me.Refresh()
  575.  
  576.         WriteBtn.Enabled = False
  577.         Me.Refresh()
  578.  
  579.         If TestWriteCheck.Checked = 0 Then
  580.             frm.DataCDWriter1.writeSimulate = False
  581.         Else
  582.             frm.DataCDWriter1.writeSimulate = True
  583.         End If
  584.         If FinilizeCDCheck.Checked = 0 Then
  585.             frm.DataCDWriter1.writeFinalizeCD = False
  586.         Else
  587.             frm.DataCDWriter1.writeFinalizeCD = True
  588.         End If
  589.  
  590.         frm.err = False
  591.         Me.Refresh()
  592.  
  593.         idx = speedCombo.SelectedIndex
  594.         speed = speedCombo.Items.Item(idx)
  595.         frm.DataCDWriter1.writeSpeed = speed
  596.  
  597.         frm.OperationProgress = False
  598.         frm.writeProgress = 0
  599.         frm.DataCDWriter1.StartWrite()
  600.         If frm.err = True Then
  601.             driveStatusLbl.Text = "Idle"
  602.             StopWrite()
  603.             frm.err = False
  604.         Else
  605.             WriteInProgress = True
  606.         End If
  607.     End Sub
  608. End Class
  609.