namespace PLCSharp.VVMs.Vision.VisionFlowHandler.Access
{
///
/// 显示图像Handler
///
public class ImageToHomePageHandler : IVisionFlowHandler
{
///
/// 类型
///
public VisionFlowType Type => VisionFlowType.显示图像到主页;
///
/// 执行
///
/// 视觉功能
/// 变量项
/// 返回布尔值
public bool Execute(VisionFunction func, VisionFlow item)
{
if (item.StringParams.TryGetValue("CustomControlName", out string customControlName))
{
var customControl = func.GlobalModel.GetCustomControl(customControlName);
if (customControl != null)
{
customControl.ShowMat(func.Src);
item.Flow.Completed = true;
return true;
}
}
else
{
throw new Exception("未配置,请重新配置!");
}
return false;
}
}
}