AutoSaveControl.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. using Resources;
  2. using SmartCoalApplication.Base.CommTool;
  3. using SmartCoalApplication.Base.SettingModel;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.IO;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Forms;
  14. namespace SmartCoalApplication.File.BatchSaveComponet
  15. {
  16. internal class AutoSaveControl : UserControl
  17. {
  18. public CheckBox checkBox5;
  19. public CheckBox checkBox2;
  20. public CheckBox checkBox1;
  21. private Label label1;
  22. public TextBox textBox1;
  23. private Label label2;
  24. private Label label3;
  25. private Label label4;
  26. private Label label5;
  27. public TextBox textBox3;
  28. public TextBox textBox4;
  29. public ComboBox comboBox1;
  30. private Label label6;
  31. public NumericUpDown numericUpDown1;
  32. public NumericUpDown numericUpDown2;
  33. private AppWorkspace appWorkspace;
  34. /// <summary>
  35. /// 文件 - 批量保存自动配置
  36. /// </summary>
  37. public BatchSaveAutoModel batchSaveAutoModel;
  38. public AutoSaveControl(AppWorkspace appWorkspace)
  39. {
  40. this.appWorkspace = appWorkspace;
  41. InitializeComponent();
  42. InitializeLanguageText();
  43. InitializeData();
  44. InitializationData();
  45. }
  46. private void InitializeData()
  47. {
  48. this.comboBox1.DataSource = new BindingSource(InvariantData.fileFormatDictionary, null);
  49. this.comboBox1.DisplayMember = "Value";
  50. this.comboBox1.ValueMember = "Key";
  51. batchSaveAutoModel = XmlSerializeHelper.DESerializer<BatchSaveAutoModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + @"\Config\Default\File\BatchSaveAuto.xml", FileMode.Open));
  52. }
  53. private void InitializationData()
  54. {
  55. //BatchSaveAutoModel batchSaveAutoModel = new BatchSaveAutoModel();
  56. this.textBox1.Text = batchSaveAutoModel.fileName;
  57. this.numericUpDown2.Value = batchSaveAutoModel.startNum;
  58. this.textBox3.Text = batchSaveAutoModel.prefix;
  59. this.textBox4.Text = batchSaveAutoModel.suffix;
  60. this.comboBox1.Text = batchSaveAutoModel.format;
  61. this.checkBox1.Checked = batchSaveAutoModel.createConfig;
  62. this.checkBox2.Checked = batchSaveAutoModel.afterSaveClost;
  63. this.checkBox5.Checked = batchSaveAutoModel.compress;
  64. this.numericUpDown1.Value = batchSaveAutoModel.compressRate;
  65. }
  66. private void InitializeLanguageText()
  67. {
  68. this.checkBox5.Text = PdnResources.GetString("Menu.Compressionratio.text");
  69. this.checkBox2.Text = PdnResources.GetString("Menu.Closeimageaftersaving.text");
  70. this.checkBox1.Text = PdnResources.GetString("Menu.Generateconfigurationfile.text");
  71. this.label1.Text = PdnResources.GetString("Menu.file.Batchsaving.Newfilename.text") + ":";
  72. this.label2.Text = PdnResources.GetString("Menu.file.Batchsaving.Startnumber.text") + ":";
  73. this.label3.Text = PdnResources.GetString("Menu.file.Batchsaving.Prefix.text") + ":";
  74. this.label4.Text = PdnResources.GetString("Menu.file.Batchsaving.postfix.text") + ":";
  75. this.label5.Text = PdnResources.GetString("Menu.file.Batchsaving.ImageFormat.text") + ":";
  76. }
  77. private void InitializeComponent()
  78. {
  79. this.checkBox5 = new System.Windows.Forms.CheckBox();
  80. this.checkBox2 = new System.Windows.Forms.CheckBox();
  81. this.checkBox1 = new System.Windows.Forms.CheckBox();
  82. this.label1 = new System.Windows.Forms.Label();
  83. this.textBox1 = new System.Windows.Forms.TextBox();
  84. this.label2 = new System.Windows.Forms.Label();
  85. this.label3 = new System.Windows.Forms.Label();
  86. this.label4 = new System.Windows.Forms.Label();
  87. this.label5 = new System.Windows.Forms.Label();
  88. this.textBox3 = new System.Windows.Forms.TextBox();
  89. this.textBox4 = new System.Windows.Forms.TextBox();
  90. this.comboBox1 = new System.Windows.Forms.ComboBox();
  91. this.label6 = new System.Windows.Forms.Label();
  92. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  93. this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
  94. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  95. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
  96. this.SuspendLayout();
  97. //
  98. // checkBox5
  99. //
  100. this.checkBox5.AutoSize = true;
  101. this.checkBox5.Location = new System.Drawing.Point(72, 147);
  102. this.checkBox5.Name = "checkBox5";
  103. this.checkBox5.Size = new System.Drawing.Size(72, 16);
  104. this.checkBox5.TabIndex = 20;
  105. this.checkBox5.Text = "压缩比例";
  106. this.checkBox5.UseVisualStyleBackColor = true;
  107. //
  108. // checkBox2
  109. //
  110. this.checkBox2.AutoSize = true;
  111. this.checkBox2.Location = new System.Drawing.Point(298, 125);
  112. this.checkBox2.Name = "checkBox2";
  113. this.checkBox2.Size = new System.Drawing.Size(108, 16);
  114. this.checkBox2.TabIndex = 17;
  115. this.checkBox2.Text = "保存后关闭图像";
  116. this.checkBox2.UseVisualStyleBackColor = true;
  117. //
  118. // checkBox1
  119. //
  120. this.checkBox1.AutoSize = true;
  121. this.checkBox1.Location = new System.Drawing.Point(72, 125);
  122. this.checkBox1.Name = "checkBox1";
  123. this.checkBox1.Size = new System.Drawing.Size(96, 16);
  124. this.checkBox1.TabIndex = 16;
  125. this.checkBox1.Text = "生成配置文件";
  126. this.checkBox1.UseVisualStyleBackColor = true;
  127. //
  128. // label1
  129. //
  130. this.label1.AutoSize = true;
  131. this.label1.Location = new System.Drawing.Point(14, 14);
  132. this.label1.Name = "label1";
  133. this.label1.Size = new System.Drawing.Size(65, 12);
  134. this.label1.TabIndex = 21;
  135. this.label1.Text = "新文件名:";
  136. //
  137. // textBox1
  138. //
  139. this.textBox1.Location = new System.Drawing.Point(73, 10);
  140. this.textBox1.MaxLength = 20;
  141. this.textBox1.Name = "textBox1";
  142. this.textBox1.Size = new System.Drawing.Size(144, 21);
  143. this.textBox1.TabIndex = 22;
  144. //
  145. // label2
  146. //
  147. this.label2.AutoSize = true;
  148. this.label2.Location = new System.Drawing.Point(229, 14);
  149. this.label2.Name = "label2";
  150. this.label2.Size = new System.Drawing.Size(65, 12);
  151. this.label2.TabIndex = 23;
  152. this.label2.Text = "开始数字:";
  153. //
  154. // label3
  155. //
  156. this.label3.AutoSize = true;
  157. this.label3.Location = new System.Drawing.Point(38, 41);
  158. this.label3.Name = "label3";
  159. this.label3.Size = new System.Drawing.Size(41, 12);
  160. this.label3.TabIndex = 24;
  161. this.label3.Text = "前缀:";
  162. //
  163. // label4
  164. //
  165. this.label4.AutoSize = true;
  166. this.label4.Location = new System.Drawing.Point(253, 41);
  167. this.label4.Name = "label4";
  168. this.label4.Size = new System.Drawing.Size(41, 12);
  169. this.label4.TabIndex = 25;
  170. this.label4.Text = "后缀:";
  171. //
  172. // label5
  173. //
  174. this.label5.AutoSize = true;
  175. this.label5.Location = new System.Drawing.Point(14, 68);
  176. this.label5.Name = "label5";
  177. this.label5.Size = new System.Drawing.Size(65, 12);
  178. this.label5.TabIndex = 26;
  179. this.label5.Text = "图片格式:";
  180. //
  181. // textBox3
  182. //
  183. this.textBox3.Location = new System.Drawing.Point(73, 37);
  184. this.textBox3.MaxLength = 20;
  185. this.textBox3.Name = "textBox3";
  186. this.textBox3.Size = new System.Drawing.Size(144, 21);
  187. this.textBox3.TabIndex = 28;
  188. //
  189. // textBox4
  190. //
  191. this.textBox4.Location = new System.Drawing.Point(301, 37);
  192. this.textBox4.MaxLength = 20;
  193. this.textBox4.Name = "textBox4";
  194. this.textBox4.Size = new System.Drawing.Size(144, 21);
  195. this.textBox4.TabIndex = 29;
  196. //
  197. // comboBox1
  198. //
  199. this.comboBox1.FormattingEnabled = true;
  200. this.comboBox1.Location = new System.Drawing.Point(73, 64);
  201. this.comboBox1.Name = "comboBox1";
  202. this.comboBox1.Size = new System.Drawing.Size(144, 20);
  203. this.comboBox1.TabIndex = 30;
  204. //
  205. // label6
  206. //
  207. this.label6.AutoSize = true;
  208. this.label6.Location = new System.Drawing.Point(193, 149);
  209. this.label6.Name = "label6";
  210. this.label6.Size = new System.Drawing.Size(11, 12);
  211. this.label6.TabIndex = 32;
  212. this.label6.Text = "%";
  213. //
  214. // numericUpDown1
  215. //
  216. this.numericUpDown1.Location = new System.Drawing.Point(150, 145);
  217. this.numericUpDown1.Name = "numericUpDown1";
  218. this.numericUpDown1.Size = new System.Drawing.Size(36, 21);
  219. this.numericUpDown1.TabIndex = 31;
  220. //
  221. // numericUpDown2
  222. //
  223. this.numericUpDown2.Location = new System.Drawing.Point(300, 10);
  224. this.numericUpDown2.Maximum = new decimal(new int[] {
  225. 2147483647,
  226. 0,
  227. 0,
  228. 0});
  229. this.numericUpDown2.Name = "numericUpDown2";
  230. this.numericUpDown2.Size = new System.Drawing.Size(144, 21);
  231. this.numericUpDown2.TabIndex = 33;
  232. //
  233. // AutoSaveControl
  234. //
  235. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  236. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  237. this.Controls.Add(this.numericUpDown2);
  238. this.Controls.Add(this.label6);
  239. this.Controls.Add(this.numericUpDown1);
  240. this.Controls.Add(this.comboBox1);
  241. this.Controls.Add(this.textBox4);
  242. this.Controls.Add(this.textBox3);
  243. this.Controls.Add(this.label5);
  244. this.Controls.Add(this.label4);
  245. this.Controls.Add(this.label3);
  246. this.Controls.Add(this.label2);
  247. this.Controls.Add(this.textBox1);
  248. this.Controls.Add(this.label1);
  249. this.Controls.Add(this.checkBox5);
  250. this.Controls.Add(this.checkBox2);
  251. this.Controls.Add(this.checkBox1);
  252. this.Margin = new System.Windows.Forms.Padding(0);
  253. this.Name = "AutoSaveControl";
  254. this.Size = new System.Drawing.Size(546, 327);
  255. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  256. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
  257. this.ResumeLayout(false);
  258. this.PerformLayout();
  259. }
  260. }
  261. }