DHDHSoftware/DHSoftware/Views/AddCameraWindow.cs
2025-03-16 13:28:24 +08:00

66 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using AntdUI;
using DH.Devices.Devices;
namespace DHSoftware.Views
{
public partial class AddCameraWindow : Window
{
public AddCameraWindow()
{
InitializeComponent();
btnOK.DialogResult = DialogResult.OK;
btnCancel.DialogResult = DialogResult.Cancel;
this.AcceptButton = btnOK;
this.CancelButton = btnCancel;
stName.Items.Clear();
for(int i = 1; i <= 8; i++)
{
stName.Items.Add($"Cam{i}");
}
}
public string CubicleName { get; private set; }
private void btnOK_Click(object sender, EventArgs e)
{
if (ValidateInput())
{
this.DialogResult = DialogResult.OK;
this.Close();
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private bool ValidateInput()
{
if (string.IsNullOrWhiteSpace(stName.Text))
{
MessageBox.Show("请选择关联相机", "输入错误",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return false;
}
CubicleName = stName.Text.Trim();
return true;
}
}
}