home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 72 / IOPROG_72.ISO / soft / c++ / NCTDiscWriter2.exe / {app} / MS C# 7.0 Samples / TestCSDataCDWriter / frmWrite.cs < prev    next >
Encoding:
Text File  |  2003-04-08  |  23.7 KB  |  714 lines

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6.  
  7. namespace DiskWriter
  8. {
  9.     /// <summary>
  10.     /// Summary description for frmWrite.
  11.     /// </summary>
  12.     public class frmWrite : System.Windows.Forms.Form
  13.     {
  14.         internal System.Windows.Forms.GroupBox GroupBox1;
  15.         internal System.Windows.Forms.ProgressBar ProgressBar3;
  16.         internal System.Windows.Forms.CheckBox OptimalSpeedCheck;
  17.         internal System.Windows.Forms.Label Label2;
  18.         internal System.Windows.Forms.CheckBox FinilizeCDCheck;
  19.         internal System.Windows.Forms.CheckBox TestWriteCheck;
  20.         internal System.Windows.Forms.ComboBox speedCombo;
  21.         internal System.Windows.Forms.Label Label1;
  22.         internal System.Windows.Forms.GroupBox GroupBox2;
  23.         internal System.Windows.Forms.TextBox txtDiscLabel;
  24.         internal System.Windows.Forms.Label Label3;
  25.         internal System.Windows.Forms.RadioButton optISOLevel2;
  26.         internal System.Windows.Forms.RadioButton optISOLevel1;
  27.         internal System.Windows.Forms.RadioButton optJoliet;
  28.         internal System.Windows.Forms.GroupBox GroupBox3;
  29.         internal System.Windows.Forms.RadioButton optDataMode2;
  30.         internal System.Windows.Forms.RadioButton optDataMode1;
  31.         internal System.Windows.Forms.Button WriteBtn;
  32.         internal System.Windows.Forms.Button CancelBtn;
  33.         internal System.Windows.Forms.GroupBox frmProgress;
  34.         internal System.Windows.Forms.Label Label9;
  35.         internal System.Windows.Forms.Label ProgressLbl;
  36.         internal System.Windows.Forms.ProgressBar ProgressBar1;
  37.         internal System.Windows.Forms.Label driveWritedBlocksLbl;
  38.         internal System.Windows.Forms.Label driveEstBlocksLbl;
  39.         internal System.Windows.Forms.Label driveBufferLbl;
  40.         internal System.Windows.Forms.Label driveStatusLbl;
  41.         internal System.Windows.Forms.Label Label7;
  42.         internal System.Windows.Forms.Label Label6;
  43.         internal System.Windows.Forms.Label Label5;
  44.         internal System.Windows.Forms.Label Label4;
  45.         /// <summary>
  46.         /// Required designer variable.
  47.         /// </summary>
  48.         /// 
  49.  
  50.         private System.ComponentModel.Container components = null;
  51.         bool WriteInProgress;
  52.         int writeSpeed;
  53.         int speed;
  54.         internal System.Windows.Forms.ProgressBar ProgressBar2;
  55.         public Form1 frm;
  56.  
  57.         public frmWrite()
  58.         {
  59.             //
  60.             // Required for Windows Form Designer support
  61.             //
  62.             InitializeComponent();
  63.  
  64.             //
  65.             // TODO: Add any constructor code after InitializeComponent call
  66.             //
  67.         }
  68.  
  69.         /// <summary>
  70.         /// Clean up any resources being used.
  71.         /// </summary>
  72.         protected override void Dispose( bool disposing )
  73.         {
  74.             if( disposing )
  75.             {
  76.                 if(components != null)
  77.                 {
  78.                     components.Dispose();
  79.                 }
  80.             }
  81.             base.Dispose( disposing );
  82.         }
  83.  
  84.         #region Windows Form Designer generated code
  85.         /// <summary>
  86.         /// Required method for Designer support - do not modify
  87.         /// the contents of this method with the code editor.
  88.         /// </summary>
  89.         private void InitializeComponent()
  90.         {
  91.             this.GroupBox1 = new System.Windows.Forms.GroupBox();
  92.             this.ProgressBar3 = new System.Windows.Forms.ProgressBar();
  93.             this.OptimalSpeedCheck = new System.Windows.Forms.CheckBox();
  94.             this.Label2 = new System.Windows.Forms.Label();
  95.             this.FinilizeCDCheck = new System.Windows.Forms.CheckBox();
  96.             this.TestWriteCheck = new System.Windows.Forms.CheckBox();
  97.             this.speedCombo = new System.Windows.Forms.ComboBox();
  98.             this.Label1 = new System.Windows.Forms.Label();
  99.             this.GroupBox2 = new System.Windows.Forms.GroupBox();
  100.             this.txtDiscLabel = new System.Windows.Forms.TextBox();
  101.             this.Label3 = new System.Windows.Forms.Label();
  102.             this.optISOLevel2 = new System.Windows.Forms.RadioButton();
  103.             this.optISOLevel1 = new System.Windows.Forms.RadioButton();
  104.             this.optJoliet = new System.Windows.Forms.RadioButton();
  105.             this.GroupBox3 = new System.Windows.Forms.GroupBox();
  106.             this.optDataMode2 = new System.Windows.Forms.RadioButton();
  107.             this.optDataMode1 = new System.Windows.Forms.RadioButton();
  108.             this.WriteBtn = new System.Windows.Forms.Button();
  109.             this.CancelBtn = new System.Windows.Forms.Button();
  110.             this.frmProgress = new System.Windows.Forms.GroupBox();
  111.             this.ProgressBar2 = new System.Windows.Forms.ProgressBar();
  112.             this.Label9 = new System.Windows.Forms.Label();
  113.             this.ProgressLbl = new System.Windows.Forms.Label();
  114.             this.ProgressBar1 = new System.Windows.Forms.ProgressBar();
  115.             this.driveWritedBlocksLbl = new System.Windows.Forms.Label();
  116.             this.driveEstBlocksLbl = new System.Windows.Forms.Label();
  117.             this.driveBufferLbl = new System.Windows.Forms.Label();
  118.             this.driveStatusLbl = new System.Windows.Forms.Label();
  119.             this.Label7 = new System.Windows.Forms.Label();
  120.             this.Label6 = new System.Windows.Forms.Label();
  121.             this.Label5 = new System.Windows.Forms.Label();
  122.             this.Label4 = new System.Windows.Forms.Label();
  123.             this.GroupBox1.SuspendLayout();
  124.             this.GroupBox2.SuspendLayout();
  125.             this.GroupBox3.SuspendLayout();
  126.             this.frmProgress.SuspendLayout();
  127.             this.SuspendLayout();
  128.             // 
  129.             // GroupBox1
  130.             // 
  131.             this.GroupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
  132.                                                                                     this.ProgressBar3,
  133.                                                                                     this.OptimalSpeedCheck,
  134.                                                                                     this.Label2,
  135.                                                                                     this.FinilizeCDCheck,
  136.                                                                                     this.TestWriteCheck,
  137.                                                                                     this.speedCombo,
  138.                                                                                     this.Label1});
  139.             this.GroupBox1.Location = new System.Drawing.Point(8, 8);
  140.             this.GroupBox1.Name = "GroupBox1";
  141.             this.GroupBox1.Size = new System.Drawing.Size(168, 205);
  142.             this.GroupBox1.TabIndex = 1;
  143.             this.GroupBox1.TabStop = false;
  144.             this.GroupBox1.Text = "Burn Options";
  145.             // 
  146.             // ProgressBar3
  147.             // 
  148.             this.ProgressBar3.Location = new System.Drawing.Point(3, 195);
  149.             this.ProgressBar3.Maximum = 64;
  150.             this.ProgressBar3.Minimum = 1;
  151.             this.ProgressBar3.Name = "ProgressBar3";
  152.             this.ProgressBar3.Size = new System.Drawing.Size(157, 8);
  153.             this.ProgressBar3.TabIndex = 6;
  154.             this.ProgressBar3.Value = 1;
  155.             this.ProgressBar3.Visible = false;
  156.             // 
  157.             // OptimalSpeedCheck
  158.             // 
  159.             this.OptimalSpeedCheck.Location = new System.Drawing.Point(147, 174);
  160.             this.OptimalSpeedCheck.Name = "OptimalSpeedCheck";
  161.             this.OptimalSpeedCheck.Size = new System.Drawing.Size(15, 14);
  162.             this.OptimalSpeedCheck.TabIndex = 5;
  163.             this.OptimalSpeedCheck.Text = "CheckBox1";
  164.             this.OptimalSpeedCheck.CheckedChanged += new System.EventHandler(this.OptimalSpeedCheck_CheckedChanged);
  165.             // 
  166.             // Label2
  167.             // 
  168.             this.Label2.Location = new System.Drawing.Point(11, 175);
  169.             this.Label2.Name = "Label2";
  170.             this.Label2.Size = new System.Drawing.Size(124, 15);
  171.             this.Label2.TabIndex = 4;
  172.             this.Label2.Text = "Detect Speed Optimals:";
  173.             // 
  174.             // FinilizeCDCheck
  175.             // 
  176.             this.FinilizeCDCheck.Location = new System.Drawing.Point(12, 98);
  177.             this.FinilizeCDCheck.Name = "FinilizeCDCheck";
  178.             this.FinilizeCDCheck.Size = new System.Drawing.Size(88, 20);
  179.             this.FinilizeCDCheck.TabIndex = 3;
  180.             this.FinilizeCDCheck.Text = "Finalise Disc";
  181.             // 
  182.             // TestWriteCheck
  183.             // 
  184.             this.TestWriteCheck.Location = new System.Drawing.Point(12, 74);
  185.             this.TestWriteCheck.Name = "TestWriteCheck";
  186.             this.TestWriteCheck.Size = new System.Drawing.Size(87, 17);
  187.             this.TestWriteCheck.TabIndex = 2;
  188.             this.TestWriteCheck.Text = "Test Write";
  189.             // 
  190.             // speedCombo
  191.             // 
  192.             this.speedCombo.Location = new System.Drawing.Point(57, 33);
  193.             this.speedCombo.Name = "speedCombo";
  194.             this.speedCombo.Size = new System.Drawing.Size(105, 21);
  195.             this.speedCombo.TabIndex = 1;
  196.             this.speedCombo.Text = "Speed";
  197.             this.speedCombo.SelectedIndexChanged += new System.EventHandler(this.speedCombo_SelectedIndexChanged);
  198.             // 
  199.             // Label1
  200.             // 
  201.             this.Label1.Location = new System.Drawing.Point(13, 34);
  202.             this.Label1.Name = "Label1";
  203.             this.Label1.Size = new System.Drawing.Size(44, 18);
  204.             this.Label1.TabIndex = 0;
  205.             this.Label1.Text = "Speed:";
  206.             // 
  207.             // GroupBox2
  208.             // 
  209.             this.GroupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
  210.                                                                                     this.txtDiscLabel,
  211.                                                                                     this.Label3,
  212.                                                                                     this.optISOLevel2,
  213.                                                                                     this.optISOLevel1,
  214.                                                                                     this.optJoliet});
  215.             this.GroupBox2.Location = new System.Drawing.Point(184, 8);
  216.             this.GroupBox2.Name = "GroupBox2";
  217.             this.GroupBox2.Size = new System.Drawing.Size(336, 146);
  218.             this.GroupBox2.TabIndex = 2;
  219.             this.GroupBox2.TabStop = false;
  220.             this.GroupBox2.Text = "Disc Compilation";
  221.             // 
  222.             // txtDiscLabel
  223.             // 
  224.             this.txtDiscLabel.Location = new System.Drawing.Point(83, 113);
  225.             this.txtDiscLabel.Name = "txtDiscLabel";
  226.             this.txtDiscLabel.Size = new System.Drawing.Size(240, 20);
  227.             this.txtDiscLabel.TabIndex = 4;
  228.             this.txtDiscLabel.Text = "New Disc";
  229.             this.txtDiscLabel.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  230.             // 
  231.             // Label3
  232.             // 
  233.             this.Label3.Location = new System.Drawing.Point(14, 116);
  234.             this.Label3.Name = "Label3";
  235.             this.Label3.Size = new System.Drawing.Size(61, 18);
  236.             this.Label3.TabIndex = 3;
  237.             this.Label3.Text = "Disc Label:";
  238.             // 
  239.             // optISOLevel2
  240.             // 
  241.             this.optISOLevel2.Location = new System.Drawing.Point(14, 81);
  242.             this.optISOLevel2.Name = "optISOLevel2";
  243.             this.optISOLevel2.Size = new System.Drawing.Size(308, 19);
  244.             this.optISOLevel2.TabIndex = 2;
  245.             this.optISOLevel2.Text = "ISO Level 2   (Maximum 31 chars)";
  246.             this.optISOLevel2.CheckedChanged += new System.EventHandler(this.optISOLevel2_Click);
  247.             // 
  248.             // optISOLevel1
  249.             // 
  250.             this.optISOLevel1.Location = new System.Drawing.Point(14, 57);
  251.             this.optISOLevel1.Name = "optISOLevel1";
  252.             this.optISOLevel1.Size = new System.Drawing.Size(307, 17);
  253.             this.optISOLevel1.TabIndex = 1;
  254.             this.optISOLevel1.Text = "ISO Level 1   (Maximum 11 =   8 + 3 chars)";
  255.             this.optISOLevel1.CheckedChanged += new System.EventHandler(this.optISOLevel1_Click);
  256.             // 
  257.             // optJoliet
  258.             // 
  259.             this.optJoliet.Checked = true;
  260.             this.optJoliet.Location = new System.Drawing.Point(13, 33);
  261.             this.optJoliet.Name = "optJoliet";
  262.             this.optJoliet.Size = new System.Drawing.Size(309, 16);
  263.             this.optJoliet.TabIndex = 0;
  264.             this.optJoliet.TabStop = true;
  265.             this.optJoliet.Text = "Joliet              (Multilanguage Support)";
  266.             this.optJoliet.CheckedChanged += new System.EventHandler(this.optJoliet_Click);
  267.             // 
  268.             // GroupBox3
  269.             // 
  270.             this.GroupBox3.Controls.AddRange(new System.Windows.Forms.Control[] {
  271.                                                                                     this.optDataMode2,
  272.                                                                                     this.optDataMode1});
  273.             this.GroupBox3.Location = new System.Drawing.Point(184, 160);
  274.             this.GroupBox3.Name = "GroupBox3";
  275.             this.GroupBox3.Size = new System.Drawing.Size(336, 52);
  276.             this.GroupBox3.TabIndex = 3;
  277.             this.GroupBox3.TabStop = false;
  278.             this.GroupBox3.Text = "Format";
  279.             // 
  280.             // optDataMode2
  281.             // 
  282.             this.optDataMode2.Location = new System.Drawing.Point(160, 24);
  283.             this.optDataMode2.Name = "optDataMode2";
  284.             this.optDataMode2.Size = new System.Drawing.Size(143, 16);
  285.             this.optDataMode2.TabIndex = 1;
  286.             this.optDataMode2.Text = "Data Mode 2/XA";
  287.             // 
  288.             // optDataMode1
  289.             // 
  290.             this.optDataMode1.Checked = true;
  291.             this.optDataMode1.Location = new System.Drawing.Point(17, 24);
  292.             this.optDataMode1.Name = "optDataMode1";
  293.             this.optDataMode1.Size = new System.Drawing.Size(118, 16);
  294.             this.optDataMode1.TabIndex = 0;
  295.             this.optDataMode1.TabStop = true;
  296.             this.optDataMode1.Text = "Data Mode 1";
  297.             // 
  298.             // WriteBtn
  299.             // 
  300.             this.WriteBtn.Location = new System.Drawing.Point(528, 16);
  301.             this.WriteBtn.Name = "WriteBtn";
  302.             this.WriteBtn.Size = new System.Drawing.Size(96, 32);
  303.             this.WriteBtn.TabIndex = 5;
  304.             this.WriteBtn.Text = "Write";
  305.             this.WriteBtn.Click += new System.EventHandler(this.WriteBtn_Click);
  306.             // 
  307.             // CancelBtn
  308.             // 
  309.             this.CancelBtn.Location = new System.Drawing.Point(528, 64);
  310.             this.CancelBtn.Name = "CancelBtn";
  311.             this.CancelBtn.Size = new System.Drawing.Size(96, 32);
  312.             this.CancelBtn.TabIndex = 6;
  313.             this.CancelBtn.Text = "Cancel";
  314.             this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
  315.             // 
  316.             // frmProgress
  317.             // 
  318.             this.frmProgress.Controls.AddRange(new System.Windows.Forms.Control[] {
  319.                                                                                       this.ProgressBar2,
  320.                                                                                       this.Label9,
  321.                                                                                       this.ProgressLbl,
  322.                                                                                       this.ProgressBar1,
  323.                                                                                       this.driveWritedBlocksLbl,
  324.                                                                                       this.driveEstBlocksLbl,
  325.                                                                                       this.driveBufferLbl,
  326.                                                                                       this.driveStatusLbl,
  327.                                                                                       this.Label7,
  328.                                                                                       this.Label6,
  329.                                                                                       this.Label5,
  330.                                                                                       this.Label4});
  331.             this.frmProgress.Location = new System.Drawing.Point(0, 216);
  332.             this.frmProgress.Name = "frmProgress";
  333.             this.frmProgress.Size = new System.Drawing.Size(632, 116);
  334.             this.frmProgress.TabIndex = 7;
  335.             this.frmProgress.TabStop = false;
  336.             this.frmProgress.Text = "Progress";
  337.             // 
  338.             // ProgressBar2
  339.             // 
  340.             this.ProgressBar2.Location = new System.Drawing.Point(120, 72);
  341.             this.ProgressBar2.Name = "ProgressBar2";
  342.             this.ProgressBar2.Size = new System.Drawing.Size(503, 15);
  343.             this.ProgressBar2.TabIndex = 12;
  344.             // 
  345.             // Label9
  346.             // 
  347.             this.Label9.Location = new System.Drawing.Point(12, 92);
  348.             this.Label9.Name = "Label9";
  349.             this.Label9.Size = new System.Drawing.Size(97, 16);
  350.             this.Label9.TabIndex = 11;
  351.             this.Label9.Text = "Disk Total:";
  352.             // 
  353.             // ProgressLbl
  354.             // 
  355.             this.ProgressLbl.Location = new System.Drawing.Point(12, 74);
  356.             this.ProgressLbl.Name = "ProgressLbl";
  357.             this.ProgressLbl.Size = new System.Drawing.Size(97, 16);
  358.             this.ProgressLbl.TabIndex = 10;
  359.             this.ProgressLbl.Text = "Write:";
  360.             // 
  361.             // ProgressBar1
  362.             // 
  363.             this.ProgressBar1.Location = new System.Drawing.Point(121, 95);
  364.             this.ProgressBar1.Name = "ProgressBar1";
  365.             this.ProgressBar1.Size = new System.Drawing.Size(503, 15);
  366.             this.ProgressBar1.TabIndex = 9;
  367.             // 
  368.             // driveWritedBlocksLbl
  369.             // 
  370.             this.driveWritedBlocksLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
  371.             this.driveWritedBlocksLbl.Location = new System.Drawing.Point(520, 46);
  372.             this.driveWritedBlocksLbl.Name = "driveWritedBlocksLbl";
  373.             this.driveWritedBlocksLbl.Size = new System.Drawing.Size(104, 18);
  374.             this.driveWritedBlocksLbl.TabIndex = 7;
  375.             this.driveWritedBlocksLbl.Text = "0";
  376.             this.driveWritedBlocksLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
  377.             // 
  378.             // driveEstBlocksLbl
  379.             // 
  380.             this.driveEstBlocksLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
  381.             this.driveEstBlocksLbl.Location = new System.Drawing.Point(520, 22);
  382.             this.driveEstBlocksLbl.Name = "driveEstBlocksLbl";
  383.             this.driveEstBlocksLbl.Size = new System.Drawing.Size(104, 18);
  384.             this.driveEstBlocksLbl.TabIndex = 6;
  385.             this.driveEstBlocksLbl.Text = "0";
  386.             this.driveEstBlocksLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
  387.             // 
  388.             // driveBufferLbl
  389.             // 
  390.             this.driveBufferLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
  391.             this.driveBufferLbl.Location = new System.Drawing.Point(120, 48);
  392.             this.driveBufferLbl.Name = "driveBufferLbl";
  393.             this.driveBufferLbl.Size = new System.Drawing.Size(104, 18);
  394.             this.driveBufferLbl.TabIndex = 5;
  395.             this.driveBufferLbl.Text = "0";
  396.             this.driveBufferLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
  397.             // 
  398.             // driveStatusLbl
  399.             // 
  400.             this.driveStatusLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
  401.             this.driveStatusLbl.Location = new System.Drawing.Point(120, 24);
  402.             this.driveStatusLbl.Name = "driveStatusLbl";
  403.             this.driveStatusLbl.Size = new System.Drawing.Size(104, 18);
  404.             this.driveStatusLbl.TabIndex = 4;
  405.             this.driveStatusLbl.Text = "Idle";
  406.             this.driveStatusLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
  407.             // 
  408.             // Label7
  409.             // 
  410.             this.Label7.Location = new System.Drawing.Point(408, 50);
  411.             this.Label7.Name = "Label7";
  412.             this.Label7.Size = new System.Drawing.Size(106, 16);
  413.             this.Label7.TabIndex = 3;
  414.             this.Label7.Text = "Current Block:";
  415.             // 
  416.             // Label6
  417.             // 
  418.             this.Label6.Location = new System.Drawing.Point(408, 24);
  419.             this.Label6.Name = "Label6";
  420.             this.Label6.Size = new System.Drawing.Size(105, 16);
  421.             this.Label6.TabIndex = 2;
  422.             this.Label6.Text = "Estimated Blocks:";
  423.             // 
  424.             // Label5
  425.             // 
  426.             this.Label5.Location = new System.Drawing.Point(11, 46);
  427.             this.Label5.Name = "Label5";
  428.             this.Label5.Size = new System.Drawing.Size(97, 18);
  429.             this.Label5.TabIndex = 1;
  430.             this.Label5.Text = "Buffer (%):";
  431.             // 
  432.             // Label4
  433.             // 
  434.             this.Label4.Location = new System.Drawing.Point(11, 22);
  435.             this.Label4.Name = "Label4";
  436.             this.Label4.Size = new System.Drawing.Size(97, 16);
  437.             this.Label4.TabIndex = 0;
  438.             this.Label4.Text = "Drive Status:";
  439.             // 
  440.             // frmWrite
  441.             // 
  442.             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  443.             this.ClientSize = new System.Drawing.Size(632, 333);
  444.             this.Controls.AddRange(new System.Windows.Forms.Control[] {
  445.                                                                           this.frmProgress,
  446.                                                                           this.CancelBtn,
  447.                                                                           this.WriteBtn,
  448.                                                                           this.GroupBox3,
  449.                                                                           this.GroupBox2,
  450.                                                                           this.GroupBox1});
  451.             this.Name = "frmWrite";
  452.             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  453.             this.Text = "frmWrite";
  454.             this.Load += new System.EventHandler(this.frmWrite_Load);
  455.             this.GroupBox1.ResumeLayout(false);
  456.             this.GroupBox2.ResumeLayout(false);
  457.             this.GroupBox3.ResumeLayout(false);
  458.             this.frmProgress.ResumeLayout(false);
  459.             this.ResumeLayout(false);
  460.  
  461.         }
  462.         #endregion
  463.  
  464.         private void frmWrite_Load(object sender, System.EventArgs e)
  465.         {
  466.             frm = (Form1)this.Owner;;
  467.             writeSpeed = frm.DataCDWriter1.driveMaxWSpeed;
  468.             WriteInProgress = false;
  469.             LoadSpeedCombo();
  470.         }
  471.  
  472.         private void OptimalSpeedCheck_CheckedChanged(object sender, System.EventArgs e)
  473.         {
  474.             LoadSpeedCombo();
  475.         }
  476.  
  477.         public void LoadSpeedCombo()
  478.         {
  479.             speedCombo.Items.Clear();
  480.             ProgressBar3.Visible = true;
  481.  
  482.             if(OptimalSpeedCheck.Checked != false)
  483.             {
  484.                 for(speed = 64 ; speed > 0 ; speed = speed - 2)
  485.                 {
  486.                     frm.DataCDWriter1.writeSpeed = (short)speed;
  487.                     ProgressBar3.Value = 65 - speed;
  488.                     if(frm.DataCDWriter1.writeSpeed == speed )
  489.                     {
  490.                         speedCombo.Items.Add(speed);
  491.                     }
  492.                 }
  493.             }
  494.             else
  495.             {
  496.                 for(speed = frm.DataCDWriter1.driveMaxWSpeed ; speed > 0 ; speed = speed - 2)
  497.                 {
  498.                     speedCombo.Items.Add(speed);
  499.                 }
  500.             }
  501.  
  502.             if( speedCombo.Items.Count > 0 )
  503.             {
  504.                 speedCombo.SelectedIndex = 0;
  505.             }
  506.  
  507.             ProgressBar3.Value = 1;
  508.             ProgressBar3.Visible = false;
  509.         }
  510.  
  511.         private void WriteBtn_Click(object sender, System.EventArgs e)
  512.         {
  513.             bool test;
  514.             bool finalize;
  515.             int idx;
  516.     
  517.             Inactive();
  518.  
  519.             idx = 0;
  520.             speed = (int)speedCombo.Items[idx];
  521.             frm.DataCDWriter1.writeSpeed = (short)speed;
  522.             frm.DataCDWriter1.volumeLabel = txtDiscLabel.Text;
  523.  
  524.             driveStatusLbl.Text = "Prepare...";
  525.             this.Refresh();
  526.  
  527.             WriteBtn.Enabled = false;
  528.             this.Refresh();
  529.  
  530.             if(TestWriteCheck.Checked == false)
  531.             {
  532.                 frm.DataCDWriter1.writeSimulate = false;
  533.             }
  534.             else
  535.             {
  536.                 frm.DataCDWriter1.writeSimulate = true;
  537.             }
  538.         
  539.             if(FinilizeCDCheck.Checked == false)
  540.             {
  541.                 frm.DataCDWriter1.writeFinalizeCD = false;
  542.             }
  543.             else
  544.             {
  545.                 frm.DataCDWriter1.writeFinalizeCD = true;
  546.             }
  547.         
  548.             frm.err = false;
  549.             this.Refresh();
  550.  
  551.             idx = speedCombo.SelectedIndex;
  552.             speed = (int)speedCombo.Items[idx];
  553.             frm.DataCDWriter1.writeSpeed = (short)speed;
  554.  
  555.             frm.OperationProgress = false;
  556.             frm.writeProgress = 0;
  557.             frm.DataCDWriter1.StartWrite();
  558.             if( frm.err == true )
  559.             {
  560.                 driveStatusLbl.Text = "Idle";
  561.                 StopWrite();
  562.                 frm.err = false;
  563.                 frm.WrtiteInProgress = false;
  564.             }
  565.             else
  566.             {
  567.                 frm.WrtiteInProgress = true;
  568.                 WriteInProgress = true;
  569.             }
  570.         }
  571.  
  572.         private void CancelBtn_Click(object sender, System.EventArgs e)
  573.         {
  574.             if( WriteInProgress == true )
  575.             {
  576.                 frm.DataCDWriter1.StopWrite();
  577.                 driveStatusLbl.Text = "Idle";
  578.                 StopWrite();
  579.             }
  580.             else
  581.             {
  582.                 this.Hide();
  583.             }
  584.         }
  585.  
  586.         private void Active()
  587.         {
  588.             speedCombo.Enabled = true;
  589.             WriteBtn.Enabled = true;
  590.             optJoliet.Enabled = true;
  591.             optISOLevel1.Enabled = true;
  592.             optISOLevel2.Enabled = true;
  593.             txtDiscLabel.Enabled = true;
  594.             TestWriteCheck.Enabled = true;
  595.             FinilizeCDCheck.Enabled = true;
  596.             optDataMode1.Enabled = true;
  597.             optDataMode2.Enabled = true;
  598.             OptimalSpeedCheck.Enabled = true;
  599.         }
  600.  
  601.         private void Inactive()
  602.         {
  603.             OptimalSpeedCheck.Enabled = false;
  604.             speedCombo.Enabled = false;
  605.             WriteBtn.Enabled = false;
  606.             optJoliet.Enabled = false;
  607.             optISOLevel1.Enabled = false;
  608.             optISOLevel2.Enabled = false;
  609.             txtDiscLabel.Enabled = false;
  610.             TestWriteCheck.Enabled = false;
  611.             FinilizeCDCheck.Enabled = false;
  612.             optDataMode1.Enabled = false;
  613.             optDataMode2.Enabled = false;
  614.         }
  615.  
  616.         private void StopWrite()
  617.         {
  618.             ProgressLbl.Text = "Write Tracks:";
  619.             driveEstBlocksLbl.Text = "";
  620.             driveWritedBlocksLbl.Text = "";
  621.             driveBufferLbl.Text = "";
  622.             ProgressBar1.Value = 0;
  623.             ProgressBar2.Value = 0;
  624.             frm.RefreshDiskInfo();
  625.             WriteInProgress = false;
  626.             frm.WrtiteInProgress = false;
  627.             WriteBtn.Enabled = true;
  628.             CancelBtn.Enabled = true;
  629.             frm.err = false;
  630.             Active();
  631.         }
  632.  
  633.         private void optISOLevel1_Click(object sender, System.EventArgs e)
  634.         {
  635.             frm.DataCDWriter1.volumeFileSystem = NCTDISCWRITERLib.FILE_SYSTEM.ISO_LEVEL_1;
  636.         }
  637.  
  638.         private void optISOLevel2_Click(object sender, System.EventArgs e)
  639.         {
  640.             frm.DataCDWriter1.volumeFileSystem = NCTDISCWRITERLib.FILE_SYSTEM.ISO_LEVEL_2;
  641.         
  642.         }
  643.  
  644.         private void optJoliet_Click(object sender, System.EventArgs e)
  645.         {
  646.             frm.DataCDWriter1.volumeFileSystem = NCTDISCWRITERLib.FILE_SYSTEM.JOLIET;
  647.         }
  648.  
  649.         private void speedCombo_SelectedIndexChanged(object sender, System.EventArgs e)
  650.         {
  651.             int idx;
  652.             idx = speedCombo.SelectedIndex;
  653.             speed = (int)speedCombo.Items[idx];
  654.             frm.DataCDWriter1.writeSpeed = (short)speed;
  655.         }
  656.  
  657.         public void OperationProgress(int Percent)
  658.         {
  659.             if( (frm.err == true) || (WriteInProgress == false) )
  660.             {
  661.                 driveStatusLbl.Text = "Idle";
  662.                 StopWrite();
  663.                 return;
  664.             }
  665.  
  666.             switch(frm.DataCDWriter1.driveOperation)
  667.             {
  668.                 case NCTDISCWRITERLib.OPERATION.WRITE_DISC:
  669.                 {
  670.                     switch(frm.DataCDWriter1.writePhase)
  671.                     {
  672.                         case NCTDISCWRITERLib.WRITE_PHASE.FILL_BUFFER:
  673.                             driveStatusLbl.Text = "Fill Buffer...";
  674.                             break;
  675.                         case NCTDISCWRITERLib.WRITE_PHASE.WRITE_TRACK:
  676.                             driveStatusLbl.Text = "Write Track...";
  677.                             break;
  678.                         case NCTDISCWRITERLib.WRITE_PHASE.CLOSE_TRACK:
  679.                             driveStatusLbl.Text = "Close Track...";
  680.                             break;
  681.                     }
  682.                     ProgressBar1.Value = Percent * 2 / 3;
  683.                     ProgressBar2.Value = Percent;
  684.                     driveEstBlocksLbl.Text = frm.DataCDWriter1.writeTotalBlocks.ToString();
  685.                     driveWritedBlocksLbl.Text = frm.DataCDWriter1.writeCurrentBlock.ToString();
  686.                     driveBufferLbl.Text = frm.DataCDWriter1.driveBufferUsagePercent.ToString();
  687.                     break;
  688.                 }
  689.                 case NCTDISCWRITERLib.OPERATION.FINALIZE_DISC:
  690.                 {
  691.                     driveStatusLbl.Text = "Finalise Disc...";
  692.                     ProgressLbl.Text = "Finalise:";
  693.                     CancelBtn.Enabled = false;
  694.                     ProgressBar1.Value = 100 * 2 / 3 + Percent / 3 - 5;
  695.                     ProgressBar2.Value = Percent;
  696.                     driveWritedBlocksLbl.Text = frm.DataCDWriter1.writeCurrentBlock.ToString();
  697.                     if( Percent == 100 )
  698.                     {
  699.                         ProgressBar2.Value = 100;
  700.                         ProgressBar1.Value = 100;
  701.                         driveStatusLbl.Text = "Idle";
  702.                         MessageBox.Show("Write Complete!");
  703.                         StopWrite();
  704.                         frm.WrtiteInProgress = false;
  705.                         return;
  706.                     }
  707.                     break;
  708.                 }
  709.             }
  710.             Application.DoEvents();
  711.         }
  712.     }
  713. }
  714.