Esempio n. 1
0
        //private int GetMaxCode(List<LinkageConfigStandard> lcs)
        //{
        //    int result = 0;
        //    if (lcs != null)
        //    {
        //        var query = from r in lcs select r.Code;
        //        if (query != null)
        //        {
        //            foreach (var i in query)
        //            {
        //                if (Convert.ToInt32(i) > result)
        //                {
        //                    result = Convert.ToInt32(i);
        //                }
        //            }
        //        }
        //    }
        //    return result;
        //}


        public void DownloadExecute(List <LinkageConfigStandard> lstLinkageConfigStandard)
        {
            InvokeControllerCom iCC = InvokeControllerCom.Instance;

            if (iCC.GetPortStatus())
            {
                if (iCC.TheControllerType.GetType().ToString() != "SCA.BusinessLib.Controller.ControllerTypeUnknown") //操作类仍未准备好,暂不能下传,需要将此逻辑移到按钮的CanExecute中进行处理
                {
                    iCC.TheControllerType.Status = ControllerStatus.DataSending;                                      // 将控制器置于数据发送状态
                    switch (iCC.TheControllerType.ControllerType)
                    {
                    case ControllerType.NT8036:
                        //  dictControllerCom.TryGetValue(Model.ControllerModel.ControllerType.NT8036, out controllerTypeBase);

                        //ControllerCommunicationTesting.Get8036DevInfo(out lstDevInfo);
                        ((ControllerType8036)iCC.TheControllerType).StandardLinkageConfigList = lstLinkageConfigStandard;
                        //controllerTypeBase.SendDeviceInfo();
                        iCC.TheControllerType.OperableDataType = OperantDataType.StandardLinkageConfig;
                        iCC.TheControllerType.Status           = ControllerStatus.DataSending;
                        break;

                    case ControllerType.NT8001:
                        //dictControllerCom.TryGetValue(Model.ControllerModel.ControllerType.NT8001, out controllerTypeBase);
                        //List<DeviceInfo8001> lstDevInfo8001; //#1 需要确认继续抽像??!!
                        //Get8001DevInfo(out lstDevInfo8001); //#2
                        //((ControllerType8001)iCC.TheControllerType).DeviceInfoList = lstDevInfo8001; //#3
                        ////controllerTypeBase.SendDeviceInfo();
                        //iCC.TheControllerType.OperableDataType = OperantDataType.Device;
                        //iCC.TheControllerType.Status = ControllerStatus.DataSending;
                        break;

                    case ControllerType.NT8007:
                        ((ControllerType8007)iCC.TheControllerType).StandardLinkageConfigList = lstLinkageConfigStandard;
                        iCC.TheControllerType.OperableDataType = OperantDataType.StandardLinkageConfig;
                        iCC.TheControllerType.Status           = ControllerStatus.DataSending;
                        break;

                    case ControllerType.FT8003:
                        ((ControllerType8003)iCC.TheControllerType).StandardLinkageConfigList = lstLinkageConfigStandard;
                        iCC.TheControllerType.OperableDataType = OperantDataType.StandardLinkageConfig;
                        iCC.TheControllerType.Status           = ControllerStatus.DataSending;
                        break;

                    case ControllerType.FT8000:
                        ((ControllerType8000)iCC.TheControllerType).StandardLinkageConfigList = lstLinkageConfigStandard;
                        iCC.TheControllerType.OperableDataType = OperantDataType.StandardLinkageConfig;
                        iCC.TheControllerType.Status           = ControllerStatus.DataSending;
                        break;

                    default:
                        iCC.TheControllerType.Status = ControllerStatus.DataSended;    // 没有控制器可以处理此信息,将控制器置于数据发送完成状态
                        break;
                    }
                }
            }
        }
        public void DownloadExecute(List <LinkageConfigGeneral> lstLinkageConfigGeneral)
        {
            InvokeControllerCom iCC = InvokeControllerCom.Instance;

            if (iCC.GetPortStatus())
            {
                iCC.TheControllerType.Status = ControllerStatus.DataSending;// 将控制器置于数据发送状态
                switch (iCC.TheControllerType.ControllerType)
                {
                case ControllerType.NT8001:
                    ((ControllerType8001)iCC.TheControllerType).GeneralLinkageConfigList = lstLinkageConfigGeneral;
                    iCC.TheControllerType.OperableDataType = OperantDataType.GeneralLinkageConfig;
                    iCC.TheControllerType.Status           = ControllerStatus.DataSending;
                    break;
                }
            }
        }