using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GcDevicePc.GCBuffer;

namespace GcDevicePc.DeviceConfigUI
{
    public partial class Device : Form
    {
        #region 私有变量
        private HWConfig hWConfig;
        #endregion

        #region 构造函数
        public Device()
        {
            InitializeComponent();
        }

        public Device(ref HWConfig hwconfig)
        {
            InitializeComponent();

            hWConfig = hwconfig;
        }
        #endregion

        #region 窗口事件
        private void Device_Load(object sender, EventArgs e)
        {
            try
            {
                if (hWConfig != null)
                {
                    this.GCNum.Text = this.hWConfig.hwconfiginfo.GCNum;
                    this.GCName.Text = this.hWConfig.hwconfiginfo.GCName;
                    this.StartType.SelectedIndex = this.hWConfig.hwconfiginfo.u16StartType - 1;
                }
            }
            catch 
            {
                
            }

        }
        #endregion

        #region 控件事件
        private void okbtn_Click(object sender, EventArgs e)
        {
            if (hWConfig != null)
            {
                this.hWConfig.hwconfiginfo.GCNum = this.GCNum.Text;
                this.hWConfig.hwconfiginfo.GCName = this.GCName.Text;
                this.hWConfig.hwconfiginfo.u16StartType = this.StartType.SelectedIndex + 1;
            }
            this.Close();
        }

        private void cancelbtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        #endregion
    }
}
