/// <summary> /// 修改设备所属的模块数量 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ToolStripMenuItemResetDevsModuleCount_Click(object sender, EventArgs e) { TreeNode currNode = tvDevs.SelectedNode; DevNodeInfo nodeInfo = currNode.Tag as DevNodeInfo; JFDevCellNameManeger mgr = JFHubCenter.Instance.MDCellNameMgr; if (nodeInfo.Categoty == DevNodeCategory.MotionDaqDev) //更改运动控制器模块数量 { FormDevModuleInfo fm = new FormDevModuleInfo(); fm.DevID = nodeInfo.DevID; fm.MotionCount = mgr.GetAxisModuleCount(nodeInfo.DevID); fm.DioCount = mgr.GetDioModuleCount(nodeInfo.DevID); fm.AioCount = mgr.GetAioModuleCount(nodeInfo.DevID); fm.TrigCount = mgr.GetCmpTrigModuleCount(nodeInfo.DevID); fm.SettingMode = DevModuleSettingMode.Set; if (DialogResult.OK == fm.ShowDialog()) { mgr.SetAxisModuleCount(nodeInfo.DevID, fm.MotionCount); mgr.SetDioModuleCount(nodeInfo.DevID, fm.DioCount); mgr.SetAioModuleCount(nodeInfo.DevID, fm.AioCount); mgr.SetCmpTrigModuleCount(nodeInfo.DevID, fm.TrigCount); _UpdateModuleNode(currNode);//_UpdateCfg2UI(); } } else if (nodeInfo.Categoty == DevNodeCategory.TrigCtrlDev)//更改触发控制器通道数量 { FormAddMChnDev fm = new FormAddMChnDev(); fm.Text = "修改触发器通道数量"; string[] devIDs = JFHubCenter.Instance.InitorManager.GetIDs(typeof(IJFDevice_TrigController)); //所有触发控制设备ID,过滤掉其中的光源控制器 List <string> trigDevIDs = new List <string>(); fm.SetDeviceID(nodeInfo.DevID); fm.SettingMode = DevModuleSettingMode.Set; fm.SetChannelTypes(new string[] { "触发通道数量:" }); int nCurrChns = JFHubCenter.Instance.MDCellNameMgr.GetTrigCtrlChannelCount(nodeInfo.DevID); fm.ChannelCount = new int[] { nCurrChns }; if (DialogResult.OK != fm.ShowDialog()) { return; } JFHubCenter.Instance.MDCellNameMgr.SetTrigCtrlChannelCount(fm.DeviceID, fm.ChannelCount[0]); _UpdateModuleNode(currNode); } else if (nodeInfo.Categoty == DevNodeCategory.LightCtrlTDev) //更改光源控制器通道数量 { FormAddMChnDev fm = new FormAddMChnDev(); fm.Text = "修改光源通道数量"; // string[] devIDs = JFHubCenter.Instance.InitorManager.GetIDs(typeof(IJFDevice_TrigController)); //所有触发控制设备ID,过滤掉其中的光源控制器 //List<string> trigDevIDs = new List<string>(); fm.SetDeviceID(nodeInfo.DevID); fm.SettingMode = DevModuleSettingMode.Set; fm.SetChannelTypes(new string[] { "开关通道数量", "触发通道数量:" }); int lightChnCount = JFHubCenter.Instance.MDCellNameMgr.GetLightCtrlChannelCount(nodeInfo.DevID); int trigChnCount = JFHubCenter.Instance.MDCellNameMgr.GetTrigCtrlChannelCount(nodeInfo.DevID); fm.ChannelCount = new int[] { lightChnCount, trigChnCount }; if (DialogResult.OK != fm.ShowDialog()) { return; } JFHubCenter.Instance.MDCellNameMgr.SetLightCtrlChannelCount(fm.DeviceID, fm.ChannelCount[0]); JFHubCenter.Instance.MDCellNameMgr.SetTrigCtrlChannelCount(fm.DeviceID, fm.ChannelCount[1]); _UpdateModuleNode(currNode); } }