protected override bool ExistSameDeviceCode(LoopModel loop)
        {
            DeviceService8003 deviceService = new DeviceService8003();

            deviceService.TheLoop = loop;
            if (deviceService.IsExistSameDeviceCode())
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 根据器件数量初始化器件信息
        /// </summary>
        /// <param name="cType">控制器类型</param>
        /// <param name="loop">回路对象</param>
        private void  InitializeDevicesToLoop(ControllerType cType, LoopModel loop)
        {
            switch (cType)
            {
            case ControllerType.FT8000:
            {
                DeviceService8000 deviceService = new DeviceService8000();
                deviceService.TheLoop = loop;
                List <DeviceInfo8000> lstDeviceInfo = deviceService.Create(loop.DeviceAmount);
                loop.SetDevices <DeviceInfo8000>(lstDeviceInfo);
                break;
            }

            case ControllerType.FT8003:
            {
                DeviceService8003 deviceService = new DeviceService8003();
                deviceService.TheLoop = loop;
                List <DeviceInfo8003> lstDeviceInfo = deviceService.Create(loop.DeviceAmount);
                loop.SetDevices <DeviceInfo8003>(lstDeviceInfo);
                break;
            }

            case ControllerType.NT8001:
            {
                DeviceService8001 deviceService = new DeviceService8001();
                deviceService.TheLoop = loop;
                List <DeviceInfo8001> lstDeviceInfo = deviceService.Create(loop.DeviceAmount);
                loop.SetDevices <DeviceInfo8001>(lstDeviceInfo);
                break;
            }

            case ControllerType.NT8007:
            {
                DeviceService8007 deviceService = new DeviceService8007();
                deviceService.TheLoop = loop;
                List <DeviceInfo8007> lstDeviceInfo = deviceService.Create(loop.DeviceAmount);
                loop.SetDevices <DeviceInfo8007>(lstDeviceInfo);
                break;
            }

            case ControllerType.NT8021:
            {
                DeviceService8021 deviceService = new DeviceService8021();
                deviceService.TheLoop = loop;
                List <DeviceInfo8021> lstDeviceInfo = deviceService.Create(loop.DeviceAmount);
                loop.SetDevices <DeviceInfo8021>(lstDeviceInfo);
                break;
            }

            case ControllerType.NT8036:
            {
                DeviceService8036 deviceService = new DeviceService8036();
                deviceService.TheLoop = loop;
                List <DeviceInfo8036> lstDeviceInfo = deviceService.Create(loop.DeviceAmount);
                loop.SetDevices <DeviceInfo8036>(lstDeviceInfo);
                break;
            }

            case ControllerType.NT8053:
            {
                DeviceService8053 deviceService = new DeviceService8053();
                deviceService.TheLoop = loop;
                List <DeviceInfo8053> lstDeviceInfo = deviceService.Create(loop.DeviceAmount);
                loop.SetDevices <DeviceInfo8053>(lstDeviceInfo);
                break;
            }
            }
        }