VMSInfo.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using NEROLib;
  7. using System.Runtime.InteropServices;
  8. namespace LYFZ.NeroDiscBurn.NET
  9. {
  10. /// <summary>
  11. /// Summary description for VMSInfo.
  12. /// </summary>
  13. public class VMSInfoForm : System.Windows.Forms.Form
  14. {
  15. public NeroDrive m_drive;
  16. private System.Windows.Forms.Label label1;
  17. private System.Windows.Forms.Label c_Count;
  18. private System.Windows.Forms.Button c_OK;
  19. private System.Windows.Forms.ColumnHeader columnHeader1;
  20. private System.Windows.Forms.ColumnHeader columnHeader2;
  21. private System.Windows.Forms.ListView c_Sessions;
  22. /// <summary>
  23. /// Required designer variable.
  24. /// </summary>
  25. private System.ComponentModel.Container components = null;
  26. public VMSInfoForm()
  27. {
  28. //
  29. // Required for Windows Form Designer support
  30. //
  31. InitializeComponent();
  32. }
  33. protected override void OnLoad(EventArgs e)
  34. {
  35. base.OnLoad (e);
  36. // When the form is loaded, try getting the VMS info.
  37. //
  38. try
  39. {
  40. NeroVMSInfo vms = m_drive.GetVMSInfo ();
  41. c_Count.Text = vms.Count.ToString ();
  42. // Add each VMS entry to the list view.
  43. //
  44. int i = 0;
  45. foreach (NeroVMSSession sess in vms)
  46. {
  47. ListViewItem lvi = c_Sessions.Items.Add ((i+1).ToString ());
  48. lvi.SubItems.Add (sess.SessionName);
  49. i ++;
  50. }
  51. }
  52. catch (COMException)
  53. {
  54. ListViewItem lvi = c_Sessions.Items.Add ("");
  55. lvi.SubItems.Add ("no VMS info");
  56. }
  57. }
  58. /// <summary>
  59. /// Clean up any resources being used.
  60. /// </summary>
  61. protected override void Dispose( bool disposing )
  62. {
  63. if( disposing )
  64. {
  65. if(components != null)
  66. {
  67. components.Dispose();
  68. }
  69. }
  70. base.Dispose( disposing );
  71. }
  72. #region Windows Form Designer generated code
  73. /// <summary>
  74. /// Required method for Designer support - do not modify
  75. /// the contents of this method with the code editor.
  76. /// </summary>
  77. private void InitializeComponent()
  78. {
  79. this.label1 = new System.Windows.Forms.Label();
  80. this.c_Count = new System.Windows.Forms.Label();
  81. this.c_OK = new System.Windows.Forms.Button();
  82. this.c_Sessions = new System.Windows.Forms.ListView();
  83. this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
  84. this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
  85. this.SuspendLayout();
  86. //
  87. // label1
  88. //
  89. this.label1.Location = new System.Drawing.Point(8, 8);
  90. this.label1.Name = "label1";
  91. this.label1.Size = new System.Drawing.Size(72, 16);
  92. this.label1.TabIndex = 0;
  93. this.label1.Text = "VMS Count:";
  94. //
  95. // c_Count
  96. //
  97. this.c_Count.Location = new System.Drawing.Point(88, 8);
  98. this.c_Count.Name = "c_Count";
  99. this.c_Count.Size = new System.Drawing.Size(32, 16);
  100. this.c_Count.TabIndex = 1;
  101. this.c_Count.Text = "0";
  102. //
  103. // c_OK
  104. //
  105. this.c_OK.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  106. this.c_OK.Location = new System.Drawing.Point(264, 8);
  107. this.c_OK.Name = "c_OK";
  108. this.c_OK.TabIndex = 3;
  109. this.c_OK.Text = "OK";
  110. //
  111. // c_Sessions
  112. //
  113. this.c_Sessions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
  114. this.columnHeader1,
  115. this.columnHeader2});
  116. this.c_Sessions.FullRowSelect = true;
  117. this.c_Sessions.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
  118. this.c_Sessions.Location = new System.Drawing.Point(8, 40);
  119. this.c_Sessions.MultiSelect = false;
  120. this.c_Sessions.Name = "c_Sessions";
  121. this.c_Sessions.Size = new System.Drawing.Size(248, 96);
  122. this.c_Sessions.TabIndex = 2;
  123. this.c_Sessions.View = System.Windows.Forms.View.Details;
  124. //
  125. // columnHeader1
  126. //
  127. this.columnHeader1.Text = "#";
  128. this.columnHeader1.Width = 30;
  129. //
  130. // columnHeader2
  131. //
  132. this.columnHeader2.Text = "Name";
  133. this.columnHeader2.Width = 196;
  134. //
  135. // VMSInfoForm
  136. //
  137. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  138. this.CancelButton = this.c_OK;
  139. this.ClientSize = new System.Drawing.Size(346, 152);
  140. this.Controls.Add(this.c_Sessions);
  141. this.Controls.Add(this.c_OK);
  142. this.Controls.Add(this.c_Count);
  143. this.Controls.Add(this.label1);
  144. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  145. this.MaximizeBox = false;
  146. this.MinimizeBox = false;
  147. this.Name = "VMSInfoForm";
  148. this.ShowInTaskbar = false;
  149. this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
  150. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
  151. this.Text = "VMSInfo";
  152. this.ResumeLayout(false);
  153. }
  154. #endregion
  155. }
  156. }