MethodKDialog.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. using PaintDotNet.Base.DedicatedAnalysis.Inclusions;
  2. using PaintDotNet.Base.DedicatedAnalysis.Inclusions.Standard.EN10247_2007.TypesOfAssessment;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace PaintDotNet.DedicatedAnalysis.Inclusions.EN10247_2007
  13. {
  14. internal class MethodKDialog : InclusionsStandardDialog
  15. {
  16. #region 组件
  17. private RadioButton radioButton_DarkGray;
  18. private RadioButton radioButton_Gray;
  19. private RadioButton radioButton_Colored;
  20. private RadioButton radioButton_Black;
  21. private Panel panel_displaySetting_EA;
  22. private Button label_displaySetting_EA;
  23. private Button label_displaySetting_EB;
  24. private Panel panel_displaySetting_EB;
  25. private Button label_displaySetting_EC;
  26. private Panel panel_displaySetting_EC;
  27. private Button label_displaySetting_ED;
  28. private Panel panel_displaySetting_ED;
  29. private Button label_displaySetting_EAD;
  30. private Panel panel_displaySetting_EAD;
  31. private Button label_displaySetting_EF;
  32. private Panel panel_displaySetting_EF;
  33. #endregion 组件
  34. #region 构造函数
  35. public MethodKDialog(AppWorkspace appWorkspace, string dialogText, PdnMenuItem menuItem) : base(appWorkspace, dialogText, menuItem)
  36. {
  37. }
  38. #endregion 构造函数
  39. #region 初始化组件
  40. private void InitializeLanguageText()
  41. {
  42. this.Text = "EN10247_2007_MethodK(" + PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.Inclusion.Text") + ")";
  43. this.radioButton_Black.Text = PdnResources.GetString("Menu.black.text");
  44. this.radioButton_Colored.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.non-ferrous.text");
  45. this.radioButton_Gray.Text = PdnResources.GetString("Menu.gray.text");
  46. this.radioButton_DarkGray.Text = PdnResources.GetString("Menu.Darkgray.text");
  47. }
  48. private void InitializeComponent()
  49. {
  50. this.radioButton_DarkGray = new System.Windows.Forms.RadioButton();
  51. this.radioButton_Gray = new System.Windows.Forms.RadioButton();
  52. this.radioButton_Colored = new System.Windows.Forms.RadioButton();
  53. this.radioButton_Black = new System.Windows.Forms.RadioButton();
  54. this.label_displaySetting_EAD = new System.Windows.Forms.Button();
  55. this.panel_displaySetting_EA = new System.Windows.Forms.Panel();
  56. this.panel_displaySetting_EC = new System.Windows.Forms.Panel();
  57. this.label_displaySetting_ED = new System.Windows.Forms.Button();
  58. this.panel_displaySetting_EB = new System.Windows.Forms.Panel();
  59. this.panel_displaySetting_EF = new System.Windows.Forms.Panel();
  60. this.label_displaySetting_EF = new System.Windows.Forms.Button();
  61. this.panel_displaySetting_ED = new System.Windows.Forms.Panel();
  62. this.label_displaySetting_EC = new System.Windows.Forms.Button();
  63. this.panel_displaySetting_EAD = new System.Windows.Forms.Panel();
  64. this.label_displaySetting_EA = new System.Windows.Forms.Button();
  65. this.label_displaySetting_EB = new System.Windows.Forms.Button();
  66. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).BeginInit();
  67. this.groupBox_colorSetting.SuspendLayout();
  68. this.groupBox_displaySetting.SuspendLayout();
  69. this.SuspendLayout();
  70. //
  71. // numericUpDown_lwRatioLimit
  72. //
  73. this.numericUpDown_lwRatioLimit.Value = new decimal(new int[] {
  74. 13,
  75. 0,
  76. 0,
  77. 65536});
  78. //
  79. // groupBox_colorSetting
  80. //
  81. this.groupBox_colorSetting.Controls.Add(this.radioButton_DarkGray);
  82. this.groupBox_colorSetting.Controls.Add(this.radioButton_Gray);
  83. this.groupBox_colorSetting.Controls.Add(this.radioButton_Colored);
  84. this.groupBox_colorSetting.Controls.Add(this.radioButton_Black);
  85. this.groupBox_colorSetting.Controls.SetChildIndex(this.radioButton_Black, 0);
  86. this.groupBox_colorSetting.Controls.SetChildIndex(this.radioButton_Colored, 0);
  87. this.groupBox_colorSetting.Controls.SetChildIndex(this.radioButton_Gray, 0);
  88. this.groupBox_colorSetting.Controls.SetChildIndex(this.radioButton_DarkGray, 0);
  89. //
  90. // groupBox_displaySetting
  91. //
  92. this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_EAD);
  93. this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_EA);
  94. this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_EC);
  95. this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_ED);
  96. this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_EB);
  97. this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_EF);
  98. this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_EF);
  99. this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_ED);
  100. this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_EC);
  101. this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_EAD);
  102. this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_EA);
  103. this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_EB);
  104. //
  105. // radioButton_DarkGray
  106. //
  107. this.radioButton_DarkGray.AutoSize = true;
  108. this.radioButton_DarkGray.Location = new System.Drawing.Point(200, 20);
  109. this.radioButton_DarkGray.Name = "radioButton_DarkGray";
  110. this.radioButton_DarkGray.Size = new System.Drawing.Size(59, 16);
  111. this.radioButton_DarkGray.TabIndex = 38;
  112. this.radioButton_DarkGray.TabStop = true;
  113. this.radioButton_DarkGray.UseVisualStyleBackColor = true;
  114. //
  115. // radioButton_Gray
  116. //
  117. this.radioButton_Gray.AutoSize = true;
  118. this.radioButton_Gray.Location = new System.Drawing.Point(145, 20);
  119. this.radioButton_Gray.Name = "radioButton_Gray";
  120. this.radioButton_Gray.Size = new System.Drawing.Size(47, 16);
  121. this.radioButton_Gray.TabIndex = 37;
  122. this.radioButton_Gray.TabStop = true;
  123. this.radioButton_Gray.UseVisualStyleBackColor = true;
  124. //
  125. // radioButton_Colored
  126. //
  127. this.radioButton_Colored.AutoSize = true;
  128. this.radioButton_Colored.Location = new System.Drawing.Point(60, 20);
  129. this.radioButton_Colored.Name = "radioButton_Colored";
  130. this.radioButton_Colored.Size = new System.Drawing.Size(47, 16);
  131. this.radioButton_Colored.TabIndex = 36;
  132. this.radioButton_Colored.TabStop = true;
  133. this.radioButton_Colored.UseVisualStyleBackColor = true;
  134. //
  135. // radioButton_Black
  136. //
  137. this.radioButton_Black.AutoSize = true;
  138. this.radioButton_Black.Location = new System.Drawing.Point(7, 20);
  139. this.radioButton_Black.Name = "radioButton_Black";
  140. this.radioButton_Black.Size = new System.Drawing.Size(47, 16);
  141. this.radioButton_Black.TabIndex = 35;
  142. this.radioButton_Black.TabStop = true;
  143. this.radioButton_Black.UseVisualStyleBackColor = true;
  144. //
  145. // label_displaySetting_EAD
  146. //
  147. this.label_displaySetting_EAD.AutoSize = true;
  148. this.label_displaySetting_EAD.Location = new System.Drawing.Point(233, 24);
  149. this.label_displaySetting_EAD.Name = "label_displaySetting_EAD";
  150. this.label_displaySetting_EAD.Size = new System.Drawing.Size(33, 22);
  151. this.label_displaySetting_EAD.TabIndex = 42;
  152. this.label_displaySetting_EAD.Text = "EAD";
  153. //
  154. // panel_displaySetting_EA
  155. //
  156. this.panel_displaySetting_EA.Location = new System.Drawing.Point(36, 24);
  157. this.panel_displaySetting_EA.Name = "panel_displaySetting_EA";
  158. this.panel_displaySetting_EA.Size = new System.Drawing.Size(21, 21);
  159. this.panel_displaySetting_EA.TabIndex = 34;
  160. //
  161. // panel_displaySetting_EC
  162. //
  163. this.panel_displaySetting_EC.BackColor = System.Drawing.SystemColors.Control;
  164. this.panel_displaySetting_EC.Location = new System.Drawing.Point(146, 24);
  165. this.panel_displaySetting_EC.Name = "panel_displaySetting_EC";
  166. this.panel_displaySetting_EC.Size = new System.Drawing.Size(21, 21);
  167. this.panel_displaySetting_EC.TabIndex = 35;
  168. //
  169. // label_displaySetting_ED
  170. //
  171. this.label_displaySetting_ED.AutoSize = true;
  172. this.label_displaySetting_ED.Location = new System.Drawing.Point(173, 24);
  173. this.label_displaySetting_ED.Name = "label_displaySetting_ED";
  174. this.label_displaySetting_ED.Size = new System.Drawing.Size(27, 22);
  175. this.label_displaySetting_ED.TabIndex = 41;
  176. this.label_displaySetting_ED.Text = "ED";
  177. //
  178. // panel_displaySetting_EB
  179. //
  180. this.panel_displaySetting_EB.BackColor = System.Drawing.SystemColors.Control;
  181. this.panel_displaySetting_EB.Location = new System.Drawing.Point(93, 24);
  182. this.panel_displaySetting_EB.Name = "panel_displaySetting_EB";
  183. this.panel_displaySetting_EB.Size = new System.Drawing.Size(21, 21);
  184. this.panel_displaySetting_EB.TabIndex = 33;
  185. //
  186. // panel_displaySetting_EF
  187. //
  188. this.panel_displaySetting_EF.BackColor = System.Drawing.SystemColors.Control;
  189. this.panel_displaySetting_EF.Location = new System.Drawing.Point(332, 24);
  190. this.panel_displaySetting_EF.Name = "panel_displaySetting_EF";
  191. this.panel_displaySetting_EF.Size = new System.Drawing.Size(21, 21);
  192. this.panel_displaySetting_EF.TabIndex = 33;
  193. //
  194. // label_displaySetting_EF
  195. //
  196. this.label_displaySetting_EF.AutoSize = true;
  197. this.label_displaySetting_EF.Location = new System.Drawing.Point(299, 24);
  198. this.label_displaySetting_EF.Name = "label_displaySetting_EF";
  199. this.label_displaySetting_EF.Size = new System.Drawing.Size(27, 22);
  200. this.label_displaySetting_EF.TabIndex = 45;
  201. this.label_displaySetting_EF.Text = "EF";
  202. //
  203. // panel_displaySetting_ED
  204. //
  205. this.panel_displaySetting_ED.BackColor = System.Drawing.SystemColors.Control;
  206. this.panel_displaySetting_ED.Location = new System.Drawing.Point(206, 24);
  207. this.panel_displaySetting_ED.Name = "panel_displaySetting_ED";
  208. this.panel_displaySetting_ED.Size = new System.Drawing.Size(21, 21);
  209. this.panel_displaySetting_ED.TabIndex = 36;
  210. //
  211. // label_displaySetting_EC
  212. //
  213. this.label_displaySetting_EC.AutoSize = true;
  214. this.label_displaySetting_EC.Location = new System.Drawing.Point(117, 24);
  215. this.label_displaySetting_EC.Name = "label_displaySetting_EC";
  216. this.label_displaySetting_EC.Size = new System.Drawing.Size(27, 22);
  217. this.label_displaySetting_EC.TabIndex = 40;
  218. this.label_displaySetting_EC.Text = "EC";
  219. //
  220. // panel_displaySetting_EAD
  221. //
  222. this.panel_displaySetting_EAD.BackColor = System.Drawing.SystemColors.Control;
  223. this.panel_displaySetting_EAD.Location = new System.Drawing.Point(272, 24);
  224. this.panel_displaySetting_EAD.Name = "panel_displaySetting_EAD";
  225. this.panel_displaySetting_EAD.Size = new System.Drawing.Size(21, 21);
  226. this.panel_displaySetting_EAD.TabIndex = 37;
  227. //
  228. // label_displaySetting_EA
  229. //
  230. this.label_displaySetting_EA.AutoSize = true;
  231. this.label_displaySetting_EA.Location = new System.Drawing.Point(6, 24);
  232. this.label_displaySetting_EA.Name = "label_displaySetting_EA";
  233. this.label_displaySetting_EA.Size = new System.Drawing.Size(27, 22);
  234. this.label_displaySetting_EA.TabIndex = 38;
  235. this.label_displaySetting_EA.Text = "EA";
  236. //
  237. // label_displaySetting_EB
  238. //
  239. this.label_displaySetting_EB.AutoSize = true;
  240. this.label_displaySetting_EB.Location = new System.Drawing.Point(60, 24);
  241. this.label_displaySetting_EB.Name = "label_displaySetting_EB";
  242. this.label_displaySetting_EB.Size = new System.Drawing.Size(27, 22);
  243. this.label_displaySetting_EB.TabIndex = 39;
  244. this.label_displaySetting_EB.Text = "EB";
  245. //
  246. // MethodKDialog
  247. //
  248. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  249. this.ClientSize = new System.Drawing.Size(1177, 908);
  250. this.Name = "MethodKDialog";
  251. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).EndInit();
  252. this.groupBox_colorSetting.ResumeLayout(false);
  253. this.groupBox_colorSetting.PerformLayout();
  254. this.groupBox_displaySetting.ResumeLayout(false);
  255. this.groupBox_displaySetting.PerformLayout();
  256. this.ResumeLayout(false);
  257. }
  258. #endregion 初始化组件
  259. #region 需继承方法
  260. protected override void SubclassInitialize()
  261. {
  262. InitializeComponent();
  263. InitializeLanguageText();
  264. }
  265. protected override MethodOfAssessment getMethodOfAssessment()
  266. {
  267. return new MethodK(this.imgPxPerUnit);
  268. }
  269. protected override void initColorSetting()
  270. {
  271. this.radioButton_Black.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  272. this.radioButton_Gray.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  273. this.radioButton_Colored.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  274. this.radioButton_DarkGray.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  275. }
  276. protected override void initDisplaySetting()
  277. {
  278. this.panel_displaySetting_EA.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["EA"].showColor);
  279. this.panel_displaySetting_EB.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["EB"].showColor);
  280. this.panel_displaySetting_EC.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["EC"].showColor);
  281. this.panel_displaySetting_ED.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["ED"].showColor);
  282. this.panel_displaySetting_EAD.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["EAD"].showColor);
  283. this.panel_displaySetting_EF.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["EF"].showColor);
  284. }
  285. protected override void getInclusionParameters()
  286. {
  287. switch (whichChecked)
  288. {
  289. case 0:
  290. radioButton_Black.Checked = true;
  291. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Black"];
  292. break;
  293. case 1:
  294. radioButton_Black.Checked = true;
  295. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Black"];
  296. break;
  297. case 2:
  298. radioButton_Colored.Checked = true;
  299. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Colored"];
  300. break;
  301. case 3:
  302. radioButton_Gray.Checked = true;
  303. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Gray"];
  304. break;
  305. case 4:
  306. radioButton_DarkGray.Checked = true;
  307. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["DarkGray"];
  308. break;
  309. }
  310. }
  311. protected override void saveInclusionParameters()
  312. {
  313. if (radioButton_Black.Checked)
  314. {
  315. thisParameters.parameter3 = 1;
  316. }
  317. else if (radioButton_Colored.Checked)
  318. {
  319. thisParameters.parameter3 = 2;
  320. }
  321. else if (radioButton_Gray.Checked)
  322. {
  323. thisParameters.parameter3 = 3;
  324. }
  325. else if (radioButton_DarkGray.Checked)
  326. {
  327. thisParameters.parameter3 = 4;
  328. }
  329. }
  330. protected override void getOldCheck()
  331. {
  332. this.radioButton_Black.CheckedChanged -= new System.EventHandler(colorSettingRadioButton);
  333. this.radioButton_Gray.CheckedChanged -= new System.EventHandler(colorSettingRadioButton);
  334. this.radioButton_Colored.CheckedChanged -= new System.EventHandler(colorSettingRadioButton);
  335. this.radioButton_DarkGray.CheckedChanged -= new System.EventHandler(colorSettingRadioButton);
  336. switch (colorName)
  337. {
  338. case "Black":
  339. radioButton_Black.Checked = true;
  340. break;
  341. case "Gray":
  342. radioButton_Gray.Checked = true;
  343. break;
  344. case "DarkGray":
  345. radioButton_DarkGray.Checked = true;
  346. break;
  347. case "Colored":
  348. radioButton_Colored.Checked = true;
  349. break;
  350. }
  351. this.radioButton_Black.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  352. this.radioButton_Gray.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  353. this.radioButton_Colored.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  354. this.radioButton_DarkGray.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  355. }
  356. #endregion 需继承方法
  357. }
  358. }