using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using PaintDotNet.Base.SettingModel;
using PaintDotNet.Base.CommTool;
using System.IO;
namespace PaintDotNet.File.BatchSaveComponet
{
internal class AutoSaveControl : UserControl
{
public CheckBox checkBox5;
public CheckBox checkBox4;
public CheckBox checkBox3;
public CheckBox checkBox2;
public CheckBox checkBox1;
private Label label1;
public TextBox textBox1;
private Label label2;
private Label label3;
private Label label4;
private Label label5;
public TextBox textBox3;
public TextBox textBox4;
public ComboBox comboBox1;
private Label label6;
public NumericUpDown numericUpDown1;
public NumericUpDown numericUpDown2;
private AppWorkspace appWorkspace;
public CheckBox checkBox6;
///
/// 文件 - 批量保存自动配置
///
public BatchSaveAutoModel batchSaveAutoModel;
public AutoSaveControl(AppWorkspace appWorkspace)
{
this.appWorkspace = appWorkspace;
InitializeComponent();
InitializeLanguageText();
InitializeData();
InitializationData();
}
private void InitializeData()
{
this.comboBox1.DataSource = new BindingSource(InvariantData.fileFormatDictionary, null);
this.comboBox1.DisplayMember = "Value";
this.comboBox1.ValueMember = "Key";
batchSaveAutoModel = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(Application.StartupPath + @"\Config\Default\File\BatchSaveAuto.xml", FileMode.Open));
}
private void InitializationData()
{
//BatchSaveAutoModel batchSaveAutoModel = new BatchSaveAutoModel();
this.textBox1.Text = batchSaveAutoModel.fileName;
this.numericUpDown2.Value = batchSaveAutoModel.startNum;
this.textBox3.Text = batchSaveAutoModel.prefix;
this.textBox4.Text = batchSaveAutoModel.suffix;
this.comboBox1.Text = batchSaveAutoModel.format;
this.checkBox1.Checked = batchSaveAutoModel.createConfig;
this.checkBox2.Checked = batchSaveAutoModel.afterSaveClost;
this.checkBox3.Checked = batchSaveAutoModel.saveGridLine;
this.checkBox4.Checked = batchSaveAutoModel.implantLabelAndMeasure;
this.checkBox5.Checked = batchSaveAutoModel.compress;
this.checkBox6.Checked = batchSaveAutoModel.implantPhase;
this.numericUpDown1.Value = batchSaveAutoModel.compressRate;
}
private void InitializeLanguageText()
{
this.checkBox5.Text = PdnResources.GetString("Menu.Compressionratio.text");
this.checkBox4.Text = PdnResources.GetString("Menu.Annotationandmddedintheimage.text");
this.checkBox3.Text = PdnResources.GetString("Menu.Savegriddata.text");
this.checkBox2.Text = PdnResources.GetString("Menu.Closeimageaftersaving.text");
this.checkBox1.Text = PdnResources.GetString("Menu.Generateconfigurationfile.text");
this.label1.Text = PdnResources.GetString("Menu.file.Batchsaving.Newfilename.text") + ":";
this.label2.Text = PdnResources.GetString("Menu.file.Batchsaving.Startnumber.text") + ":";
this.label3.Text = PdnResources.GetString("Menu.file.Batchsaving.Prefix.text") + ":";
this.label4.Text = PdnResources.GetString("Menu.file.Batchsaving.postfix.text") + ":";
this.label5.Text = PdnResources.GetString("Menu.file.Batchsaving.ImageFormat.text") + ":";
}
private void InitializeComponent()
{
this.checkBox5 = new System.Windows.Forms.CheckBox();
this.checkBox4 = new System.Windows.Forms.CheckBox();
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.checkBox6 = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.SuspendLayout();
//
// checkBox5
//
this.checkBox5.AutoSize = true;
this.checkBox5.Location = new System.Drawing.Point(72, 172);
this.checkBox5.Name = "checkBox5";
this.checkBox5.Size = new System.Drawing.Size(72, 16);
this.checkBox5.TabIndex = 20;
this.checkBox5.Text = "压缩比例";
this.checkBox5.UseVisualStyleBackColor = true;
//
// checkBox4
//
this.checkBox4.AutoSize = true;
this.checkBox4.Location = new System.Drawing.Point(298, 148);
this.checkBox4.Name = "checkBox4";
this.checkBox4.Size = new System.Drawing.Size(156, 16);
this.checkBox4.TabIndex = 19;
this.checkBox4.Text = "标注和测量信息嵌入图像";
this.checkBox4.UseVisualStyleBackColor = true;
//
// checkBox3
//
this.checkBox3.AutoSize = true;
this.checkBox3.Location = new System.Drawing.Point(72, 148);
this.checkBox3.Name = "checkBox3";
this.checkBox3.Size = new System.Drawing.Size(96, 16);
this.checkBox3.TabIndex = 18;
this.checkBox3.Text = "保存网格数据";
this.checkBox3.UseVisualStyleBackColor = true;
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(298, 125);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(108, 16);
this.checkBox2.TabIndex = 17;
this.checkBox2.Text = "保存后关闭图像";
this.checkBox2.UseVisualStyleBackColor = true;
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(72, 125);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(96, 16);
this.checkBox1.TabIndex = 16;
this.checkBox1.Text = "生成配置文件";
this.checkBox1.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(14, 14);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 21;
this.label1.Text = "新文件名:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(73, 10);
this.textBox1.MaxLength = 20;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(144, 21);
this.textBox1.TabIndex = 22;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(229, 14);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 23;
this.label2.Text = "开始数字:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(38, 41);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(41, 12);
this.label3.TabIndex = 24;
this.label3.Text = "前缀:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(253, 41);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 12);
this.label4.TabIndex = 25;
this.label4.Text = "后缀:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(14, 68);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(65, 12);
this.label5.TabIndex = 26;
this.label5.Text = "图片格式:";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(73, 37);
this.textBox3.MaxLength = 20;
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(144, 21);
this.textBox3.TabIndex = 28;
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(301, 37);
this.textBox4.MaxLength = 20;
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(144, 21);
this.textBox4.TabIndex = 29;
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(73, 64);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(144, 20);
this.comboBox1.TabIndex = 30;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(193, 174);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(11, 12);
this.label6.TabIndex = 32;
this.label6.Text = "%";
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(150, 170);
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(36, 21);
this.numericUpDown1.TabIndex = 31;
//
// numericUpDown2
//
this.numericUpDown2.Location = new System.Drawing.Point(300, 10);
this.numericUpDown2.Maximum = new decimal(new int[] {
2147483647,
0,
0,
0});
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(144, 21);
this.numericUpDown2.TabIndex = 33;
//
// checkBox6
//
this.checkBox6.AutoSize = true;
this.checkBox6.Location = new System.Drawing.Point(298, 172);
this.checkBox6.Name = "checkBox6";
this.checkBox6.Size = new System.Drawing.Size(108, 16);
this.checkBox6.TabIndex = 34;
this.checkBox6.Text = "相信息嵌入图像";
this.checkBox6.UseVisualStyleBackColor = true;
//
// AutoSaveControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.checkBox6);
this.Controls.Add(this.numericUpDown2);
this.Controls.Add(this.label6);
this.Controls.Add(this.numericUpDown1);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.checkBox5);
this.Controls.Add(this.checkBox4);
this.Controls.Add(this.checkBox3);
this.Controls.Add(this.checkBox2);
this.Controls.Add(this.checkBox1);
this.Margin = new System.Windows.Forms.Padding(0);
this.Name = "AutoSaveControl";
this.Size = new System.Drawing.Size(546, 327);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
}
}