using MeasureThread;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace HOZProject
{
public class MeasureMsgManage
{
public enum measureType
{
Photo=0,
FIB=1,
PT=2
}
///
/// 线程消息处理,显示内容
///
/// 主窗体对象
/// 消息对象
public static void ShowMsgContent(FormHOZMain formHOZ, ThreadStatusEventArgs args)
{
switch (args.Step_Code)
{
case "1-3":
//设置图像
FileStream fileStream = new FileStream(args.Picture_Information.Picture_FullPath, FileMode.Open, FileAccess.Read);
formHOZ.pbImage.Image = Image.FromStream(fileStream);
fileStream.Close();
fileStream.Dispose();
//流程内容
string semParaContent = "电压:"+args.Picture_Information.Work_Voltage;
semParaContent += " 放大倍数:" + args.Picture_Information.Magnification;
semParaContent += " 工作距离:" + args.Picture_Information.Work_Distance;
formHOZ.lblFlowContent.Text = semParaContent;
break;
default:
break;
}
//修改切孔中流程状态
ChageCutHoleFlowNodeState(formHOZ, args);
}
#region 修改切孔中流程状态
///
/// 修改切孔中流程状态
///
/// 主窗体对象
/// 切孔名称
/// 流程编号
/// 状态
///
public static bool ChageCutHoleFlowNodeState(FormHOZMain formHOZ, ThreadStatusEventArgs args)
{
if (formHOZ.plPrarInfo.Controls.Count > 0)
{
foreach (Control item in formHOZ.plPrarInfo.Controls)
{
if (item is UserControl)
{
if (item.Name == args.HoleName)
{
UControl_ParaInfo uControl_ParaInfo = (UControl_ParaInfo)item;
TimeLineItem[] ParaItem = uControl_ParaInfo.TlItem;
foreach (TimeLineItem tlItem in ParaItem)
{
if (tlItem.Code == args.Step_Code)
{
tlItem.State = Convert.ToInt32(args.State);
break;
}
}
//重新绘制
uControl_ParaInfo.TimeLineInvalidate();
return true;
}
}
}
}
return false;
}
#endregion
}
}