using Resources;
using SmartCoalApplication.Base.CommTool;
using SmartCoalApplication.Base.SettingModel;
using SmartCoalApplication.Core;
using SmartCoalApplication.PluginAssemblys;
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
{
public partial class AuxiliaryLineSetting : Form
{
private ColorsForm colorsForm;
public AuxiliaryLineSetting()
{
InitializeComponent();
setLanguege();
GuideSetting();
}
private void setLanguege ()
{
this.groupBox1.Text = PdnResources.GetString("AuxiliaryLineSetting.groupBox1");
this.buttonDetermine.Text = PdnResources.GetString("AuxiliaryLineSetting.buttonDetermine");
this.buttonCancel.Text = PdnResources.GetString("AuxiliaryLineSetting.buttonCancel");
this.groupBox16.Text = PdnResources.GetString("AuxiliaryLineSetting.groupBox16");
this.label26.Text = PdnResources.GetString("AuxiliaryLineSetting.label26");
this.label27.Text = PdnResources.GetString("AuxiliaryLineSetting.label27");
this.label28.Text = PdnResources.GetString("AuxiliaryLineSetting.label28");
}
#region [辅助线设置]
public void GuideSetting()
{
//绑定线样式数据
this.comboBox2.Items.AddRange(InvariantData.dashStyles);
//获取xml样式信息
this.comboBox2.SelectedIndex = Program.instance.configModel.girdLineStyle;
this.panel6.BackColor = Color.FromArgb(Program.instance.configModel.girdLineColour);
this.numericUpDown1.Value = Program.instance.configModel.girdLineWidth;
//
//画板
//
this.colorsForm = new ColorsForm();
this.colorsForm.StartPosition = FormStartPosition.CenterScreen;
this.colorsForm.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
}
#endregion
#region [画板颜色]
///
/// 画板点击
///
///
///
private void panel6_Click(object sender, EventArgs e)
{
this.colorsForm.UserPrimaryColor = ColorBgra.FromColor(this.panel6.BackColor);
this.colorsForm.setSaveBtn_Click(new System.EventHandler(this.panel6Changed));
this.colorsForm.ShowDialog();
}
private void panel6Changed(object sender, EventArgs e)
{
this.panel6.BackColor = this.colorsForm.UserPrimaryColor.ToColor();
this.colorsForm.Close();
}
private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
{
}
#endregion
///
/// 确定
///
///
///
private void buttonDetermine_Click(object sender, EventArgs e)
{
Program.instance.configModel.girdLineStyle = this.comboBox2.SelectedIndex;
Program.instance.configModel.girdLineColour = this.panel6.BackColor.ToArgb();
Program.instance.configModel.girdLineWidth = Convert.ToInt32(this.numericUpDown1.Value);
string filePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Config.xml";
string configModelXml = XmlSerializeHelper.XmlSerialize(Program.instance.configModel);
FileOperationHelper.WriteStringToFile(configModelXml, filePath, FileMode.Create);
this.Close();
}
///
/// 取消
///
///
///
private void buttonCancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
}