using Resources;
using SmartCoalApplication.Base.CommTool;
using SmartCoalApplication.Base.SettingModel;
using SmartCoalApplication.Core;
using SmartCoalApplication.Resources;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SmartCoalApplication.MeasureProcedure
{
internal partial class BasicMeasureDialog : PdnBaseForm
{
AppWorkspace appWorkspace;
///
/// 系统配置
///
public ConfigModel configModel = Program.instance.configModel;
public BasicMeasureDialog(AppWorkspace appWorkspace)
{
InitializeComponent();
setLanguege();
this.appWorkspace = appWorkspace;
this.Icon = PdnInfo.AppIcon;
this.numericUpDown1.Value = Program.instance.decimalPlaces;
this.radioButton1.Checked = Program.instance.configModel.autoUpload == 1;
this.radioButton2.Checked = Program.instance.configModel.autoUpload == 2;
this.radioButton3.Checked = Program.instance.configModel.autoUpload == 3;
this.radioButton4.Checked = Program.instance.configModel.autoDownload;
this.radioButton5.Checked = !Program.instance.configModel.autoDownload;
this.radioButton6.Checked = !Program.instance.configModel.isCompression;
this.radioButton7.Checked = Program.instance.configModel.isCompression;
this.radioButton8.Checked = Program.instance.configModel.autoOpenDialog;
this.radioButton9.Checked = !Program.instance.configModel.autoOpenDialog;
this.radioButton10.Checked = Program.instance.configModel.autoSPCUpload == 3;
this.radioButton11.Checked = Program.instance.configModel.autoSPCUpload == 1;
this.radioButton12.Checked = Program.instance.configModel.autoSPCUpload == 2;
this.radioTraditionalChnse.Checked = Program.instance.configModel.Language == 2;
this.radioSimpleChnse.Checked = Program.instance.configModel.Language == 1;
}
private void setLanguege()
{
this.buttonDetermine.Text = PdnResources.GetString("BasicMeasureDialog.buttonDetermine"); // 确定
this.groupBox2.Text = PdnResources.GetString("BasicMeasureDialog.groupBox2"); // 设置
this.label1.Text = PdnResources.GetString("BasicMeasureDialog.label1"); // 小数点位数
this.label4.Text = PdnResources.GetString("BasicMeasureDialog.label4"); // 压缩报告
this.label5.Text = PdnResources.GetString("BasicMeasureDialog.label5"); // 测量视窗
this.label2.Text = PdnResources.GetString("BasicMeasureDialog.label2"); // 实验上传
this.label6.Text = PdnResources.GetString("BasicMeasureDialog.label6"); // spc上传
this.label3.Text = PdnResources.GetString("BasicMeasureDialog.label3"); // 下拉接口
this.labelLanguege.Text = PdnResources.GetString("BasicMeasureDialog.labelLanguege") + ":"; // 语言选择
this.radioSimpleChnse.Text = PdnResources.GetString("BasicMeasureDialog.radioSimpleChnse"); // 简体中文
this.radioTraditionalChnse.Text = PdnResources.GetString("BasicMeasureDialog.radioTraditionalChnse"); // 繁体中文
}
///
/// 确定
///
///
///
private void buttonDetermine_Click(object sender, EventArgs e)
{
int num = 0;
try
{
num = Convert.ToInt32(this.numericUpDown1.Value);
}
catch (Exception)
{
num = 2;
}
Program.instance.decimalPlaces = num;
bool isCheck = this.radioButton7.Checked;
Program.instance.isCompression = isCheck;
configModel.decimalPlacesNum = num;
configModel.isCompression = isCheck;
configModel.autoOpenDialog = this.radioButton8.Checked;
configModel.autoUpload = this.radioButton1.Checked ? 1 : this.radioButton2.Checked ? 2 : 3 ;
configModel.autoDownload = this.radioButton4.Checked;
configModel.autoSPCUpload = this.radioButton11.Checked ? 1 : this.radioButton12.Checked ? 2 : 3;
configModel.Language = this.radioSimpleChnse.Checked ? 1 : 2; // 設置語言
string filePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Config.xml";
string configModelXml = XmlSerializeHelper.XmlSerialize(configModel);
FileOperationHelper.WriteStringToFile(configModelXml, filePath, FileMode.Create);
this.Close();
}
///
/// 取消
///
///
///
private void buttonCancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
}