コード例 #1
0
        private void ToolStripMenuItemAddMotionDaq_Click(object sender, EventArgs e)
        {
            FormDevModuleInfo fm = new FormDevModuleInfo();

            fm.Text        = "添加MotionDaq设备命名表";
            fm.SettingMode = DevModuleSettingMode.Add;
            if (DialogResult.OK != fm.ShowDialog())
            {
                return;
            }
            JFHubCenter.Instance.MDCellNameMgr.AddMotionDaqDevice(fm.DevID);
            JFHubCenter.Instance.MDCellNameMgr.SetAxisModuleCount(fm.DevID, fm.MotionCount);
            JFHubCenter.Instance.MDCellNameMgr.SetDioModuleCount(fm.DevID, fm.DioCount);
            JFHubCenter.Instance.MDCellNameMgr.SetAioModuleCount(fm.DevID, fm.AioCount);
            JFHubCenter.Instance.MDCellNameMgr.SetCmpTrigModuleCount(fm.DevID, fm.TrigCount);
            //_UpdateCfg2UI();
            _AddDevNode(fm.DevID, DevNodeCategory.MotionDaqDev);
        }
コード例 #2
0
        /// <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);
            }
        }