using System;
using System.Collections.Generic;
using System.ComponentModel;
using PropertyGridLib.Controls;
using TeamAAS.FlowEditor.Plugins;
using TeamAAS.FlowEngine.FormulaData;
using PropertyGridLib.Attributes;
namespace Plugins.Vpp.Models
{
///
/// VP 图像显示节点模型:把上游输出的图层/图像显示到指定画面框(视觉窗体),
/// 每个显示项可独立链接 OK/NG 结果(可不链接)驱动该画面框的状态圆点。
///
[Serializable]
public class VppDisplayModel : BasePluginModel
{
[Category("属性")]
[DisplayName("1.显示项列表")]
[Description("配置图层到画面框的显示映射,可添加多条;每项可独立链接 OK/NG(可不链接)")]
[CollectionEditor(CanAdd = true, CanRemove = true, CanSort = true)]
[FormulaEditor(typeof(InputSourceDataProvider))]
public List DisplayItems { get; set; } = new List();
}
[Serializable]
public class VppDisplayItem
{
/// 目标画面序号(实际存储值,运行逻辑按 windows[FrameNo-1] 取窗体);UI 通过 FrameName 按名称选择
[Browsable(false)]
public int FrameNo { get; set; } = 1;
///
/// 目标画面名称(属性网格中显示/选择的项):下拉项来自当前产品「画面列表」,
/// 选择名称时映射为序号写入 ,读取时按序号还原名称。
/// 计算属性,不参与序列化。
///
[DisplayName("1.目标画面")]
[Category("属性")]
[Description("从当前产品的画面列表中选择目标画面,按名称选择、内部存储对应序号")]
[TypeConverter(typeof(Plugins.Vpp.Core.FrameNameConverter))]
[Newtonsoft.Json.JsonIgnore]
public string FrameName
{
get => Plugins.Vpp.Core.FrameNameConverter.GetFrameName(
Plugins.Vpp.Core.FrameNameConverter.GetFrames(), FrameNo);
set
{
int no = Plugins.Vpp.Core.FrameNameConverter.ResolveFrameNo(value);
if (no >= 1) FrameNo = no;
}
}
[DisplayName("2.链接图层")]
[Category("属性")]
[Description("链接上游输出:图层(ICogRecord)/图像(ICogImage)/相机图像(GenImage)均可")]
[FormulaEditor(typeof(InputSourceDataProvider))]
public FormulaBound