PorosityMoreChoose.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. using PaintDotNet.Base.CommTool;
  2. using PaintDotNet.Base.DedicatedAnalysis.Porosity.Model;
  3. using PaintDotNet.DedicatedAnalysis.Porosity.PV6093;
  4. using PaintDotNet.DedicatedAnalysis.Porosity.VDGP202;
  5. using PaintDotNet.DedicatedAnalysis.Porosity.VW50093;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.IO;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15. using System.Windows.Forms;
  16. namespace PaintDotNet.DedicatedAnalysis.Porosity
  17. {
  18. internal class PorosityMoreChoose : PdnBaseForm
  19. {
  20. protected PorosityConfig porosityConfig;
  21. private Label label_lwRatioLimit;
  22. private PV6093Dialog pform;
  23. private VDGP202Dialog vDGform;
  24. private VW50093Dialog vWform;
  25. protected NumericUpDown numericUpDown_lwRatioLimit;
  26. private Label label2;
  27. protected NumericUpDown numericUpDown1;
  28. private Label label3;
  29. protected NumericUpDown numericUpDown2;
  30. private Label label4;
  31. protected NumericUpDown numericUpDown3;
  32. private Label label5;
  33. protected NumericUpDown numericUpDown4;
  34. private Label label6;
  35. protected NumericUpDown numericUpDown5;
  36. private Button button2;
  37. private Button button1;
  38. private GroupBox groupBox1;
  39. private GroupBox groupBox2;
  40. public PorosityMoreChoose(PorosityConfig porosityConfig, PV6093Dialog pform, VDGP202Dialog vDGform, VW50093Dialog vWform)
  41. {
  42. this.porosityConfig = porosityConfig;
  43. this.pform = pform;
  44. this.vDGform = vDGform;
  45. this.vWform = vWform;
  46. InitializeComponent();
  47. InitializeLanguageText();
  48. getData();
  49. }
  50. private void InitializeLanguageText()
  51. {
  52. this.label_lwRatioLimit.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Maporosity.text") + ":";
  53. this.label2.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Maximumallberofpores.text") + ":";
  54. this.label3.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Distancefactor.text") + ":";
  55. this.label4.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.roughsurface.text") + ":";
  56. this.label5.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Allowablemmeter.text") + ":";
  57. this.label6.Text = PdnResources.GetString("Menu.minimumdiameter.text") + ":";
  58. this.button2.Text = PdnResources.GetString("Form.OkButton.Text");
  59. this.button1.Text = PdnResources.GetString("ConfirmLanguageDialog.CancelTB.ActionText");
  60. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  61. this.groupBox2.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Options.text");
  62. this.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.moreoptions.text");
  63. }
  64. private void InitializeComponent()
  65. {
  66. this.label_lwRatioLimit = new System.Windows.Forms.Label();
  67. this.numericUpDown_lwRatioLimit = new System.Windows.Forms.NumericUpDown();
  68. this.label2 = new System.Windows.Forms.Label();
  69. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  70. this.label3 = new System.Windows.Forms.Label();
  71. this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
  72. this.label4 = new System.Windows.Forms.Label();
  73. this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
  74. this.label5 = new System.Windows.Forms.Label();
  75. this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
  76. this.label6 = new System.Windows.Forms.Label();
  77. this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
  78. this.button2 = new System.Windows.Forms.Button();
  79. this.button1 = new System.Windows.Forms.Button();
  80. this.groupBox1 = new System.Windows.Forms.GroupBox();
  81. this.groupBox2 = new System.Windows.Forms.GroupBox();
  82. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).BeginInit();
  83. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  84. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
  85. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
  86. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
  87. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
  88. this.groupBox1.SuspendLayout();
  89. this.groupBox2.SuspendLayout();
  90. this.SuspendLayout();
  91. //
  92. // label_lwRatioLimit
  93. //
  94. this.label_lwRatioLimit.AutoSize = true;
  95. this.label_lwRatioLimit.Location = new System.Drawing.Point(44, 41);
  96. this.label_lwRatioLimit.Name = "label_lwRatioLimit";
  97. this.label_lwRatioLimit.Size = new System.Drawing.Size(101, 12);
  98. this.label_lwRatioLimit.TabIndex = 19;
  99. //
  100. // numericUpDown_lwRatioLimit
  101. //
  102. this.numericUpDown_lwRatioLimit.DecimalPlaces = 2;
  103. this.numericUpDown_lwRatioLimit.Location = new System.Drawing.Point(151, 39);
  104. this.numericUpDown_lwRatioLimit.Maximum = new decimal(new int[] {
  105. 10000,
  106. 0,
  107. 0,
  108. 0});
  109. this.numericUpDown_lwRatioLimit.Name = "numericUpDown_lwRatioLimit";
  110. this.numericUpDown_lwRatioLimit.Size = new System.Drawing.Size(56, 21);
  111. this.numericUpDown_lwRatioLimit.TabIndex = 18;
  112. this.numericUpDown_lwRatioLimit.Value = new decimal(new int[] {
  113. 3,
  114. 0,
  115. 0,
  116. 0});
  117. //
  118. // label2
  119. //
  120. this.label2.AutoSize = true;
  121. this.label2.Location = new System.Drawing.Point(32, 132);
  122. this.label2.Name = "label2";
  123. this.label2.Size = new System.Drawing.Size(113, 12);
  124. this.label2.TabIndex = 23;
  125. //
  126. // numericUpDown1
  127. //
  128. this.numericUpDown1.DecimalPlaces = 2;
  129. this.numericUpDown1.Location = new System.Drawing.Point(151, 128);
  130. this.numericUpDown1.Maximum = new decimal(new int[] {
  131. 1000000000,
  132. 0,
  133. 0,
  134. 0});
  135. this.numericUpDown1.Name = "numericUpDown1";
  136. this.numericUpDown1.Size = new System.Drawing.Size(56, 21);
  137. this.numericUpDown1.TabIndex = 22;
  138. this.numericUpDown1.Value = new decimal(new int[] {
  139. 3,
  140. 0,
  141. 0,
  142. 0});
  143. //
  144. // label3
  145. //
  146. this.label3.AutoSize = true;
  147. this.label3.Location = new System.Drawing.Point(277, 85);
  148. this.label3.Name = "label3";
  149. this.label3.RightToLeft = System.Windows.Forms.RightToLeft.No;
  150. this.label3.Size = new System.Drawing.Size(65, 12);
  151. this.label3.TabIndex = 25;
  152. //
  153. // numericUpDown2
  154. //
  155. this.numericUpDown2.DecimalPlaces = 2;
  156. this.numericUpDown2.Location = new System.Drawing.Point(348, 81);
  157. this.numericUpDown2.Maximum = new decimal(new int[] {
  158. 100000,
  159. 0,
  160. 0,
  161. 0});
  162. this.numericUpDown2.Minimum = new decimal(new int[] {
  163. 1,
  164. 0,
  165. 0,
  166. 131072});
  167. this.numericUpDown2.Name = "numericUpDown2";
  168. this.numericUpDown2.Size = new System.Drawing.Size(56, 21);
  169. this.numericUpDown2.TabIndex = 24;
  170. this.numericUpDown2.Value = new decimal(new int[] {
  171. 3,
  172. 0,
  173. 0,
  174. 0});
  175. //
  176. // label4
  177. //
  178. this.label4.AutoSize = true;
  179. this.label4.Location = new System.Drawing.Point(277, 41);
  180. this.label4.Name = "label4";
  181. this.label4.Size = new System.Drawing.Size(65, 12);
  182. this.label4.TabIndex = 27;
  183. //
  184. // numericUpDown3
  185. //
  186. this.numericUpDown3.Location = new System.Drawing.Point(348, 38);
  187. this.numericUpDown3.Maximum = new decimal(new int[] {
  188. 100000,
  189. 0,
  190. 0,
  191. 0});
  192. this.numericUpDown3.Name = "numericUpDown3";
  193. this.numericUpDown3.Size = new System.Drawing.Size(56, 21);
  194. this.numericUpDown3.TabIndex = 26;
  195. this.numericUpDown3.Value = new decimal(new int[] {
  196. 3,
  197. 0,
  198. 0,
  199. 0});
  200. //
  201. // label5
  202. //
  203. this.label5.AutoSize = true;
  204. this.label5.Location = new System.Drawing.Point(44, 83);
  205. this.label5.Name = "label5";
  206. this.label5.Size = new System.Drawing.Size(89, 12);
  207. this.label5.TabIndex = 29;
  208. //
  209. // numericUpDown4
  210. //
  211. this.numericUpDown4.DecimalPlaces = 2;
  212. this.numericUpDown4.Location = new System.Drawing.Point(151, 83);
  213. this.numericUpDown4.Maximum = new decimal(new int[] {
  214. 1410065408,
  215. 2,
  216. 0,
  217. 0});
  218. this.numericUpDown4.Name = "numericUpDown4";
  219. this.numericUpDown4.Size = new System.Drawing.Size(56, 21);
  220. this.numericUpDown4.TabIndex = 28;
  221. this.numericUpDown4.Value = new decimal(new int[] {
  222. 3,
  223. 0,
  224. 0,
  225. 0});
  226. //
  227. // label6
  228. //
  229. this.label6.AutoSize = true;
  230. this.label6.Location = new System.Drawing.Point(277, 132);
  231. this.label6.Name = "label6";
  232. this.label6.Size = new System.Drawing.Size(65, 12);
  233. this.label6.TabIndex = 31;
  234. //
  235. // numericUpDown5
  236. //
  237. this.numericUpDown5.DecimalPlaces = 2;
  238. this.numericUpDown5.Location = new System.Drawing.Point(348, 128);
  239. this.numericUpDown5.Maximum = new decimal(new int[] {
  240. 1000000000,
  241. 0,
  242. 0,
  243. 0});
  244. this.numericUpDown5.Minimum = new decimal(new int[] {
  245. 1,
  246. 0,
  247. 0,
  248. 131072});
  249. this.numericUpDown5.Name = "numericUpDown5";
  250. this.numericUpDown5.Size = new System.Drawing.Size(56, 21);
  251. this.numericUpDown5.TabIndex = 30;
  252. this.numericUpDown5.Value = new decimal(new int[] {
  253. 3,
  254. 0,
  255. 0,
  256. 0});
  257. //
  258. // button2
  259. //
  260. this.button2.Location = new System.Drawing.Point(381, 16);
  261. this.button2.Name = "button2";
  262. this.button2.Size = new System.Drawing.Size(70, 28);
  263. this.button2.TabIndex = 1;
  264. this.button2.UseVisualStyleBackColor = true;
  265. this.button2.Click += new System.EventHandler(this.button2_Click);
  266. //
  267. // button1
  268. //
  269. this.button1.Location = new System.Drawing.Point(279, 16);
  270. this.button1.Name = "button1";
  271. this.button1.Size = new System.Drawing.Size(70, 28);
  272. this.button1.TabIndex = 0;
  273. this.button1.UseVisualStyleBackColor = true;
  274. this.button1.Click += new System.EventHandler(this.button1_Click);
  275. //
  276. // groupBox1
  277. //
  278. this.groupBox1.Controls.Add(this.button2);
  279. this.groupBox1.Controls.Add(this.button1);
  280. this.groupBox1.Location = new System.Drawing.Point(12, 3);
  281. this.groupBox1.Name = "groupBox1";
  282. this.groupBox1.Size = new System.Drawing.Size(472, 54);
  283. this.groupBox1.TabIndex = 32;
  284. this.groupBox1.TabStop = false;
  285. //
  286. // groupBox2
  287. //
  288. this.groupBox2.Controls.Add(this.label_lwRatioLimit);
  289. this.groupBox2.Controls.Add(this.numericUpDown_lwRatioLimit);
  290. this.groupBox2.Controls.Add(this.label2);
  291. this.groupBox2.Controls.Add(this.numericUpDown1);
  292. this.groupBox2.Controls.Add(this.label3);
  293. this.groupBox2.Controls.Add(this.numericUpDown2);
  294. this.groupBox2.Controls.Add(this.label4);
  295. this.groupBox2.Controls.Add(this.numericUpDown3);
  296. this.groupBox2.Controls.Add(this.label5);
  297. this.groupBox2.Controls.Add(this.numericUpDown4);
  298. this.groupBox2.Controls.Add(this.label6);
  299. this.groupBox2.Controls.Add(this.numericUpDown5);
  300. this.groupBox2.Location = new System.Drawing.Point(12, 63);
  301. this.groupBox2.Name = "groupBox2";
  302. this.groupBox2.Size = new System.Drawing.Size(472, 204);
  303. this.groupBox2.TabIndex = 33;
  304. this.groupBox2.TabStop = false;
  305. //
  306. // PorosityMoreChoose
  307. //
  308. this.ClientSize = new System.Drawing.Size(496, 273);
  309. this.Controls.Add(this.groupBox2);
  310. this.Controls.Add(this.groupBox1);
  311. this.MaximizeBox = false;
  312. this.MinimizeBox = false;
  313. this.Name = "PorosityMoreChoose";
  314. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).EndInit();
  315. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  316. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
  317. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
  318. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
  319. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
  320. this.groupBox1.ResumeLayout(false);
  321. this.groupBox2.ResumeLayout(false);
  322. this.groupBox2.PerformLayout();
  323. this.ResumeLayout(false);
  324. }
  325. #region [页面事件]
  326. /// <summary>
  327. /// 初始化赋值
  328. /// </summary>
  329. /// <param name="sender"></param>
  330. /// <param name="e"></param>
  331. private void getData()
  332. {
  333. //this.comboBox3.SelectedItem = this.porosityConfig.stressType;
  334. //this.comboBox1.SelectedItem = this.porosityConfig.diameterType;
  335. this.numericUpDown3.Value = Convert.ToDecimal(this.porosityConfig.roughSurface);
  336. this.numericUpDown_lwRatioLimit.Value = Convert.ToDecimal(this.porosityConfig.maxPorosityPercent);
  337. this.numericUpDown2.Value = Convert.ToDecimal(this.porosityConfig.distanceFactor);
  338. this.numericUpDown4.Value = Convert.ToDecimal(this.porosityConfig.maxDiameter);
  339. this.numericUpDown5.Value = Convert.ToDecimal(this.porosityConfig.minDiameter);
  340. this.numericUpDown1.Value = Convert.ToDecimal(this.porosityConfig.maxPorosityNum);
  341. }
  342. /// <summary>
  343. /// 取消关闭弹窗
  344. /// </summary>
  345. /// <param name="sender"></param>
  346. /// <param name="e"></param>
  347. private void button1_Click(object sender, EventArgs e)
  348. {
  349. this.Close();
  350. }
  351. /// <summary>
  352. /// 确定保存数据
  353. /// </summary>
  354. /// <param name="sender"></param>
  355. /// <param name="e"></param>
  356. private void button2_Click(object sender, EventArgs e)
  357. {
  358. //this.porosityConfig.diameterType = this.comboBox1.SelectedItem.ToString();
  359. //this.porosityConfig.stressType = this.comboBox3.SelectedItem.ToString();
  360. this.porosityConfig.roughSurface = Convert.ToDouble(this.numericUpDown3.Value);
  361. this.porosityConfig.maxPorosityPercent = Convert.ToDouble(this.numericUpDown_lwRatioLimit.Value);
  362. this.porosityConfig.distanceFactor = Convert.ToDouble(this.numericUpDown2.Value);
  363. this.porosityConfig.maxDiameter = Convert.ToDouble(this.numericUpDown4.Value);
  364. this.porosityConfig.minDiameter = Convert.ToDouble(this.numericUpDown5.Value);
  365. this.porosityConfig.maxPorosityNum = Convert.ToDouble(this.numericUpDown1.Value);
  366. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityConfig>(this.porosityConfig);
  367. FileOperationHelper.WriteStringToFile(porosityInfoXml, Application.StartupPath + "\\PorosityConfig\\6093Config.xml", FileMode.Create);
  368. MessageBox.Show(PdnResources.GetString("Menu.Paramsmodifiedsuccessfully.text"));
  369. if (pform != null) {
  370. this.pform.getChange(this.porosityConfig);
  371. }
  372. else if (vDGform != null) {
  373. } else if (vWform != null) {
  374. }
  375. this.Close();
  376. }
  377. #endregion
  378. }
  379. }