private void NaviagtorUserControl_StartControllerButtonClick(object sender, RoutedEventArgs e) { //取得当前的控制器信息 ControllerModel controller = (SCA.Model.ControllerModel)((SCA.WPF.ViewModelsRoot.ViewModels.Navigator.NavigatorItemViewModel)e.OriginalSource).DataItem; InvokeControllerCom iCC = InvokeControllerCom.Instance; //为通信组件指定控制器信息 iCC.TheController = controller; iCC.StartCommunication(); //iCC.TheControllerType.Status = ControllerStatus.DataSending;// 将控制器置于数据发送状态 //switch (iCC.TheControllerType.ControllerType) //{ // case ControllerType.NT8036: // // dictControllerCom.TryGetValue(Model.ControllerModel.ControllerType.NT8036, out controllerTypeBase); // List<DeviceInfo8036> lstDevInfo; // //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; //} }
private void NavigatorUserControl_StopCommunicationExecute(object o) { InvokeControllerCom iCC = InvokeControllerCom.Instance; iCC.StopCommunication(); if (!iCC.GetPortStatus()) //打开成功时才置可用状态 { _blnNavigationStartCommunicationCommandCanExecute = true; _blnNavigationStopCommunicationCommandCanExecute = false; } }
private void NavigatorUserControl_StartCommunicationExecute(object o) { //取得当前的控制器信息 //ControllerModel controller = (SCA.Model.ControllerModel)((SCA.WPF.ViewModelsRoot.ViewModels.Navigator.NavigatorItemViewModel)o).DataItem; 2017-04-06注释 ,调试8003时报错 ControllerModel controller = (SCA.Model.ControllerModel)((SCA.WPF.ViewModelsRoot.ViewModels.Navigator.NavigatorItemViewModel)((RoutedEventArgs)o).OriginalSource).DataItem; InvokeControllerCom iCC = InvokeControllerCom.Instance; //为通信组件指定控制器信息 iCC.TheController = controller; iCC.StartCommunication(); if (iCC.GetPortStatus()) //打开成功时才置可用状态 { _blnNavigationStartCommunicationCommandCanExecute = false; _blnNavigationStopCommunicationCommandCanExecute = true; } }
public void DownloadExecute() { InvokeControllerCom iCC = InvokeControllerCom.Instance; if (iCC.GetPortStatus()) { if (iCC.TheControllerType != null) //如果已经取得当前的控制器类型 { if (iCC.TheControllerType.ControllerType == ControllerType.FT8003) //如果控制器类型不相符,则不执行操作 { List <LoopModel> lstLoopsModel = new List <LoopModel>(); lstLoopsModel.Add(TheLoop); ((ControllerType8003)iCC.TheControllerType).Loops = lstLoopsModel; iCC.TheControllerType.OperableDataType = OperantDataType.Device; iCC.TheControllerType.Status = ControllerStatus.DataSending; iCC.TheControllerType.UpdateProgressBarEvent += UpdateProcessBarStatus; } } } }
private void NaviagtorUserControl_StopControllerButtonClick(object sender, RoutedEventArgs e) { InvokeControllerCom iCC = InvokeControllerCom.Instance; iCC.StopCommunication(); }
//上传当前控制器下的所有信息 public void UploadExecute() { InvokeControllerCom iCC = InvokeControllerCom.Instance; if (iCC.GetPortStatus()) { if (iCC.TheControllerType.GetType().ToString() != "SCA.BusinessLib.Controller.ControllerTypeUnknown") { if (iCC.TheControllerType != null && iCC.TheControllerType.ControllerType != ControllerType.NONE) //如果已经取得当前的控制器类型 { #region 8036 if (iCC.TheControllerType.ControllerType == ControllerType.NT8036) //如果控制器类型不相符,则不执行操作 { List <DeviceInfo8036> lstDevicesInfo = new List <DeviceInfo8036>(); List <LinkageConfigStandard> lstStandardLinkageConfig = new List <LinkageConfigStandard>(); ((ControllerType8036)iCC.TheControllerType).DeviceInfoList = lstDevicesInfo; ((ControllerType8036)iCC.TheControllerType).StandardLinkageConfigList = lstStandardLinkageConfig; iCC.TheController = TheController; iCC.TheControllerType.Status = ControllerStatus.DataReceiving; iCC.AllDataUploadedEvent += UploadedFinished; } #endregion #region 8007 if (iCC.TheControllerType.ControllerType == ControllerType.NT8007) //如果控制器类型不相符,则不执行操作 { List <DeviceInfo8007> lstDevicesInfo = new List <DeviceInfo8007>(); List <LinkageConfigStandard> lstStandardLinkageConfig = new List <LinkageConfigStandard>(); ((ControllerType8007)iCC.TheControllerType).DeviceInfoList = lstDevicesInfo; ((ControllerType8007)iCC.TheControllerType).StandardLinkageConfigList = lstStandardLinkageConfig; iCC.TheController = TheController; iCC.TheControllerType.Status = ControllerStatus.DataReceiving; iCC.AllDataUploadedEvent += UploadedFinished; iCC.TheControllerType.UpdateProgressBarEvent += UpdateProcessBarStatus; } #endregion #region 8003 if (iCC.TheControllerType.ControllerType == ControllerType.FT8003) //如果控制器类型不相符,则不执行操作 { List <DeviceInfo8003> lstDevicesInfo = new List <DeviceInfo8003>(); List <LinkageConfigStandard> lstStandardLinkageConfig = new List <LinkageConfigStandard>(); ((ControllerType8003)iCC.TheControllerType).DeviceInfoList = lstDevicesInfo; ((ControllerType8003)iCC.TheControllerType).StandardLinkageConfigList = lstStandardLinkageConfig; iCC.TheController = TheController; iCC.TheControllerType.Status = ControllerStatus.DataReceiving; iCC.AllDataUploadedEvent += UploadedFinished; iCC.TheControllerType.UpdateProgressBarEvent += UpdateProcessBarStatus; } #endregion #region 8000 if (iCC.TheControllerType.ControllerType == ControllerType.FT8000) //如果控制器类型不相符,则不执行操作 { List <DeviceInfo8000> lstDevicesInfo = new List <DeviceInfo8000>(); List <LinkageConfigStandard> lstStandardLinkageConfig = new List <LinkageConfigStandard>(); ((ControllerType8000)iCC.TheControllerType).DeviceInfoList = lstDevicesInfo; ((ControllerType8000)iCC.TheControllerType).StandardLinkageConfigList = lstStandardLinkageConfig; iCC.TheController = TheController; iCC.TheControllerType.Status = ControllerStatus.DataReceiving; iCC.AllDataUploadedEvent += UploadedFinished; iCC.TheControllerType.UpdateProgressBarEvent += UpdateProcessBarStatus; } #endregion #region 8021 if (iCC.TheControllerType.ControllerType == ControllerType.NT8021) //如果控制器类型不相符,则不执行操作 { List <DeviceInfo8021> lstDevicesInfo = new List <DeviceInfo8021>(); ((ControllerType8021)iCC.TheControllerType).DeviceInfoList = lstDevicesInfo; iCC.TheController = TheController; iCC.TheControllerType.Status = ControllerStatus.DataReceiving; iCC.AllDataUploadedEvent += UploadedFinished; iCC.TheControllerType.UpdateProgressBarEvent += UpdateProcessBarStatus; } #endregion } } } }
//下传当前控制器下的所有信息 public void DownloadExecute() { InvokeControllerCom iCC = InvokeControllerCom.Instance; if (iCC.GetPortStatus()) { if (iCC.TheControllerType.GetType().ToString() != "SCA.BusinessLib.Controller.ControllerTypeUnknown") { if (iCC.TheControllerType != null) //如果已经取得当前的控制器类型 { iCC.TheControllerType.InitializeCommunicateStatus(); #region 8036 if (iCC.TheControllerType.ControllerType == ControllerType.NT8036) //如果控制器类型不相符,则不执行操作 { //下传所有回路信息 // foreach (var linkage in TheController.Loops) // { iCC.TheControllerType.Status = ControllerStatus.DataSending; // 将控制器置于数据发送状态 List <LoopModel> lstLoopsModel = new List <LoopModel>(); lstLoopsModel = TheController.Loops.ToList <LoopModel>(); ((ControllerType8036)iCC.TheControllerType).Loops = lstLoopsModel; //((ControllerType8036)iCC.TheControllerType).DeviceInfoList = linkage.GetDevices<DeviceInfo8036>().ToList<DeviceInfo8036>(); ((ControllerType8036)iCC.TheControllerType).StandardLinkageConfigList = TheController.StandardConfig.ToList <LinkageConfigStandard>(); iCC.TheControllerType.OperableDataType = OperantDataType.DownloadAll; iCC.TheControllerType.Status = ControllerStatus.DataSending; // } ////下传所有标准组态信息 //if (iCC.TheControllerType.Status != ControllerStatus.DataSending) //{ // iCC.TheControllerType.Status = ControllerStatus.DataSending;// 将控制器置于数据发送状态 // iCC.TheControllerType.OperableDataType = OperantDataType.StandardLinkageConfig; // iCC.TheControllerType.Status = ControllerStatus.DataSending; //} } #endregion #region 8001 if (iCC.TheControllerType.ControllerType == ControllerType.NT8001) //如果控制器类型不相符,则不执行操作 { //下传所有回路信息 foreach (var l in TheController.Loops) { iCC.TheControllerType.Status = ControllerStatus.DataSending;// 将控制器置于数据发送状态 ((ControllerType8001)iCC.TheControllerType).DeviceInfoList = l.GetDevices <DeviceInfo8001>(); iCC.TheControllerType.OperableDataType = OperantDataType.Device; iCC.TheControllerType.Status = ControllerStatus.DataSending; } //下传所有标准组态信息 iCC.TheControllerType.Status = ControllerStatus.DataSending;// 将控制器置于数据发送状态 ((ControllerType8001)iCC.TheControllerType).StandardLinkageConfigList = TheController.StandardConfig; iCC.TheControllerType.OperableDataType = OperantDataType.StandardLinkageConfig; iCC.TheControllerType.Status = ControllerStatus.DataSending; //下传所有混合组态信息 iCC.TheControllerType.Status = ControllerStatus.DataSending;// 将控制器置于数据发送状态 ((ControllerType8001)iCC.TheControllerType).MixedLinkageConfigList = TheController.MixedConfig; iCC.TheControllerType.OperableDataType = OperantDataType.MixedLinkageConfig; iCC.TheControllerType.Status = ControllerStatus.DataSending; //下传所有通用组态信息 iCC.TheControllerType.Status = ControllerStatus.DataSending;// 将控制器置于数据发送状态 ((ControllerType8001)iCC.TheControllerType).GeneralLinkageConfigList = TheController.GeneralConfig; iCC.TheControllerType.OperableDataType = OperantDataType.GeneralLinkageConfig; iCC.TheControllerType.Status = ControllerStatus.DataSending; //下传所有网络手动盘信息 iCC.TheControllerType.Status = ControllerStatus.DataSending;// 将控制器置于数据发送状态 ((ControllerType8001)iCC.TheControllerType).ManualControlBoardList = TheController.ControlBoard; iCC.TheControllerType.OperableDataType = OperantDataType.MannualControlBoard; iCC.TheControllerType.Status = ControllerStatus.DataSending; } #endregion #region 8007 if (iCC.TheControllerType.ControllerType == ControllerType.NT8007) //如果控制器类型不相符,则不执行操作 { iCC.TheControllerType.Status = ControllerStatus.DataSending; // 将控制器置于数据发送状态 List <LoopModel> lstLoopsModel = new List <LoopModel>(); lstLoopsModel = TheController.Loops.ToList <LoopModel>(); ((ControllerType8007)iCC.TheControllerType).Loops = lstLoopsModel; ((ControllerType8007)iCC.TheControllerType).StandardLinkageConfigList = TheController.StandardConfig.ToList <LinkageConfigStandard>(); iCC.TheControllerType.OperableDataType = OperantDataType.DownloadAll; iCC.TheControllerType.Status = ControllerStatus.DataSending; iCC.TheControllerType.UpdateProgressBarEvent += UpdateProcessBarStatus; } #endregion #region 8003 if (iCC.TheControllerType.ControllerType == ControllerType.FT8003) //如果控制器类型不相符,则不执行操作 { iCC.TheControllerType.Status = ControllerStatus.DataSending; // 将控制器置于数据发送状态 List <LoopModel> lstLoopsModel = new List <LoopModel>(); lstLoopsModel = TheController.Loops.ToList <LoopModel>(); ((ControllerType8003)iCC.TheControllerType).Loops = lstLoopsModel; ((ControllerType8003)iCC.TheControllerType).StandardLinkageConfigList = TheController.StandardConfig.ToList <LinkageConfigStandard>(); iCC.TheControllerType.OperableDataType = OperantDataType.DownloadAll; iCC.TheControllerType.Status = ControllerStatus.DataSending; } #endregion #region 8000 if (iCC.TheControllerType.ControllerType == ControllerType.FT8000) //如果控制器类型不相符,则不执行操作 { iCC.TheControllerType.Status = ControllerStatus.DataSending; // 将控制器置于数据发送状态 List <LoopModel> lstLoopsModel = new List <LoopModel>(); lstLoopsModel = TheController.Loops.ToList <LoopModel>(); ((ControllerType8000)iCC.TheControllerType).Loops = lstLoopsModel; ((ControllerType8000)iCC.TheControllerType).StandardLinkageConfigList = TheController.StandardConfig.ToList <LinkageConfigStandard>(); iCC.TheControllerType.OperableDataType = OperantDataType.DownloadAll; iCC.TheControllerType.Status = ControllerStatus.DataSending; } #endregion #region 8021 if (iCC.TheControllerType.ControllerType == ControllerType.NT8021) //如果控制器类型不相符,则不执行操作 { iCC.TheControllerType.Status = ControllerStatus.DataSending; // 将控制器置于数据发送状态 List <LoopModel> lstLoopsModel = new List <LoopModel>(); lstLoopsModel = TheController.Loops.ToList <LoopModel>(); ((ControllerType8021)iCC.TheControllerType).Loops = lstLoopsModel; iCC.TheControllerType.OperableDataType = OperantDataType.DownloadAll; iCC.TheControllerType.Status = ControllerStatus.DataSending; iCC.TheControllerType.UpdateProgressBarEvent += UpdateProcessBarStatus; } #endregion } } } }