using FileManager;
using MeasureData;
using MeasureThread;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
//using SenseShield;
using System.Threading.Tasks;
using System.Windows.Forms;
using static MeasureThread.ThreadStatusEventArgs;
namespace HOZProject
{
public partial class FormHOZMain : Form
{
#region 控制窗体可以调整大小用
const int HTLEFT = 10;
const int HTRIGHT = 11;
const int HTTOP = 12;
const int HTTOPLEFT = 13;
const int HTTOPRIGHT = 14;
const int HTBOTTOM = 15;
const int HTBOTTOMLEFT = 0x10;
const int HTBOTTOMRIGHT = 17;
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case 0x0084:
base.WndProc(ref m);
Point vPoint = new Point((int)m.LParam & 0xFFFF,
(int)m.LParam >> 16 & 0xFFFF);
vPoint = PointToClient(vPoint);
if (vPoint.X <= 5)
if (vPoint.Y <= 5)
m.Result = (IntPtr)HTTOPLEFT;
else if (vPoint.Y >= ClientSize.Height - 5)
m.Result = (IntPtr)HTBOTTOMLEFT;
else m.Result = (IntPtr)HTLEFT;
else if (vPoint.X >= ClientSize.Width - 5)
if (vPoint.Y <= 5)
m.Result = (IntPtr)HTTOPRIGHT;
else if (vPoint.Y >= ClientSize.Height - 5)
m.Result = (IntPtr)HTBOTTOMRIGHT;
else m.Result = (IntPtr)HTRIGHT;
else if (vPoint.Y <= 5)
m.Result = (IntPtr)HTTOP;
else if (vPoint.Y >= ClientSize.Height - 5)
m.Result = (IntPtr)HTBOTTOM;
break;
case 0x0201://鼠标左键按下的消息
m.Msg = 0x00A1;//更改消息为非客户区按下鼠标
m.LParam = IntPtr.Zero;//默认值
m.WParam = new IntPtr(2);//鼠标放在标题栏内
base.WndProc(ref m);
break;
default:
base.WndProc(ref m);
break;
}
}
#endregion
#region 成员变量
private NLog.Logger log;
///
/// 控制闪烁
///
public static bool ControlFlicker;//控制流程闪烁
public BackgroundWorker m_BackgroundWorker;// 申明后台对象
///
/// 测量文件
///
public MeasureFile m_MeasureFile;
/// 测量线程
public Measure m_Ms;
///
/// 显示日志窗体
///
Form m_FormLog = null;
///
/// 显示实例化窗体
///
FormMove m_FormInit = null;
///
/// 是否已保存
///
public bool IsSave = false;
///
/// 初始化用户控件
///
UControl_Init uControl_Init = null;
///
/// 日志用户控件
///
UControl_Log ucLog = null;
//流程控制
public int m_MeasureType = (int)MeasureMsgManage.measureType.FIB;
//是否关闭窗体标识
public bool IsClose = false;
OTSMeasureOutputNlog logwin;
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
#endregion
#region 构造函数
public FormHOZMain()
{
InitializeComponent();
//在线程操作过程中,可以设置控件属性
Control.CheckForIllegalCrossThreadCalls = false;
m_BackgroundWorker = new BackgroundWorker(); // 实例化后台对象
m_BackgroundWorker.WorkerReportsProgress = true; // 设置可以通告进度
m_BackgroundWorker.WorkerSupportsCancellation = true; // 设置可以取消
m_BackgroundWorker.DoWork += new DoWorkEventHandler(DoWork);
m_BackgroundWorker.ProgressChanged += new ProgressChangedEventHandler(UpdateProgress);
m_BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CompletedWork);
//LogManager.InitManulLog();
}
#endregion
#region 测量线程
void DoWork(object sender, DoWorkEventArgs e)
{
try
{
m_MeasureFile.MParam.AutoFocus.UP = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_UP"].ToString());
m_MeasureFile.MParam.AutoFocus.Down = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_Down"].ToString());
m_MeasureFile.MParam.AutoFocus.Step = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_Step"].ToString());
m_MeasureFile.MParam.AutoFocus.Range = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_Range"].ToString());
m_MeasureFile.MParam.AutoFocus.fStep = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_FStep"].ToString());
m_MeasureFile.MParam.FIBFocus.UP = Convert.ToSingle(ConfigurationManager.AppSettings["FIB_UP"].ToString());
m_MeasureFile.MParam.FIBFocus.Down = Convert.ToSingle(ConfigurationManager.AppSettings["FIB_Down"].ToString());
m_MeasureFile.MParam.FIBFocus.Step = Convert.ToSingle(ConfigurationManager.AppSettings["FIB_Step"].ToString());
m_MeasureFile.MParam.FIBFocus.Range = Convert.ToSingle(ConfigurationManager.AppSettings["FIB_Range"].ToString());
m_MeasureFile.MParam.FIBFocus.fStep = Convert.ToSingle(ConfigurationManager.AppSettings["FIB_FStep"].ToString());
m_MeasureFile.MParam.AutoStigX.UP = Convert.ToSingle(ConfigurationManager.AppSettings["StigX_UP"].ToString());
m_MeasureFile.MParam.AutoStigX.Down = Convert.ToSingle(ConfigurationManager.AppSettings["StigX_Down"].ToString());
m_MeasureFile.MParam.AutoStigX.Step = Convert.ToSingle(ConfigurationManager.AppSettings["StigX_Step"].ToString());
m_MeasureFile.MParam.AutoStigX.Range = Convert.ToSingle(ConfigurationManager.AppSettings["StigX_Range"].ToString());
m_MeasureFile.MParam.AutoStigX.fStep = Convert.ToSingle(ConfigurationManager.AppSettings["StigX_FStep"].ToString());
m_MeasureFile.MParam.AutoStigY.UP = Convert.ToSingle(ConfigurationManager.AppSettings["StigY_UP"].ToString());
m_MeasureFile.MParam.AutoStigY.Down = Convert.ToSingle(ConfigurationManager.AppSettings["StigY_Down"].ToString());
m_MeasureFile.MParam.AutoStigY.Step = Convert.ToSingle(ConfigurationManager.AppSettings["StigY_Step"].ToString());
m_MeasureFile.MParam.AutoStigY.Range = Convert.ToSingle(ConfigurationManager.AppSettings["StigY_Range"].ToString());
m_MeasureFile.MParam.AutoStigY.fStep = Convert.ToSingle(ConfigurationManager.AppSettings["StigY_FStep"].ToString());
m_MeasureFile.MParam.FIBDo= Convert.ToBoolean(ConfigurationManager.AppSettings["Is_FIBDo"]);
m_MeasureFile.MParam.FIBAutoBC = Convert.ToBoolean(ConfigurationManager.AppSettings["Is_FIBAutoBc"]);
m_MeasureFile.MParam.FIBB = Convert.ToSingle(ConfigurationManager.AppSettings["FIBB"]);
m_MeasureFile.MParam.FIBC = Convert.ToSingle(ConfigurationManager.AppSettings["FIBC"]);
m_MeasureFile.MParam.MagComp = Convert.ToBoolean(ConfigurationManager.AppSettings["MagComp"]);
m_MeasureFile.MParam.MagRange1 = Convert.ToSingle(ConfigurationManager.AppSettings["MagRange1"]);
m_MeasureFile.MParam.MagRange2 = Convert.ToSingle(ConfigurationManager.AppSettings["MagRange2"]);
m_MeasureFile.MParam.MagRange3 = Convert.ToSingle(ConfigurationManager.AppSettings["MagRange3"]);
m_MeasureFile.MParam.MagCompX1 = Convert.ToSingle(ConfigurationManager.AppSettings["MagCompX1"]);
m_MeasureFile.MParam.MagCompX2 = Convert.ToSingle(ConfigurationManager.AppSettings["MagCompX2"]);
m_MeasureFile.MParam.MagCompX3 = Convert.ToSingle(ConfigurationManager.AppSettings["MagCompX3"]);
m_MeasureFile.MParam.MagCompY1 = Convert.ToSingle(ConfigurationManager.AppSettings["MagCompY1"]);
m_MeasureFile.MParam.MagCompY2 = Convert.ToSingle(ConfigurationManager.AppSettings["MagCompY2"]);
m_MeasureFile.MParam.MagCompY3 = Convert.ToSingle(ConfigurationManager.AppSettings["MagCompY3"]);
//Z轴移动距离
m_MeasureFile.MParam.ZDistance= Convert.ToSingle(ConfigurationManager.AppSettings["ZDistance"]);
//add by sun 2020-12-15 增加不同样品扫描速度参数
m_MeasureFile.MParam.ScanSpeedNormal = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedNormal_" + m_MeasureFile.MParam.SampleName]);
m_MeasureFile.MParam.ScanSpeedFocus = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedFocus_" + m_MeasureFile.MParam.SampleName]);
m_MeasureFile.MParam.ScanSpeedHigh = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedHigh_" + m_MeasureFile.MParam.SampleName]);
//log.Info("==============="+ ConfigurationManager.AppSettings["ScanSpeedNormal_3"] + "========="+ m_MeasureFile.MParam.SampleName, true);
//add by sun 2020-12-15 增加不同样品扫描速度参数 end
//add by sun 2020-12-17 增加调试时是否切割开关
m_MeasureFile.MParam.IsCutingForDebug = Convert.ToBoolean(ConfigurationManager.AppSettings["IsCutingForDebug"]);
//add by sun 2020-12-17 增加调试时是否切割开关 end
// add by zjx 2020-12-18 为了测试只做能谱部分
m_MeasureFile.MParam.IsonlyEDSForDebug = Convert.ToBoolean(ConfigurationManager.AppSettings["IsonlyEDSForDebug"]);
// add by zjx 2020-12-18 为了测试只做能谱部分 end
m_Ms = new Measure(ConfigurationManager.AppSettings["WebServerIP"].ToString(),
ConfigurationManager.AppSettings["WebServerPort"].ToString(),
ConfigurationManager.AppSettings["WebServerUrl"].ToString());
m_Ms.X_Min = Convert.ToSingle(ConfigurationManager.AppSettings["X_Min"]);
m_Ms.X_Max = Convert.ToSingle(ConfigurationManager.AppSettings["X_Max"]);
m_Ms.Y_Min = Convert.ToSingle(ConfigurationManager.AppSettings["Y_Min"]);
m_Ms.Y_Max = Convert.ToSingle(ConfigurationManager.AppSettings["Y_Max"]);
m_Ms.Z_Min = Convert.ToSingle(ConfigurationManager.AppSettings["Z_Min"]);
m_Ms.Z_Max = Convert.ToSingle(ConfigurationManager.AppSettings["Z_Max"]);
m_Ms.T_Min = Convert.ToSingle(ConfigurationManager.AppSettings["T_Min"]);
m_Ms.T_Max = Convert.ToSingle(ConfigurationManager.AppSettings["T_Max"]);
m_Ms.R_Min = Convert.ToSingle(ConfigurationManager.AppSettings["R_Min"]);
m_Ms.R_Max = Convert.ToSingle(ConfigurationManager.AppSettings["R_Max"]);
m_Ms.M_Min = Convert.ToSingle(ConfigurationManager.AppSettings["M_Min"]);
m_Ms.M_Max = Convert.ToSingle(ConfigurationManager.AppSettings["M_Max"]);
//人工干预
m_Ms.hand_intervene = Convert.ToInt32(ConfigurationManager.AppSettings["Hand_Intervene"]);
//SmartSEM远程路径
m_Ms.RemoteELYPath = ConfigurationManager.AppSettings["RemoteELYPath"];
m_Ms.RemoteMLFPath = ConfigurationManager.AppSettings["RemoteMLFPath"];
m_Ms.InitMeasure(m_MeasureFile);
//注册事件
m_Ms.SendThreadStatus += new ThreadStatusHandler(displayMessage);
//注册事件
m_Ms.SendCutHolesStatus += new CutHolesStatusHandler(displayCutHoleMessage);
//设置控件操作
SetWinControlMeasureState(false);
//自动测量的全过程
m_Ms.DoMeasure();
}
catch (Exception ex)
{
log.Error(ex.ToString(),false);
}
}
public void displayMessage(object sender, ThreadStatusEventArgs e)
{
//主界面显示内容
this.BeginInvoke((Action)delegate
{
this.listmsg.Items.Add(e.HoleName +"_" + e.Time.ToString() + "_"+ e.Message + "_" + e.State );
//显示流程中对应编号的内容
MeasureMsgManage.ShowMsgContent(this, e);
AddLogListInfo(e);
});
}
public void displayCutHoleMessage(object sender, CutHolesStatusEventArgs e)
{
//主界面显示内容
this.BeginInvoke((Action)delegate
{
//修改切孔状态
ChangeCutHoleState(e.HoleName.ToString(), Convert.ToInt32(e.State));
});
}
void UpdateProgress(object sender, ProgressChangedEventArgs e)
{
}
void CompletedWork(object sender, RunWorkerCompletedEventArgs e)
{
ControlFlicker = false;
//设置控件操作
MessageBox.Show("测量已完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
SetWinControlMeasureState(true);
pbStop.Visible = false;
pbStart.Visible = true;
//UControl_ParaInfo uControl_ParaInfo=new UControl_ParaInfo()
UControl_ParaInfo uControl_ParaInfo = new UControl_ParaInfo(this);
uControl_ParaInfo.pbMeasure.Value = 100;
uControl_ParaInfo.lblCompletedAmount.Text = "100%";
}
#endregion
#region 窗体加载
private void FormHOZMain_Load(object sender, EventArgs e)
{
try
{
// DogDecrypting.decrypting(100);//参数为许可号
//加载控件的点击事件
this.Click += new EventHandler(FormHOZMain_Click);
plFill.Click += new EventHandler(FormHOZMain_Click);
plTop.Click += new EventHandler(FormHOZMain_Click);
plLeft.Click += new EventHandler(FormHOZMain_Click);
plLeftContent.Click += new EventHandler(FormHOZMain_Click);
pbImage.Click += new EventHandler(FormHOZMain_Click);
//加载窗口移动事件
this.MouseDown += new MouseEventHandler(FormHOZMain_MouseDown);
this.plTop.MouseDown += new MouseEventHandler(FormHOZMain_MouseDown);
//新建
NewCreate();
//实例初始化窗体对象
if (uControl_Init == null)
{
uControl_Init = new UControl_Init(this);
uControl_Init.ReloadConfig();
}
logwin = new OTSMeasureOutputNlog();
logwin.Show();
logwin.Height = this.Height;
logwin.Left = this.Left - logwin.Width;
logwin.Top = this.Top;
NLog.Config.LoggingRule lr = NLog.LogManager.Configuration.LoggingRules.FirstOrDefault(
r => r.Targets.Any(
t => "control" == t.Name
)
);
if (lr != null)
{
}
log = NLog.LogManager.GetCurrentClassLogger();
ConfigurationParameter();
this.Left = this.Location.X + logwin.Width / 2;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "错误:", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.Close();
}
}
#endregion
#region 创建切孔列表信息
///
/// 创建切孔列表信息
///
///
public void CreateCutHoleList(List ListCutHole)
{
//清空左侧Panel中的切孔控件
ClearPanelControls();
for (int i = ListCutHole.Count - 1; i >= 0; i--)
{
UControl_CutHole ucCutHole = new UControl_CutHole(this);
ucCutHole.Dock = DockStyle.Top;
ucCutHole.CutHoleName = ListCutHole[i].HoleName;
//显示切孔参数信息
if (ucCutHole.UControl_ParaInfo == null)
{
ucCutHole.UControl_ParaInfo = new UControl_ParaInfo(this);
}
plPrarInfo.Width = ucCutHole.UControl_ParaInfo.Width;
plPrarInfo.Height = ucCutHole.UControl_ParaInfo.Height;
//设置当前样品的参数信息
string CutHoleName = ListCutHole[i].HoleName;
ucCutHole.UControl_ParaInfo.Name = CutHoleName;
ucCutHole.UControl_ParaInfo.CutHoleName = CutHoleName;
ucCutHole.UControl_ParaInfo.Position = ListCutHole[i].Position;
ucCutHole.UControl_ParaInfo.StartTime = ListCutHole[i].START.ToString();
ucCutHole.UControl_ParaInfo.EndTime = ListCutHole[i].END.ToString();
int state = (int)ListCutHole[i].STATE;
ucCutHole.UControl_ParaInfo.State = state;
ucCutHole.UControl_ParaInfo.IsSwitch = ListCutHole[i].SWITCH;
ucCutHole.UControl_ParaInfo.ShowParaInfo();
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
plPrarInfo.Controls.Add(ucCutHole.UControl_ParaInfo);
plLeftContent.Controls.Add(ucCutHole);
ChangeCutHoleState(CutHoleName, state);
}
plPrarInfo.Visible = false;
}
#endregion
#region 隐藏处理层
//隐藏处理层
private void FormHOZMain_Click(object sender, EventArgs e)
{
if (plPrarInfo.Visible)
{
plPrarInfo.Visible = false;
}
}
#endregion
#region 设置控件在线程过程中的编辑状态
///
/// 设置控件在线程过程中的编辑状态
///
///
public void SetWinControlMeasureState(bool cState)
{
pbNew.Enabled = cState;
pbOpen.Enabled = cState;
pbSave.Enabled = cState;
pbInit.Enabled = cState;
pbImportTemplateFile.Enabled = cState;
//pbLog.Enabled = cState;
pbStart.Enabled = cState;
pbStop.Enabled = !cState;
//设置切孔是否执行
foreach (Control item in plPrarInfo.Controls)
{
if (item is UserControl)
{
UControl_ParaInfo ucParaInfo = (UControl_ParaInfo)item;
ucParaInfo.CkIsSwitch.Enabled = cState;
}
}
}
#endregion
#region 窗体中 线程开始 停止 最大化 最小化 关闭 按钮事件
private void pbMin_MouseEnter(object sender, EventArgs e)
{
this.pbMin.BackgroundImage = global::HOZProject.Properties.Resources.Min_2_;
}
private void pbMin_MouseLeave(object sender, EventArgs e)
{
this.pbMin.BackgroundImage = global::HOZProject.Properties.Resources.Min_2_;
}
private void pbMax_MouseEnter(object sender, EventArgs e)
{
this.pbMax.BackgroundImage = global::HOZProject.Properties.Resources.Max_2_;
}
private void pbMax_MouseLeave(object sender, EventArgs e)
{
this.pbMax.BackgroundImage = global::HOZProject.Properties.Resources.Max_2_;
}
private void pbClose_MouseEnter(object sender, EventArgs e)
{
this.pbClose.BackgroundImage = global::HOZProject.Properties.Resources.exit_2_;
}
private void pbClose_MouseLeave(object sender, EventArgs e)
{
this.pbClose.BackgroundImage = global::HOZProject.Properties.Resources.exit_2_;
}
private void pbStart_MouseEnter(object sender, EventArgs e)
{
//this.pbStart.BackgroundImage = global::HOZProject.Properties.Resources.StartMove;
}
private void pbStart_MouseLeave(object sender, EventArgs e)
{
//this.pbStart.BackgroundImage = global::HOZProject.Properties.Resources.Start_3_;
}
private void pbStop_MouseEnter(object sender, EventArgs e)
{
//this.pbStop.BackgroundImage = global::HOZProject.Properties.Resources.StopMove;
}
private void pbStop_MouseLeave(object sender, EventArgs e)
{
//this.pbStop.BackgroundImage = global::HOZProject.Properties.Resources.Stop;
}
private void pbClose_Click(object sender, EventArgs e)
{
try
{
if (m_Ms != null)
{
if (m_BackgroundWorker.IsBusy)
{
if (MessageBox.Show("当前测量正在运行,是否关闭此窗体?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
//线程停止变量
m_Ms.key_stop = true;
IsClose = true;
lblStateMessage.Text = "正在关闭窗体...请等待";
pbClose.Enabled = false;
ControlFlicker = false;
}
return;
}
}
if (MessageBox.Show("是否关闭此窗体?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
m_MeasureFile.Save();
this.Close();
}
}
catch (Exception ex)
{
log.Error(ex.Message);
}
}
private void pbMin_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void pbMax_Click(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
}
else
{
this.WindowState = FormWindowState.Maximized;
}
//窗体据中
this.StartPosition = FormStartPosition.CenterScreen;
}
#endregion
#region 新建、保存、打开、初始化、导入配置、查看日志
private void pbNew_Click(object sender, EventArgs e)
{
NewCreate();
}
private void NewCreate()
{
m_MeasureFile = new MeasureFile();
if (!m_MeasureFile.New())
{
return;
}
else
{
//清空内容容器中的控件
ClearPanelControls();
}
//实例初始化窗体对象
if (uControl_Init == null)
{
uControl_Init = new UControl_Init(this);
uControl_Init.ReloadConfig();
}
m_MeasureFile.MParam = uControl_Init.GetMeasureParam();
}
private void pbSave_Click(object sender, EventArgs e)
{
Saveclick();
}
public void Saveclick()
{
if (m_MeasureFile == null)
{
MessageBox.Show("请新建一个测量文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
//保存测量文件
if (m_MeasureFile.SaveAs())
{
//获取测量文件所在路径
string savePath = m_MeasureFile.FilePath;
//数据库名称
string dbFileName = "MeasureDB.db";
//要复制的文件路径
string pLocalFilePath = Application.StartupPath + "\\" + dbFileName;
string pSaveFilePath = savePath + "\\" + dbFileName;//指定存储的路径
if (File.Exists(pLocalFilePath))//必须判断要复制的文件是否存在
{
//三个参数分别是源文件路径,存储路径,若存储路径有相同文件是否替换
//File.Copy(pLocalFilePath, pSaveFilePath, true);
}
//将初始化中的参数,配置到测量参数中
m_MeasureFile.MParam = uControl_Init.GetMeasureParamInfo();
//设置已保存状态
IsSave = true;
}
}
}
private void pbOpen_Click(object sender, EventArgs e)
{
try
{
//打开默认路径
OpenFileDialog openFileDialog = new OpenFileDialog();
//设置筛选文件格式
openFileDialog.Filter = "测量文件(*.msf)|*.msf";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
//读取文件
string measureFileNamePath = openFileDialog.FileName;
m_MeasureFile.FileName = measureFileNamePath;
m_MeasureFile.Open();
List ListCutHole = m_MeasureFile.ListCutHole;
//文件路径
string CutHoleFilePath = m_MeasureFile.CutHoleFilePath;
CreateCutHoleList(ListCutHole);
////保存测量文件
//m_MeasureFile.Save();
//设置已保存状态
IsSave = true;
}
}
catch (Exception ex)
{
log.Error(ex.Message);
}
}
private void pbInit_Click(object sender, EventArgs e)
{
if (uControl_Init == null)
{
uControl_Init = new UControl_Init(this);
uControl_Init.ReloadConfig();
}
if (m_FormInit == null)
{
m_FormInit = new FormMove();
}
m_FormInit.StartPosition = FormStartPosition.CenterScreen;
m_FormInit.FormBorderStyle = FormBorderStyle.None;
m_FormInit.Width = uControl_Init.Width + 2;
m_FormInit.Height = uControl_Init.Height + 2;
if (m_FormInit.Controls.Count == 0)
{
uControl_Init.Location = new Point(1,1);
m_FormInit.Controls.Add(uControl_Init);
}
m_FormInit.ShowDialog();
ConfigurationParameter();
m_FormInit.Left = this.Left;
}
private void pictureBox1_Click(object sender, EventArgs e)
{
//if (UControl_ZoomIn == null)
//{
// UControl_ZoomIn = new UControl_ZoomIn(this);
// UControl_ZoomIn.ReloadConfig();
//}
//if (m_FormZoomIn == null)
//{
// m_FormZoomIn = new FormZoomIn();
//}
//m_FormZoomIn.StartPosition = FormStartPosition.CenterScreen;
//m_FormZoomIn.FormBorderStyle = FormBorderStyle.None;
//m_FormZoomIn.Width = UControl_ZoomIn.Width + 4;
//m_FormZoomIn.Height = UControl_ZoomIn.Height + 4;
//if (m_FormZoomIn.Controls.Count == 0)
//{
// UControl_ZoomIn.Location = new Point(2, 2);
// m_FormZoomIn.Controls.Add(UControl_ZoomIn);
//}
//m_FormZoomIn.ShowDialog();
}
private void pbImportTemplateFile_Click(object sender, EventArgs e)
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
string m_TemplateFilePath = config.AppSettings.Settings["TemplateFilePath"].Value.ToString();
//判断保存的路径是否存在
if (!Directory.Exists(m_TemplateFilePath))
{
////创建路径
//Directory.CreateDirectory(m_TemplateFilePath);
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择文件路径";
//dialog.RootFolder = Environment.SpecialFolder.Programs;
if (dialog.ShowDialog() == DialogResult.OK)
{
m_TemplateFilePath = dialog.SelectedPath;
config.AppSettings.Settings["TemplateFilePath"].Value = m_TemplateFilePath;
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");//重新加载新的配置文件
}
}
//打开默认路径
OpenFileDialog openFileDialog = new OpenFileDialog();
//设置默认打开路径(绝对路径)
openFileDialog.InitialDirectory = m_TemplateFilePath;
openFileDialog.Filter = "样品参数文件|*.cfg";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
if (uControl_Init == null)
{
uControl_Init = new UControl_Init(this);
}
//设置选择的模板文件
uControl_Init.ReadConfigPath = openFileDialog.FileName;
//获取文件
uControl_Init.ReadConfigInfo();
}
}
private void pbLog_Click(object sender, EventArgs e)
{
//m_FormLog = new Form();
//m_FormLog.StartPosition = FormStartPosition.CenterScreen;
//if (ucLog == null)
//{
// ucLog = new UControl_Log();
//}
//m_FormLog.FormBorderStyle = FormBorderStyle.None;
//m_FormLog.Width = ucLog.Width;
//m_FormLog.Height = ucLog.Height;
//ucLog.Name = "UControl_Log";
////获取日志信息
//if (listmsg.Items.Count>0)
//{
// string[] strLog = new string[listmsg.Items.Count];
// for (int i = 0; i < listmsg.Items.Count; i++)
// {
// //赋值给数组
// strLog[i] = listmsg.Items[i].ToString();
// }
// ucLog.ShowProcessLogInfo(strLog);
//}
//m_FormLog.Controls.Add(ucLog);
//m_FormLog.ShowDialog();
}
//显示日志
private void AddLogListInfo(ThreadStatusEventArgs e)
{
if (m_FormLog != null)
{
foreach (Control item in m_FormLog.Controls)
{
if (item is UserControl)
{
if (item.Name == "UControl_Log")
{
ucLog = (UControl_Log)item;
//获取日志信息
if (listmsg.Items.Count > 0)
{
string[] strLog = new string[listmsg.Items.Count];
for (int i = 0; i < listmsg.Items.Count; i++)
{
//赋值给数组
strLog[i] = listmsg.Items[i].ToString();
}
ucLog.ShowProcessLogInfo(strLog);
}
}
}
}
}
}
#endregion
#region 修改切孔状态
///
/// 修改切孔状态
///
///
///
public void ChangeCutHoleState(string CutHoleName, int States)
{
foreach (Control item in plLeftContent.Controls)
{
if (item is UserControl)
{
UControl_CutHole cutHole = (UControl_CutHole)item;
if (cutHole.CutHoleName == CutHoleName)
{
Button btnCutHole = (Button)cutHole.Controls.Find("btnCutHole", false)[0];
switch (States)
{
//运行中
case (int)MeasureThread.ThreadState.InProcess:
//btnCutHole.BackColor = Color.Yellow;
btnCutHole.BackgroundImage = Properties.Resources.CutHole_Yellow_2_;
btnCutHole.BackgroundImageLayout = ImageLayout.Center;
ChangeCutHoleMeasureState(CutHoleName, States);
ControlFlicker = true;
break;
//等待
case (int)MeasureThread.ThreadState.Waiting:
//btnCutHole.BackColor = Color.Yellow;
btnCutHole.BackgroundImage = Properties.Resources.CutHole_Yellow_2_;
btnCutHole.BackgroundImageLayout = ImageLayout.Center;
ChangeCutHoleMeasureState(CutHoleName, States);
break;
//准备
case (int)MeasureThread.ThreadState.Ready:
//btnCutHole.BackColor = Color.White;
btnCutHole.BackgroundImage = Properties.Resources.CutHole_Gray_2_;
btnCutHole.BackgroundImageLayout = ImageLayout.Center;
ChangeCutHoleMeasureState(CutHoleName, States);
break;
//失败
case (int)MeasureThread.ThreadState.Failed:
//btnCutHole.BackColor = Color.Red;
btnCutHole.BackgroundImage = Properties.Resources.CutHole_Red_2_;
btnCutHole.BackgroundImageLayout = ImageLayout.Center;
ChangeCutHoleMeasureState(CutHoleName, States);
ControlFlicker = false;
break;
//完成
case (int)MeasureThread.ThreadState.Success:
//btnCutHole.BackColor = Color.GreenYellow;
btnCutHole.BackgroundImage = Properties.Resources.CutHole_Green_2_;
btnCutHole.BackgroundImageLayout = ImageLayout.Center;
//修改切孔状态
ChangeCutHoleMeasureState(CutHoleName, States);
ControlFlicker = false;
break;
}
break;
}
}
}
}
#endregion
#region 修改切孔状态
public void ChangeCutHoleMeasureState(string CutHoleName, int States)
{
if (plPrarInfo.Controls.Count > 0)
{
foreach (Control item in plPrarInfo.Controls)
{
if (item is UserControl)
{
if (item.Name == CutHoleName)
{
UControl_ParaInfo uControl_ParaInfo = (UControl_ParaInfo)item;
//获取切孔列表
List aCutHole = m_MeasureFile.ListCutHole;
foreach (CutHole cutHoleItem in aCutHole)
{
if (cutHoleItem.HoleName == CutHoleName)
{
//设置开始时间与结束时间
uControl_ParaInfo.StartTime = cutHoleItem.START.ToString();
uControl_ParaInfo.EndTime = cutHoleItem.END.ToString();
uControl_ParaInfo.ShowTime();
break;
}
}
switch (States)
{
//准备
case (int)MeasureThread.ThreadState.Ready:
//修改切孔状态
uControl_ParaInfo.lblShowState.Text = "准备";
break;
//等待
case (int)MeasureThread.ThreadState.Waiting:
//修改切孔状态
uControl_ParaInfo.lblShowState.Text = "等待";
break;
//进行中
case (int)MeasureThread.ThreadState.InProcess:
//修改切孔状态
uControl_ParaInfo.lblShowState.Text = "进行中";
break;
//完成
case (int)MeasureThread.ThreadState.Success:
//修改切孔状态
uControl_ParaInfo.lblShowState.Text = "完成";
break;
//失败
case (int)MeasureThread.ThreadState.Failed:
uControl_ParaInfo.lblShowState.Text = "失败";
uControl_ParaInfo.pbMeasure.Value = 100;
uControl_ParaInfo.lblCompletedAmount.Text = "100%";
break;
}
break;
}
}
}
}
}
#endregion
#region 拖动无窗体的控件
[DllImport("user32.dll")]//拖动无窗体的控件
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_MOVE = 0xF010;
public const int HTCAPTION = 0x0002;
private void FormHOZMain_MouseDown(object sender, MouseEventArgs e)
{
if (this.WindowState == FormWindowState.Normal)
{
//拖动窗体
ReleaseCapture();
SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
}
}
#endregion
#region 开始、结束线程事件
private void pbStart_Click(object sender, EventArgs e)
{
if (plLeftContent.Controls.Count==0)
{
MessageBox.Show("请添加切孔信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (IsSave)
{
if (m_BackgroundWorker.IsBusy)
{
MessageBox.Show("线程已经运行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (MessageBox.Show("是否开始测量!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{
log.Info("开始", true);
m_BackgroundWorker.RunWorkerAsync(this);
pbStop.Visible = true;
pbStart.Visible = false;
}
}
else
{
MessageBox.Show("请保存当前测量文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
private void pbStop_Click(object sender, EventArgs e)
{
if (m_Ms != null)
{
if (MessageBox.Show("是否停止当前测量?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)== DialogResult.Yes)
{
ControlFlicker = false;
//线程停止变量
m_Ms.key_stop = true;
}
}
}
#endregion
#region 清空内容容器中的控件
///
/// 清空内容容器中的控件
///
private void ClearPanelControls()
{
//清空内容容器中的控件
plLeftContent.Controls.Clear();
plPrarInfo.Controls.Clear();
}
///
/// 清空日志控件内容
///
private void ClearContrlsContent()
{
try
{
if (ucLog != null)
{
if (ucLog.dgvLog != null)
{
if (ucLog.dgvLog.Rows.Count > 0)
{
ucLog.dgvLog.Rows.Clear();
}
}
}
if (listmsg != null)
{
if (listmsg.Items.Count > 0)
{
listmsg.Items.Clear();
}
}
}
catch (Exception ex)
{
log.Error(ex.Message);
}
}
#endregion
#region 测试修改切孔中流程状态
private void button1_Click(object sender, EventArgs e)
{
if (plPrarInfo.Controls.Count > 0)
{
string name = textBox1.Text;
string code = textBox2.Text;
bool state = Convert.ToBoolean(comboBox1.Text);
foreach (Control item in plPrarInfo.Controls)
{
if (item is UserControl)
{
if (item.Name == name)
{
UControl_ParaInfo uControl_ParaInfo = (UControl_ParaInfo)item;
TimeLineItem[] ParaItem = uControl_ParaInfo.TlItem;
foreach (TimeLineItem tlItem in ParaItem)
{
if (tlItem.Code == code)
{
tlItem.State = Convert.ToInt32(state);
break;
}
}
uControl_ParaInfo.TimeLineInvalidate();
break;
}
}
}
}
}
#endregion
private void FormHOZMain_Resize(object sender, EventArgs e)
{
plMain.Left = 2;
plMain.Top = 2;
plMain.Width = this.Width - 4;
plMain.Height = this.Height - 4;
plFill.Width = plMain.Width - plLeft.Width - 4;
plFill.Height = plMain.Height - plTop.Height - 4;
plFill.Left = plLeft.Width + 4;
plFill.Top = plTop.Height + 4;
if(this.WindowState!= FormWindowState.Maximized)
{
plPrarInfo.Height = 505;
foreach (Control item in plPrarInfo.Controls)
{
if (item is UserControl)
{
if(item.Height>505)
{
item.Height = 505;
}
}
}
}
}
private void FormHOZMain_Paint(object sender, PaintEventArgs e)
{
}
private void ConfigurationParameter()
{
#region 初始化参数的默认值
// add by zjx 2020-12-20 厂商参数
//m_MeasureFile.MParam.VendorType0 = Convert.ToString(ConfigurationManager.AppSettings["VendorType0"]);
//m_MeasureFile.MParam.VendorType1 = Convert.ToString(ConfigurationManager.AppSettings["VendorType1"]);
//m_MeasureFile.MParam.VendorType2 = Convert.ToString(ConfigurationManager.AppSettings["VendorType2"]);
//m_MeasureFile.MParam.VendorType3 = Convert.ToString(ConfigurationManager.AppSettings["VendorType3"]);
// add by zjx 2020-12-20 厂商参数 end
// add by zjx 2020-12-21 校正角度
m_MeasureFile.MParam.CorrectionType0 = Convert.ToString(ConfigurationManager.AppSettings["CorrectionType0"]);
m_MeasureFile.MParam.CorrectionType1 = Convert.ToString(ConfigurationManager.AppSettings["CorrectionType1"]);
m_MeasureFile.MParam.CorrectionType2 = Convert.ToString(ConfigurationManager.AppSettings["CorrectionType2"]);
m_MeasureFile.MParam.CorrectionType3 = Convert.ToString(ConfigurationManager.AppSettings["CorrectionType3"]);
m_MeasureFile.MParam.CorrectionType4 = Convert.ToString(ConfigurationManager.AppSettings["CorrectionType4"]);
m_MeasureFile.MParam.CorrectionType5 = Convert.ToString(ConfigurationManager.AppSettings["CorrectionType5"]);
// add by zjx 2020-12-21 校正角度 end
// add by zjx 2020-12-21 拉直操作放大倍数
m_MeasureFile.MParam.StraightenTimesType0 = Convert.ToString(ConfigurationManager.AppSettings["StraightenTimesType0"]);
m_MeasureFile.MParam.StraightenTimesType1 = Convert.ToString(ConfigurationManager.AppSettings["StraightenTimesType1"]);
m_MeasureFile.MParam.StraightenTimesType2 = Convert.ToString(ConfigurationManager.AppSettings["StraightenTimesType2"]);
m_MeasureFile.MParam.StraightenTimesType3 = Convert.ToString(ConfigurationManager.AppSettings["StraightenTimesType3"]);
m_MeasureFile.MParam.StraightenTimesType4 = Convert.ToString(ConfigurationManager.AppSettings["StraightenTimesType4"]);
m_MeasureFile.MParam.StraightenTimesType5 = Convert.ToString(ConfigurationManager.AppSettings["StraightenTimesType5"]);
// add by zjx 2020-12-21 拉直操作放大倍数 end
// add by zjx 2020-12-21 定位电压
m_MeasureFile.MParam.PositioningVoltageeType0 = Convert.ToString(ConfigurationManager.AppSettings["PositioningVoltageeType0"]);
m_MeasureFile.MParam.PositioningVoltageeType1 = Convert.ToString(ConfigurationManager.AppSettings["PositioningVoltageeType1"]);
m_MeasureFile.MParam.PositioningVoltageeType2 = Convert.ToString(ConfigurationManager.AppSettings["PositioningVoltageeType2"]);
m_MeasureFile.MParam.PositioningVoltageeType3 = Convert.ToString(ConfigurationManager.AppSettings["PositioningVoltageeType3"]);
m_MeasureFile.MParam.PositioningVoltageeType4 = Convert.ToString(ConfigurationManager.AppSettings["PositioningVoltageeType4"]);
m_MeasureFile.MParam.PositioningVoltageeType5 = Convert.ToString(ConfigurationManager.AppSettings["PositioningVoltageeType5"]);
// add by zjx 2020-12-21 定位电压 end
// add by zjx 2020-12-21 定位放大倍数
m_MeasureFile.MParam.PositioningTimesType0 = Convert.ToString(ConfigurationManager.AppSettings["PositioningTimesType0"]);
m_MeasureFile.MParam.PositioningTimesType1 = Convert.ToString(ConfigurationManager.AppSettings["PositioningTimesType1"]);
m_MeasureFile.MParam.PositioningTimesType2 = Convert.ToString(ConfigurationManager.AppSettings["PositioningTimesType2"]);
m_MeasureFile.MParam.PositioningTimesType3 = Convert.ToString(ConfigurationManager.AppSettings["PositioningTimesType3"]);
m_MeasureFile.MParam.PositioningTimesType4 = Convert.ToString(ConfigurationManager.AppSettings["PositioningTimesType4"]);
m_MeasureFile.MParam.PositioningTimesType5 = Convert.ToString(ConfigurationManager.AppSettings["PositioningTimesType5"]);
// add by zjx 2020-12-21 定位放大倍数 end
// add by zjx 2020-12-21 拍照电压
m_MeasureFile.MParam.PhotoVoltageeType0 = Convert.ToString(ConfigurationManager.AppSettings["PhotoVoltageeType0"]);
m_MeasureFile.MParam.PhotoVoltageeType1 = Convert.ToString(ConfigurationManager.AppSettings["PhotoVoltageeType1"]);
m_MeasureFile.MParam.PhotoVoltageeType2 = Convert.ToString(ConfigurationManager.AppSettings["PhotoVoltageeType2"]);
m_MeasureFile.MParam.PhotoVoltageeType3 = Convert.ToString(ConfigurationManager.AppSettings["PhotoVoltageeType3"]);
m_MeasureFile.MParam.PhotoVoltageeType4 = Convert.ToString(ConfigurationManager.AppSettings["PhotoVoltageeType4"]);
m_MeasureFile.MParam.PhotoVoltageeType5 = Convert.ToString(ConfigurationManager.AppSettings["PhotoVoltageeType5"]);
// add by zjx 2020-12-21 拍照电压 end
// add by zjx 2020-12-21 拍照放大倍数
m_MeasureFile.MParam.PhotoTimesType0 = Convert.ToString(ConfigurationManager.AppSettings["PhotoTimesType0"]);
m_MeasureFile.MParam.PhotoTimesType1 = Convert.ToString(ConfigurationManager.AppSettings["PhotoTimesType1"]);
m_MeasureFile.MParam.PhotoTimesType2 = Convert.ToString(ConfigurationManager.AppSettings["PhotoTimesType2"]);
m_MeasureFile.MParam.PhotoTimesType3 = Convert.ToString(ConfigurationManager.AppSettings["PhotoTimesType3"]);
m_MeasureFile.MParam.PhotoTimesType4 = Convert.ToString(ConfigurationManager.AppSettings["PhotoTimesType4"]);
m_MeasureFile.MParam.PhotoTimesType5 = Convert.ToString(ConfigurationManager.AppSettings["PhotoTimesType5"]);
// add by zjx 2020-12-21 拍照放大倍数 end
// add by zjx 2020-12-21 ScanRotate修正参数
m_MeasureFile.MParam.ScanRotateType0 = Convert.ToString(ConfigurationManager.AppSettings["ScanRotateType0"]);
m_MeasureFile.MParam.ScanRotateType1 = Convert.ToString(ConfigurationManager.AppSettings["ScanRotateType1"]);
m_MeasureFile.MParam.ScanRotateType2 = Convert.ToString(ConfigurationManager.AppSettings["ScanRotateType2"]);
m_MeasureFile.MParam.ScanRotateType3 = Convert.ToString(ConfigurationManager.AppSettings["ScanRotateType3"]);
m_MeasureFile.MParam.ScanRotateType4 = Convert.ToString(ConfigurationManager.AppSettings["ScanRotateType4"]);
m_MeasureFile.MParam.ScanRotateType5 = Convert.ToString(ConfigurationManager.AppSettings["ScanRotateType5"]);
// add by zjx 2020-12-21 ScanRotate修正参数 end
// add by zjx 2020-12-21 Y轴方向PixelSize修正值
m_MeasureFile.MParam.PixelSizeType0 = Convert.ToString(ConfigurationManager.AppSettings["PixelSizeType0"]);
m_MeasureFile.MParam.PixelSizeType1 = Convert.ToString(ConfigurationManager.AppSettings["PixelSizeType1"]);
m_MeasureFile.MParam.PixelSizeType2 = Convert.ToString(ConfigurationManager.AppSettings["PixelSizeType2"]);
m_MeasureFile.MParam.PixelSizeType3 = Convert.ToString(ConfigurationManager.AppSettings["PixelSizeType3"]);
m_MeasureFile.MParam.PixelSizeType4 = Convert.ToString(ConfigurationManager.AppSettings["PixelSizeType4"]);
m_MeasureFile.MParam.PixelSizeType5 = Convert.ToString(ConfigurationManager.AppSettings["PixelSizeType5"]);
// add by zjx 2020-12-21 Y轴方向PixelSize修正值 end
// add by zjx 2020-12-21 能谱Z轴移动位置
m_MeasureFile.MParam.SEMAxis_ZType0 = Convert.ToString(ConfigurationManager.AppSettings["SEMAxis_ZType0"]);
m_MeasureFile.MParam.SEMAxis_ZType1 = Convert.ToString(ConfigurationManager.AppSettings["SEMAxis_ZType1"]);
m_MeasureFile.MParam.SEMAxis_ZType2 = Convert.ToString(ConfigurationManager.AppSettings["SEMAxis_ZType2"]);
m_MeasureFile.MParam.SEMAxis_ZType3 = Convert.ToString(ConfigurationManager.AppSettings["SEMAxis_ZType3"]);
m_MeasureFile.MParam.SEMAxis_ZType4 = Convert.ToString(ConfigurationManager.AppSettings["SEMAxis_ZType4"]);
m_MeasureFile.MParam.SEMAxis_ZType5 = Convert.ToString(ConfigurationManager.AppSettings["SEMAxis_ZType5"]);
// add by zjx 2020-12-21 能谱Z轴移动位置 end
// add by zjx 2020-12-21 能谱电压值
m_MeasureFile.MParam.SEMVoltageeType0 = Convert.ToString(ConfigurationManager.AppSettings["SEMVoltageeType0"]);
m_MeasureFile.MParam.SEMVoltageeType1 = Convert.ToString(ConfigurationManager.AppSettings["SEMVoltageeType1"]);
m_MeasureFile.MParam.SEMVoltageeType2 = Convert.ToString(ConfigurationManager.AppSettings["SEMVoltageeType2"]);
m_MeasureFile.MParam.SEMVoltageeType3 = Convert.ToString(ConfigurationManager.AppSettings["SEMVoltageeType3"]);
m_MeasureFile.MParam.SEMVoltageeType4 = Convert.ToString(ConfigurationManager.AppSettings["SEMVoltageeType4"]);
m_MeasureFile.MParam.SEMVoltageeType5 = Convert.ToString(ConfigurationManager.AppSettings["SEMVoltageeType5"]);
// add by zjx 2020-12-21 能谱电压值 end
// add by zjx 2020-12-21 能谱电流值
m_MeasureFile.MParam.SEMCurrentType0 = Convert.ToString(ConfigurationManager.AppSettings["SEMCurrentType0"]);
m_MeasureFile.MParam.SEMCurrentType1 = Convert.ToString(ConfigurationManager.AppSettings["SEMCurrentType1"]);
m_MeasureFile.MParam.SEMCurrentType2 = Convert.ToString(ConfigurationManager.AppSettings["SEMCurrentType2"]);
m_MeasureFile.MParam.SEMCurrentType3 = Convert.ToString(ConfigurationManager.AppSettings["SEMCurrentType3"]);
m_MeasureFile.MParam.SEMCurrentType4 = Convert.ToString(ConfigurationManager.AppSettings["SEMCurrentType4"]);
m_MeasureFile.MParam.SEMCurrentType5 = Convert.ToString(ConfigurationManager.AppSettings["SEMCurrentType5"]);
// add by zjx 2020-12-21 能谱电流值 end
#endregion
}
private void FormHOZMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (m_Ms != null)
{
if (m_Ms.iExtender != null)
{
m_Ms.iExtender.CloseExtender();
}
}
}
private void FormHOZMain_LocationChanged(object sender, EventArgs e)
{
if (logwin != null)
{
logwin.Left = this.Left-logwin.Width;
logwin.Top = this.Top;
}
}
private void pbPause_Click(object sender, EventArgs e)
{
if (File.Exists(m_MeasureFile.m_SavePath))
{
string position = System.Environment.CurrentDirectory;
//Process pro = Process.Start(@"D:\DebugLine\Debug\ExportReport.exe", @"D:\6\s.msf");//打开程序B
Process pro = Process.Start(position + "\\Report\\ExportReport.exe", m_MeasureFile.m_SavePath);//打开程序B
pro.WaitForExit();
int Result = pro.ExitCode;//程序B退出回传值
if (Result == 1)//接收到程序B退出代码"1"
{
MessageBox.Show("退出程序B");
}
}
else
{
MessageBox.Show("尚未保存文件");
}
}
}
}