|
@@ -10,6 +10,7 @@ using System.Windows.Forms;
|
|
|
using MeasureData;
|
|
|
using System.Configuration;
|
|
|
using FileManager;
|
|
|
+using System.IO;
|
|
|
|
|
|
namespace HOZProject
|
|
|
{
|
|
@@ -29,6 +30,8 @@ namespace HOZProject
|
|
|
//模板路径
|
|
|
private string readConfigPath;
|
|
|
public string ReadConfigPath { get => readConfigPath; set => readConfigPath = value; }
|
|
|
+ //模板文件默认路径
|
|
|
+ private string m_TemplateFilePath;
|
|
|
#endregion
|
|
|
|
|
|
#region 构造方法
|
|
@@ -94,16 +97,25 @@ namespace HOZProject
|
|
|
#region 加载PT模板文件
|
|
|
private void pbTemplateFile_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
+ //判断保存的路径是否存在
|
|
|
+ if (!Directory.Exists(m_TemplateFilePath))
|
|
|
+ {
|
|
|
+ //创建路径
|
|
|
+ Directory.CreateDirectory(m_TemplateFilePath);
|
|
|
+ }
|
|
|
string FilePathName;
|
|
|
string fileNameWithoutExtension;
|
|
|
//新建一个文件对话框
|
|
|
OpenFileDialog pOpenFileDialog = new OpenFileDialog();
|
|
|
+ //设置默认打开路径(绝对路径)
|
|
|
+ pOpenFileDialog.InitialDirectory = m_TemplateFilePath;
|
|
|
//设置对话框标题
|
|
|
pOpenFileDialog.Title = "选择模板文件";
|
|
|
//设置打开文件类型
|
|
|
pOpenFileDialog.Filter = "ely文件(*.ely)|*.ely";
|
|
|
- //监测文件是否存在
|
|
|
- pOpenFileDialog.CheckFileExists = true;
|
|
|
+ ////监测文件是否存在
|
|
|
+ //pOpenFileDialog.CheckFileExists = true;
|
|
|
+
|
|
|
//文件打开后执行以下程序
|
|
|
if (pOpenFileDialog.ShowDialog() == DialogResult.OK)
|
|
|
{
|
|
@@ -117,16 +129,24 @@ namespace HOZProject
|
|
|
#region 加载FIB模板文件
|
|
|
private void pbFIBTemplateFile_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
+ //判断保存的路径是否存在
|
|
|
+ if (!Directory.Exists(m_TemplateFilePath))
|
|
|
+ {
|
|
|
+ //创建路径
|
|
|
+ Directory.CreateDirectory(m_TemplateFilePath);
|
|
|
+ }
|
|
|
string FilePathName;
|
|
|
string fileNameWithoutExtension;
|
|
|
//新建一个文件对话框
|
|
|
OpenFileDialog pOpenFileDialog = new OpenFileDialog();
|
|
|
+ //设置默认打开路径(绝对路径)
|
|
|
+ pOpenFileDialog.InitialDirectory = m_TemplateFilePath;
|
|
|
//设置对话框标题
|
|
|
pOpenFileDialog.Title = "选择模板文件";
|
|
|
//设置打开文件类型
|
|
|
pOpenFileDialog.Filter = "ely文件(*.ely)|*.ely";
|
|
|
- //监测文件是否存在
|
|
|
- pOpenFileDialog.CheckFileExists = true;
|
|
|
+ ////监测文件是否存在
|
|
|
+ //pOpenFileDialog.CheckFileExists = true;
|
|
|
//文件打开后执行以下程序
|
|
|
if (pOpenFileDialog.ShowDialog() == DialogResult.OK)
|
|
|
{
|
|
@@ -166,7 +186,17 @@ namespace HOZProject
|
|
|
cfm.SampleName = cbbWYP.Text;
|
|
|
cfm.Firm = cbbWCS.Text;
|
|
|
ConfigFile cf = new ConfigFile(cfm);
|
|
|
+ if (!m_TemplateFilePath.Equals(""))
|
|
|
+ {
|
|
|
+ if (!Directory.Exists(m_TemplateFilePath))
|
|
|
+ {
|
|
|
+ //创建路径
|
|
|
+ Directory.CreateDirectory(m_TemplateFilePath);
|
|
|
+ }
|
|
|
+ }
|
|
|
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
|
|
+ //设置默认打开路径(绝对路径)
|
|
|
+ saveFileDialog.InitialDirectory = m_TemplateFilePath;
|
|
|
saveFileDialog.Filter = "样品参数文件|*.cfg";
|
|
|
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
|
|
{
|
|
@@ -388,6 +418,7 @@ namespace HOZProject
|
|
|
cbbWQGF.Items.Clear();
|
|
|
cbbWLZ.Items.Clear();
|
|
|
|
|
|
+ m_TemplateFilePath = config.AppSettings.Settings["TemplateFilePath"].Value.ToString();
|
|
|
string sample_Type = config.AppSettings.Settings["Sample_Type"].Value.ToString();
|
|
|
string firm = config.AppSettings.Settings["Firm"].Value.ToString();
|
|
|
string WPZDTemp = config.AppSettings.Settings["WPZD"].Value.ToString();
|