首次提交lilili

This commit is contained in:
2025-03-25 18:55:59 +08:00
parent fabc7606e7
commit bc981fc7a9
13 changed files with 1693 additions and 415 deletions

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
@ -18,26 +19,513 @@ namespace DHSoftware.Views
{
public partial class MotionControl : UserControl
{
Window window;
PLCBase pLCBase;
public MotionControl(Window _window,PLCBase _pLCBase)
private Window window;
private PLCBase pLCBase;
public MotionControl(Window _window, PLCBase _pLCBase)
{
window= _window;
pLCBase= _pLCBase;
window = _window;
pLCBase = _pLCBase;
InitializeComponent();
BindEventHandler();
InitData();
SetupDataBindings();
}
private void BindEventHandler()
{
sltTpye.TextChanged += SltTpye_TextChanged;
btnAdd.Click += BtnAdd_Click;
btnDelete.Click += BtnDelete_Click;
PLCItemsTable.CellButtonClick += PLCItemsTable_CellButtonClick; ;
PLCItemsTable.CellButtonClick += PLCItemsTable_CellButtonClick;
btnSartProcessAdd.Click += BtnSartProcessAdd_Click;
btnSartProcessDelete.Click += BtnSartProcessDelete_Click;
TableSartProcess.CellButtonClick += TableSartProcess_CellButtonClick;
btnStopProcessAdd.Click += BtnStopProcessAdd_Click;
btnStopProcessDelete.Click += BtnStopProcessDelete_Click;
TableStopProcess.CellButtonClick += TableStopProcess_CellButtonClick;
btnStartResetAdd.Click += BtnStartResetAdd_Click;
btnStartResetDelete.Click += BtnStartResetDelete_Click;
TableStartReset.CellButtonClick += TableStartReset_CellButtonClick;
btnStopResetAdd.Click += BtnStopResetAdd_Click;
btnStopResetDelete.Click += BtnStopResetDelete_Click;
TableStopReset.CellButtonClick += TableStopReset_CellButtonClick;
}
private void TableStopReset_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is PLCItem pLCItem)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new MotionProcessEdit(window, "复位结束表操作-编辑", pLCItem, pLCBase.PLCItemList) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入复位结束表编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "退出复位结束表编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
pLCBase.PLCStopResetList.Remove(pLCItem);
}
break;
case "上移":
if (e.RowIndex <= 1)
{
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
return;
}
MoveItemUp(pLCBase.PLCStopResetList, pLCItem);
break;
case "下移":
if (e.RowIndex > pLCBase.PLCStopResetList.Count - 1)
{
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
return;
}
MoveItemDown(pLCBase.PLCStopResetList, pLCItem);
break;
}
}
}
private void BtnStopResetDelete_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCStopResetList.Count == 0 || !pLCBase.PLCStopResetList.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = pLCBase.PLCStopResetList.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (pLCBase.PLCStopResetList[i].Selected)
{
pLCBase.PLCStopResetList.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnStopResetAdd_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCItemList?.Count == 0)
{
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
return;
}
PLCItem pLCItem = new PLCItem()
{
StartIndex = pLCBase.PLCStopResetList.Count + 1,
CellLinks = new CellLink[]
{
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
}
};
var form = new MotionProcessEdit(window, "复位结束表操作-新增", pLCItem, pLCBase.PLCItemList) { Size = new Size(450, 550) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入复位结束表新增", autoClose: 1);
},
OnClose = () =>
{
if (form.submit)
{
pLCBase.PLCStopResetList.Add(pLCItem);
}
AntdUI.Message.info(window, "退出复位结束表新增", autoClose: 1);
}
});
}
private void TableStartReset_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is PLCItem pLCItem)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new MotionProcessEdit(window, "复位开始表操作-编辑", pLCItem, pLCBase.PLCItemList) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入复位开始表编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "退出复位开始表编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
pLCBase.PLCStartResetList.Remove(pLCItem);
}
break;
case "上移":
if (e.RowIndex <= 1)
{
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
return;
}
MoveItemUp(pLCBase.PLCStartResetList, pLCItem);
break;
case "下移":
if (e.RowIndex > pLCBase.PLCStartResetList.Count - 1)
{
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
return;
}
MoveItemDown(pLCBase.PLCStartResetList, pLCItem);
break;
}
}
}
private void BtnStartResetDelete_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCStartResetList.Count == 0 || !pLCBase.PLCStartResetList.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = pLCBase.PLCStartResetList.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (pLCBase.PLCStartResetList[i].Selected)
{
pLCBase.PLCStartResetList.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnStartResetAdd_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCItemList?.Count == 0)
{
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
return;
}
PLCItem pLCItem = new PLCItem()
{
StartIndex = pLCBase.PLCStartResetList.Count + 1,
CellLinks = new CellLink[]
{
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
}
};
var form = new MotionProcessEdit(window, "复位开始表操作-新增", pLCItem, pLCBase.PLCItemList) { Size = new Size(450, 550) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入复位开始表新增", autoClose: 1);
},
OnClose = () =>
{
if (form.submit)
{
pLCBase.PLCStartResetList.Add(pLCItem);
}
AntdUI.Message.info(window, "退出复位开始表新增", autoClose: 1);
}
});
}
private void TableStopProcess_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is PLCItem pLCItem)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new MotionProcessEdit(window, "流程结束表操作-编辑", pLCItem, pLCBase.PLCItemList) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入流程结束表编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "退出流程结束表编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
pLCBase.PLCStopProcessList.Remove(pLCItem);
}
break;
case "上移":
if (e.RowIndex <= 1)
{
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
return;
}
MoveItemUp(pLCBase.PLCStopProcessList, pLCItem);
break;
case "下移":
if (e.RowIndex > pLCBase.PLCStopProcessList.Count - 1)
{
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
return;
}
MoveItemDown(pLCBase.PLCStopProcessList, pLCItem);
break;
}
}
}
private void BtnStopProcessDelete_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCStopProcessList.Count == 0 || !pLCBase.PLCStopProcessList.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = pLCBase.PLCStopProcessList.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (pLCBase.PLCStopProcessList[i].Selected)
{
pLCBase.PLCStopProcessList.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnStopProcessAdd_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCItemList?.Count == 0)
{
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
return;
}
PLCItem pLCItem = new PLCItem()
{
StartIndex = pLCBase.PLCStopProcessList.Count + 1,
CellLinks = new CellLink[]
{
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
}
};
var form = new MotionProcessEdit(window, "流程结束表操作-新增", pLCItem, pLCBase.PLCItemList) { Size = new Size(450, 550) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入流程结束表新增", autoClose: 1);
},
OnClose = () =>
{
if (form.submit)
{
pLCBase.PLCStopProcessList.Add(pLCItem);
}
AntdUI.Message.info(window, "退出流程结束表新增", autoClose: 1);
}
});
}
private void TableSartProcess_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is PLCItem pLCItem)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new MotionProcessEdit(window, "流程开始表操作-编辑", pLCItem, pLCBase.PLCItemList) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入流程开始表编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "退出流程开始表编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
pLCBase.PLCStartProcessList.Remove(pLCItem);
}
break;
case "上移":
if (e.RowIndex <= 1)
{
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
return;
}
MoveItemUp(pLCBase.PLCStartProcessList, pLCItem);
break;
case "下移":
if (e.RowIndex > pLCBase.PLCStartProcessList.Count - 1)
{
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
return;
}
MoveItemDown(pLCBase.PLCStartProcessList, pLCItem);
break;
}
}
}
private void BtnSartProcessDelete_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCStartProcessList.Count == 0 || !pLCBase.PLCStartProcessList.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = pLCBase.PLCStartProcessList.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (pLCBase.PLCStartProcessList[i].Selected)
{
pLCBase.PLCStartProcessList.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnSartProcessAdd_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCItemList?.Count == 0)
{
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
return;
}
PLCItem pLCItem = new PLCItem()
{
StartIndex = pLCBase.PLCStartProcessList.Count + 1,
CellLinks = new CellLink[]
{
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
}
};
var form = new MotionProcessEdit(window, "流程开始表操作-新增", pLCItem, pLCBase.PLCItemList) { Size = new Size(450, 550) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入流程开始表新增", autoClose: 1);
},
OnClose = () =>
{
if (form.submit)
{
pLCBase.PLCStartProcessList.Add(pLCItem);
}
AntdUI.Message.info(window, "退出流程开始表新增", autoClose: 1);
}
});
}
private void PLCItemsTable_CellButtonClick(object sender, TableButtonEventArgs e)
@ -50,7 +538,7 @@ namespace DHSoftware.Views
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new MotionEdit(window, pLCItem) { Size = new Size(500, 300) };
var form = new MotionEdit(window, "点位表操作-编辑", pLCItem) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
@ -59,26 +547,11 @@ namespace DHSoftware.Views
},
OnClose = () =>
{
pLCItem.CellTags = new CellTag[] { };
var tempList = pLCItem.CellTags.ToList();
if (pLCItem.StartExecute)
{
var newTag = new CellTag($"ON_{pLCItem.StartIndex}", TTypeMini.Primary);
tempList.Add(newTag);
}
if (pLCItem.EndExecute)
{
var newTag = new CellTag($"OFF_{pLCItem.EndIndex}", TTypeMini.Warn);
tempList.Add(newTag);
}
// 重新赋值回数组
pLCItem.CellTags = tempList.ToArray();
AntdUI.Message.info(window, "结束编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
@ -87,6 +560,62 @@ namespace DHSoftware.Views
}
break;
case "上移":
if (e.RowIndex <= 1)
{
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
return;
}
MoveItemUp(pLCBase.PLCItemList, pLCItem);
break;
case "下移":
if (e.RowIndex > pLCBase.PLCItemList.Count - 1)
{
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
return;
}
MoveItemDown(pLCBase.PLCItemList, pLCItem);
break;
}
}
}
// 上移项
public static void MoveItemUp(BindingList<PLCItem> list, PLCItem item)
{
int index = list.IndexOf(item);
if (index > 0)
{
// 移除并插入到前一位
list.RemoveAt(index);
list.Insert(index - 1, item);
UpdateStartIndexes(list); // 更新序号
}
}
// 下移项
public static void MoveItemDown(BindingList<PLCItem> list, PLCItem item)
{
int index = list.IndexOf(item);
if (index < list.Count - 1)
{
// 移除并插入到后一位
list.RemoveAt(index);
list.Insert(index + 1, item);
UpdateStartIndexes(list); // 更新序号
}
}
// 更新所有项的序号
public static void UpdateStartIndexes(BindingList<PLCItem> list)
{
for (int i = 0; i < list.Count; i++)
{
PLCItem item = list[i];
if (item.StartIndex != i + 1)
{
item.StartIndex = i + 1; // 触发 PropertyChanged 事件
}
}
}
@ -120,40 +649,43 @@ namespace DHSoftware.Views
{
PLCItem pLCItem = new PLCItem()
{
StartIndex = pLCBase.PLCItemList.Count + 1,
CellLinks = new CellLink[]
{
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
{ new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
}
};
var form = new MotionEdit(window, pLCItem) { Size = new Size(450, 550) };
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
var form = new MotionEdit(window, "点位表操作-新增", pLCItem) { Size = new Size(450, 550) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
BtnHeight = 0,
OnLoad = () =>
{
AntdUI.Message.info(window, "进入新增", autoClose: 1);
},
OnClose = () =>
{
if (form.submit)
{
pLCBase.PLCItemList.Add(pLCItem);
}
AntdUI.Message.info(window, "结束新增", autoClose: 1);
}
});
if (form.submit)
{
pLCItem.CellTags = new CellTag[] { };
var tempList = pLCItem.CellTags.ToList();
//AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
//{
// BtnHeight = 0,
//});
if (pLCItem.StartExecute)
{
var newTag = new CellTag($"ON_{pLCItem.StartIndex}", TTypeMini.Primary);
tempList.Add(newTag);
}
if (pLCItem.EndExecute)
{
var newTag = new CellTag($"OFF_{pLCItem.EndIndex}", TTypeMini.Warn);
tempList.Add(newTag);
}
// 重新赋值回数组
pLCItem.CellTags = tempList.ToArray();
pLCBase.PLCItemList.Add(pLCItem);
}
//if (form.submit)
//{
// pLCBase.PLCItemList.Add(pLCItem);
//}
}
private void SltTpye_TextChanged(object? sender, EventArgs e)
@ -193,24 +725,17 @@ namespace DHSoftware.Views
}
else
{
}
}
}
private void InitData()
{
// 获取枚举字段名列表(原描述改为字段名)
sltTpye.Items.Clear();
foreach (EnumPLCType value in Enum.GetValues(typeof(EnumPLCType)))
{
sltTpye.Items.Add(value.ToString());
sltTpye.Items.Add(value.ToString());
}
// 波特率选项(保持不变)
@ -242,46 +767,122 @@ namespace DHSoftware.Views
PLCItemsTable.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("StartIndex", "序号", ColumnAlign.Center),
new Column("Name", "名称", ColumnAlign.Center),
new Column("Type", "类型",ColumnAlign.Center),
new Column("Address", "地址",ColumnAlign.Center),
new Column("Value", "值",ColumnAlign.Center),
new Column("CellTags", "标签",ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
if (pLCBase.PLCItemList.Count > 0)
if (pLCBase.PLCItemList.Count > 0)
{
foreach( var item in pLCBase.PLCItemList)
foreach (var item in pLCBase.PLCItemList)
{
item.CellTags = new CellTag[] { };
var tempList = item.CellTags.ToList();
if (item.StartExecute)
{
var newTag = new CellTag($"ON_{item.StartIndex}", TTypeMini.Primary);
tempList.Add(newTag);
}
if (item.EndExecute)
{
var newTag = new CellTag($"OFF_{item.EndIndex}", TTypeMini.Warn);
tempList.Add(newTag);
}
// 重新赋值回数组
item.CellTags = tempList.ToArray();
item.CellLinks = new CellLink[] {
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
PLCItemsTable.Binding(pLCBase.PLCItemList);
}
TableSartProcess.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("StartIndex", "序号", ColumnAlign.Center),
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
new Column("Name", "名称", ColumnAlign.Center),
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
new Column("Value", "值",ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
if (pLCBase.PLCStartProcessList.Count > 0)
{
foreach (var item in pLCBase.PLCStartProcessList)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
//TableSartProcess.Binding(pLCBase.PLCStartProcessList);
TableSartProcess.Binding(pLCBase.PLCStartProcessList);
TableStopProcess.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("StartIndex", "序号", ColumnAlign.Center),
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
new Column("Name", "名称", ColumnAlign.Center),
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
new Column("Value", "值",ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
if (pLCBase.PLCStopProcessList.Count > 0)
{
foreach (var item in pLCBase.PLCStopProcessList)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
TableStopProcess.Binding(pLCBase.PLCStopProcessList);
TableStartReset.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("StartIndex", "序号", ColumnAlign.Center),
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
new Column("Name", "名称", ColumnAlign.Center),
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
new Column("Value", "值",ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
if (pLCBase.PLCStartResetList.Count > 0)
{
foreach (var item in pLCBase.PLCStartResetList)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
TableStartReset.Binding(pLCBase.PLCStartResetList);
TableStopReset.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("StartIndex", "序号", ColumnAlign.Center),
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
new Column("Name", "名称", ColumnAlign.Center),
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
new Column("Value", "值",ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
if (pLCBase.PLCStopResetList.Count > 0)
{
foreach (var item in pLCBase.PLCStopResetList)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
TableStopReset.Binding(pLCBase.PLCStopResetList);
}
private void SetupDataBindings()
{
@ -296,9 +897,7 @@ namespace DHSoftware.Views
iptIP.DataBindings.Add(nameof(iptIP.Text), pLCBase, nameof(pLCBase.IP));
iptPort.DataBindings.Add(nameof(iptPort.Text), pLCBase, nameof(pLCBase.Port));
swhEnable.DataBindings.Add(nameof(swhEnable.Checked),pLCBase, nameof(pLCBase.Enable));
swhEnable.DataBindings.Add(nameof(swhEnable.Checked), pLCBase, nameof(pLCBase.Enable));
}
}
}
}