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(List<CameraBase> cameras)
        {
            InitializeComponent();


            btnOK.DialogResult = DialogResult.OK;
            btnCancel.DialogResult = DialogResult.Cancel;
            this.AcceptButton = btnOK;
            this.CancelButton = btnCancel;
          

            stName.Items.Clear();
            for (int i = 0; i < cameras.Count; i++)
            {
                stName.Items.Add(cameras[i].CameraName);
            }
        }
        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;
        }
    }
}