ChooseMedia.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using NEROLib;
  7. namespace LYFZ.NeroDiscBurn.NET
  8. {
  9. /// <summary>
  10. /// Summary description for ChooseMedia.
  11. /// </summary>
  12. public class ChooseMediaForm : System.Windows.Forms.Form
  13. {
  14. private Nero m_nero;
  15. private System.Windows.Forms.Button c_OK;
  16. private System.Windows.Forms.Button c_Cancel;
  17. private System.Windows.Forms.Label label1;
  18. private System.Windows.Forms.ListView c_Media;
  19. private RadioButton radioButtonCD;
  20. private RadioButton radioButtonDVD;
  21. /// <summary>
  22. /// Required designer variable.
  23. /// </summary>
  24. private System.ComponentModel.Container components = null;
  25. public ChooseMediaForm(Nero nero)
  26. {
  27. //
  28. // Required for Windows Form Designer support
  29. //
  30. InitializeComponent();
  31. this.Shown += ChooseMediaForm_Shown;
  32. m_nero = nero;
  33. }
  34. void ChooseMediaForm_Shown(object sender, EventArgs e)
  35. {
  36. if (this.CMediaType == "cd")
  37. {
  38. this.radioButtonCD.Checked = true;
  39. }
  40. else if (this.CMediaType == "dvd")
  41. {
  42. this.radioButtonDVD.Checked = true;
  43. }
  44. }
  45. /// <summary>
  46. /// Clean up any resources being used.
  47. /// </summary>
  48. protected override void Dispose( bool disposing )
  49. {
  50. if( disposing )
  51. {
  52. if(components != null)
  53. {
  54. components.Dispose();
  55. }
  56. }
  57. base.Dispose( disposing );
  58. }
  59. #region Windows Form Designer generated code
  60. /// <summary>
  61. /// Required method for Designer support - do not modify
  62. /// the contents of this method with the code editor.
  63. /// </summary>
  64. private void InitializeComponent()
  65. {
  66. System.Windows.Forms.ListViewItem listViewItem20 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_CD");
  67. System.Windows.Forms.ListViewItem listViewItem21 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_DDCD");
  68. System.Windows.Forms.ListViewItem listViewItem22 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_DVD_M");
  69. System.Windows.Forms.ListViewItem listViewItem23 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_DVD_P");
  70. System.Windows.Forms.ListViewItem listViewItem24 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_DVD_RAM");
  71. System.Windows.Forms.ListViewItem listViewItem25 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_ML");
  72. System.Windows.Forms.ListViewItem listViewItem26 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_MRW");
  73. System.Windows.Forms.ListViewItem listViewItem27 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_NO_CDR");
  74. System.Windows.Forms.ListViewItem listViewItem28 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_NO_CDRW");
  75. System.Windows.Forms.ListViewItem listViewItem29 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_DVD_ROM");
  76. System.Windows.Forms.ListViewItem listViewItem30 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_CDROM");
  77. System.Windows.Forms.ListViewItem listViewItem31 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_NO_DVD_M_RW");
  78. System.Windows.Forms.ListViewItem listViewItem32 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_NO_DVD_M_R");
  79. System.Windows.Forms.ListViewItem listViewItem33 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_NO_DVD_P_RW");
  80. System.Windows.Forms.ListViewItem listViewItem34 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_NO_DVD_P_R");
  81. System.Windows.Forms.ListViewItem listViewItem35 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_FPACKET");
  82. System.Windows.Forms.ListViewItem listViewItem36 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_VPACKET");
  83. System.Windows.Forms.ListViewItem listViewItem37 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_HDB");
  84. System.Windows.Forms.ListViewItem listViewItem38 = new System.Windows.Forms.ListViewItem("NERO_MEDIA_DVD_P_R9");
  85. this.c_OK = new System.Windows.Forms.Button();
  86. this.c_Cancel = new System.Windows.Forms.Button();
  87. this.c_Media = new System.Windows.Forms.ListView();
  88. this.label1 = new System.Windows.Forms.Label();
  89. this.radioButtonCD = new System.Windows.Forms.RadioButton();
  90. this.radioButtonDVD = new System.Windows.Forms.RadioButton();
  91. this.SuspendLayout();
  92. //
  93. // c_OK
  94. //
  95. this.c_OK.DialogResult = System.Windows.Forms.DialogResult.OK;
  96. this.c_OK.Location = new System.Drawing.Point(317, 171);
  97. this.c_OK.Name = "c_OK";
  98. this.c_OK.Size = new System.Drawing.Size(90, 25);
  99. this.c_OK.TabIndex = 2;
  100. this.c_OK.Text = "È· ¶¨";
  101. //
  102. // c_Cancel
  103. //
  104. this.c_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  105. this.c_Cancel.Location = new System.Drawing.Point(429, 171);
  106. this.c_Cancel.Name = "c_Cancel";
  107. this.c_Cancel.Size = new System.Drawing.Size(90, 25);
  108. this.c_Cancel.TabIndex = 3;
  109. this.c_Cancel.Text = "Ïû È¡";
  110. //
  111. // c_Media
  112. //
  113. this.c_Media.CheckBoxes = true;
  114. this.c_Media.HideSelection = false;
  115. listViewItem20.Checked = true;
  116. listViewItem20.StateImageIndex = 1;
  117. listViewItem20.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_CD;
  118. listViewItem21.Checked = true;
  119. listViewItem21.StateImageIndex = 1;
  120. listViewItem21.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_DDCD;
  121. listViewItem22.Checked = true;
  122. listViewItem22.StateImageIndex = 1;
  123. listViewItem22.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_DVD_M;
  124. listViewItem23.Checked = true;
  125. listViewItem23.StateImageIndex = 1;
  126. listViewItem23.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_DVD_P;
  127. listViewItem24.Checked = true;
  128. listViewItem24.StateImageIndex = 1;
  129. listViewItem24.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_DVD_RAM;
  130. listViewItem25.Checked = true;
  131. listViewItem25.StateImageIndex = 1;
  132. listViewItem25.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_ML;
  133. listViewItem26.Checked = true;
  134. listViewItem26.StateImageIndex = 1;
  135. listViewItem26.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_MRW;
  136. listViewItem27.Checked = true;
  137. listViewItem27.StateImageIndex = 1;
  138. listViewItem27.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_NO_CDR;
  139. listViewItem28.Checked = true;
  140. listViewItem28.StateImageIndex = 1;
  141. listViewItem28.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_NO_CDRW;
  142. listViewItem29.Checked = true;
  143. listViewItem29.StateImageIndex = 1;
  144. listViewItem29.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_DVD_ROM;
  145. listViewItem30.Checked = true;
  146. listViewItem30.StateImageIndex = 1;
  147. listViewItem30.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_CDROM;
  148. listViewItem31.Checked = true;
  149. listViewItem31.StateImageIndex = 1;
  150. listViewItem31.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_NO_DVD_M_RW;
  151. listViewItem32.Checked = true;
  152. listViewItem32.StateImageIndex = 1;
  153. listViewItem32.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_NO_DVD_M_R;
  154. listViewItem33.Checked = true;
  155. listViewItem33.StateImageIndex = 1;
  156. listViewItem33.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_NO_DVD_P_RW;
  157. listViewItem34.Checked = true;
  158. listViewItem34.StateImageIndex = 1;
  159. listViewItem34.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_NO_DVD_P_R;
  160. listViewItem35.Checked = true;
  161. listViewItem35.StateImageIndex = 1;
  162. listViewItem35.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_FPACKET;
  163. listViewItem36.Checked = true;
  164. listViewItem36.StateImageIndex = 1;
  165. listViewItem36.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_VPACKET;
  166. listViewItem37.Checked = true;
  167. listViewItem37.StateImageIndex = 1;
  168. listViewItem37.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_HDB;
  169. listViewItem38.Checked = true;
  170. listViewItem38.StateImageIndex = 1;
  171. listViewItem38.Tag = NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_DVD_P_R9;
  172. this.c_Media.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
  173. listViewItem20,
  174. listViewItem21,
  175. listViewItem22,
  176. listViewItem23,
  177. listViewItem24,
  178. listViewItem25,
  179. listViewItem26,
  180. listViewItem27,
  181. listViewItem28,
  182. listViewItem29,
  183. listViewItem30,
  184. listViewItem31,
  185. listViewItem32,
  186. listViewItem33,
  187. listViewItem34,
  188. listViewItem35,
  189. listViewItem36,
  190. listViewItem37,
  191. listViewItem38});
  192. this.c_Media.Location = new System.Drawing.Point(10, 46);
  193. this.c_Media.Name = "c_Media";
  194. this.c_Media.Size = new System.Drawing.Size(511, 120);
  195. this.c_Media.TabIndex = 1;
  196. this.c_Media.UseCompatibleStateImageBehavior = false;
  197. this.c_Media.View = System.Windows.Forms.View.List;
  198. //
  199. // label1
  200. //
  201. this.label1.Location = new System.Drawing.Point(10, 16);
  202. this.label1.Name = "label1";
  203. this.label1.Size = new System.Drawing.Size(80, 16);
  204. this.label1.TabIndex = 0;
  205. this.label1.Text = "ýÌåÀàÐÍ:";
  206. //
  207. // radioButtonCD
  208. //
  209. this.radioButtonCD.AutoSize = true;
  210. this.radioButtonCD.Location = new System.Drawing.Point(110, 16);
  211. this.radioButtonCD.Name = "radioButtonCD";
  212. this.radioButtonCD.Size = new System.Drawing.Size(65, 16);
  213. this.radioButtonCD.TabIndex = 4;
  214. this.radioButtonCD.TabStop = true;
  215. this.radioButtonCD.Text = "CD-R/RW";
  216. this.radioButtonCD.UseVisualStyleBackColor = true;
  217. this.radioButtonCD.CheckedChanged += new System.EventHandler(this.radioButtonCD_CheckedChanged);
  218. //
  219. // radioButtonDVD
  220. //
  221. this.radioButtonDVD.AutoSize = true;
  222. this.radioButtonDVD.Location = new System.Drawing.Point(195, 16);
  223. this.radioButtonDVD.Name = "radioButtonDVD";
  224. this.radioButtonDVD.Size = new System.Drawing.Size(71, 16);
  225. this.radioButtonDVD.TabIndex = 4;
  226. this.radioButtonDVD.TabStop = true;
  227. this.radioButtonDVD.Text = "DVD-R/RW";
  228. this.radioButtonDVD.UseVisualStyleBackColor = true;
  229. this.radioButtonDVD.CheckedChanged += new System.EventHandler(this.radioButtonDVD_CheckedChanged);
  230. //
  231. // ChooseMediaForm
  232. //
  233. this.AcceptButton = this.c_OK;
  234. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  235. this.CancelButton = this.c_Cancel;
  236. this.ClientSize = new System.Drawing.Size(553, 206);
  237. this.Controls.Add(this.radioButtonDVD);
  238. this.Controls.Add(this.radioButtonCD);
  239. this.Controls.Add(this.label1);
  240. this.Controls.Add(this.c_Media);
  241. this.Controls.Add(this.c_OK);
  242. this.Controls.Add(this.c_Cancel);
  243. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  244. this.MaximizeBox = false;
  245. this.MinimizeBox = false;
  246. this.Name = "ChooseMediaForm";
  247. this.ShowInTaskbar = false;
  248. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
  249. this.Text = "Ñ¡ÔñýÌå";
  250. this.ResumeLayout(false);
  251. this.PerformLayout();
  252. }
  253. #endregion
  254. public new string ToString ()
  255. {
  256. return m_nero.get_TypeNameOfMedia (GetMediaType ());
  257. }
  258. public NERO_MEDIA_TYPE GetMediaType ()
  259. {
  260. // Return the selected media type. Use uint, then cast
  261. // to NERO_MEDIA_TYPE.
  262. //
  263. uint uType = (uint) NERO_MEDIA_TYPE.NERO_MEDIA_NONE;
  264. foreach (ListViewItem lvi in c_Media.Items)
  265. {
  266. if (lvi.Checked)
  267. {
  268. uType |= (uint) (NERO_MEDIA_TYPE) lvi.Tag;
  269. }
  270. }
  271. return (NERO_MEDIA_TYPE) uType;
  272. }
  273. public void SetMediaType(string uType="cd")
  274. {
  275. this.CMediaType = uType;
  276. foreach (ListViewItem lvi in c_Media.Items)
  277. {
  278. switch ((NERO_MEDIA_TYPE)lvi.Tag)
  279. {
  280. case NERO_MEDIA_TYPE.NERO_MEDIA_CD:
  281. case NERO_MEDIA_TYPE.NERO_MEDIA_CDR:
  282. case NERO_MEDIA_TYPE.NERO_MEDIA_CDROM:
  283. case NERO_MEDIA_TYPE.NERO_MEDIA_CDRW:
  284. case NERO_MEDIA_TYPE.NERO_MEDIA_DDCD:
  285. case NERO_MEDIA_TYPE.NERO_MEDIA_NO_CDR:
  286. case NERO_MEDIA_TYPE.NERO_MEDIA_NO_CDRW:
  287. if (uType == "cd")
  288. {
  289. lvi.Checked = true;
  290. }
  291. else {
  292. lvi.Checked = false;
  293. }
  294. break;
  295. default:
  296. if (uType == "dvd")
  297. {
  298. lvi.Checked = true;
  299. }
  300. else
  301. {
  302. lvi.Checked = false;
  303. }
  304. break;
  305. }
  306. }
  307. }
  308. /// <summary>
  309. /// µ±Ç°Ñ¡ÔñÀàÐÍ
  310. /// </summary>
  311. string CMediaType = "cd";
  312. private void radioButtonCD_CheckedChanged(object sender, EventArgs e)
  313. {
  314. SetMediaType("cd");
  315. }
  316. private void radioButtonDVD_CheckedChanged(object sender, EventArgs e)
  317. {
  318. SetMediaType("dvd");
  319. }
  320. }
  321. }