This commit is contained in:
2025-03-18 14:19:33 +08:00
parent 25cd61c5cb
commit 0dedff36fd
29 changed files with 2296 additions and 615 deletions

View File

@ -57,29 +57,7 @@ namespace DHSoftware.Views
IconSvg = "VideoCameraAddOutlined"
}
};
AntdUI.ContextMenuStrip.open(menu1, it =>
{
if (it.Text == "关联相机")
{
using (var dlg = new AddCameraWindow())
{
if (dlg.ShowDialog() == DialogResult.OK)
{
var newItem = new MenuItem(dlg.CubicleName);
newItem.IconSvg = "VideoCameraOutlined";
//// 防止重复添加
//if (!menu1.Items.Cast<MenuItem>().Any(m => m.Text == newItem.Text))
//{
clickedItem.Sub.Add(newItem);
//}
//else
//{
// AntdUI.Notification.warn(this, "新增失败", $"{dlg.CubicleName}已存在!", autoClose: 3, align: TAlignFrom.TR);
//}
}
}
}
}, menulist);
}
}
}
@ -106,23 +84,28 @@ namespace DHSoftware.Views
private void btnAdd_Click(object sender, EventArgs e)
{
using (var dlg = new AddCubicleWindow())
var form = new AddCubicleControl(this) { Size = new Size(400, 300) };
AntdUI.Modal.open(new AntdUI.Modal.Config(this, "", form, TType.None)
{
if (dlg.ShowDialog() == DialogResult.OK)
BtnHeight = 0,
});
if (form.submit)
{
var newItem = new MenuItem(form.CubicleName);
newItem.IconSvg = "AppstoreOutlined";
// 防止重复添加
if (!menu1.Items.Cast<MenuItem>().Any(m => m.Text == newItem.Text))
{
var newItem = new MenuItem(dlg.CubicleName);
newItem.IconSvg = "AppstoreOutlined";
// 防止重复添加
if (!menu1.Items.Cast<MenuItem>().Any(m => m.Text == newItem.Text))
{
menu1.Items.Add(newItem);
}
else
{
AntdUI.Notification.warn(this, "新增工位失败", $"{dlg.CubicleName}已存在!", autoClose: 3, align: TAlignFrom.TR);
}
menu1.Items.Add(newItem);
}
else
{
AntdUI.Notification.warn(this, "新增工位失败", $"{form.CubicleName}已存在!", autoClose: 3, align: TAlignFrom.TR);
}
}
}
private void menu1_MouseClick(object sender, MouseEventArgs e)