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_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; } }