public object Clone()
 {
     EquipmentTypeInfo temp = new EquipmentTypeInfo();
     if (this.CopyTo(temp))
     {
         return temp;
     }
     else
     {
         return null;
     }
 }
        private void Initialize()
        {
            EquipmentTypeInfoList.Clear();
            EquipmentTypeInfo info = null;
            foreach (string commPort in _serverProxy.EquipmentTable.Keys)
            {
                info = new EquipmentTypeInfo();
                info.IsCheckedEvent += new IsCheckedChangedDel(OnIsCheckedChanged);
                info.SerialPort = commPort;

                int moduleID = _serverProxy.EquipmentTable[commPort].ModuleID;
                info.DeviceType = CustomTransform.ModelIdToNSCarType(moduleID);
                info.CheckBoxEnable = CustomTransform.IsSystemController(moduleID);
                info.PortCount = CustomTransform.GetPortNumber(moduleID);
                info.SystermCount = _serverProxy.EquipmentTable[commPort].EquipTypeCount;

                info.CheckBoxVisible = true;
                if (!IsSendDataWindow)
                {
                    info.CheckBoxVisible = false;
                }

                EquipmentTypeInfoList.Add(info);
            }
        }
 private void SolidDataToHW()
 {
     //TODO:固化数据到硬件;
     for (int i = 0; i < EquipmentTypeInfoList.Count; i++)
     {
         EquipmentTypeInfo info = EquipmentTypeInfoList[i];
         if (info.IsChecked)
         {
             _equipmentTypeData = (EquipmentTypeInfo)info.Clone();
             _selectedPortName = info.SerialPort;
             _hwCardType = info.DeviceType;
             SaveToHardware();
             break;
         }
     }
 }
 private bool OnSendBottonCanExecute()
 {
     if (_oldDisplayList == null ||
         _oldDisplayList.Count == 0)
     {
         return false;
     }
     if (EquipmentTypeInfoList.Count <= 0)
     {
         return false;
     }
     for (int i = 0; i < EquipmentTypeInfoList.Count; i++)
     {
         EquipmentTypeInfo info = EquipmentTypeInfoList[i];
         if (info.IsChecked)
         {
             _equipmentTypeData = (EquipmentTypeInfo)info.Clone();
             return true;
         }
     }
     return false;
 }
 private void SendDataToHW()
 {
     for (int i = 0; i < EquipmentTypeInfoList.Count; i++)
     {
         EquipmentTypeInfo info = EquipmentTypeInfoList[i];
         if (info.IsChecked)
         {
             _equipmentTypeData = (EquipmentTypeInfo)info.Clone();
             SendScreenInfoToHW();
             break;
         }
     }
 }
        public EquipmentManager_VM()
        {

            CmdSendDataToHW=new RelayCommand(SendDataToHW, OnSendBottonCanExecute);
            CmdSetDataToHW = new RelayCommand(SolidDataToHW, OnSolidDataCanExecute);
            CmdMainWindowClose = new RelayCommand<System.ComponentModel.CancelEventArgs>(MainWindowClose);
            if (this.IsInDesignMode)
            {
                IsSendDataWindow = true;
                EquipmentTypeInfoList.Clear();
                EquipmentTypeInfo data = new EquipmentTypeInfo();
                data.DeviceType = NSCardType.Controller;
                data.IsChecked = false;
                data.PortCount = 4;
                data.SerialPort = "COM 2";
                EquipmentTypeInfoList.Add(data);
                data = new EquipmentTypeInfo();
                data.DeviceType = NSCardType.HDMICard;
                data.IsChecked = false;
                data.PortCount = 4;
                data.SerialPort = "COM 4";
                EquipmentTypeInfoList.Add(data);
                data = new EquipmentTypeInfo();
                data.DeviceType = NSCardType.Scanner;
                data.IsChecked = false;
                data.PortCount = 2;
                data.SerialPort = "COM 6";
                EquipmentTypeInfoList.Add(data);
     
            }
            if (!this.IsInDesignMode)
            {
                Initialize();
                _oldDisplayList = _globalParams.CurrentDisplayInfoList;
                IsSendDataWindow = _globalParams.IsSendCurrentDisplayConfig;
                if (EquipmentTypeInfoList != null && EquipmentTypeInfoList.Count != 0)
                {
                    EquipmentTypeInfoList[0].IsChecked = true;
                }
            }
        }