Esempio n. 1
0
        /// <summary>
        /// 添加一个带触发功能的光源控制器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripMenuItemAddLightTrig_Click(object sender, EventArgs e)
        {
            FormAddMChnDev fm = new FormAddMChnDev();

            fm.Text = "添加光源控制器设备_T";
            string[] devIDs = JFHubCenter.Instance.InitorManager.GetIDs(typeof(IJFDevice_LightControllerWithTrig)); //所有触发控制设备ID,过滤掉其中的光源控制器
            if (null == devIDs || 0 == devIDs.Length)
            {
                MessageBox.Show("设备列表中不存在光源控制器设备_T");
                return;
            }
            fm.SetOptionalDeviceIDs(devIDs);
            fm.SetChannelTypes(new string[] { "开关通道数量:", "触发通道数量:" });
            if (DialogResult.OK != fm.ShowDialog())
            {
                return;
            }

            JFHubCenter.Instance.MDCellNameMgr.AddLightCtrlDev(fm.DeviceID);
            JFHubCenter.Instance.MDCellNameMgr.SetLightCtrlChannelCount(fm.DeviceID, fm.ChannelCount[0]);

            JFHubCenter.Instance.MDCellNameMgr.AddTrigCtrlDev(fm.DeviceID);
            JFHubCenter.Instance.MDCellNameMgr.SetTrigCtrlChannelCount(fm.DeviceID, fm.ChannelCount[1]);
            _AddDevNode(fm.DeviceID, DevNodeCategory.LightCtrlTDev);
        }
Esempio n. 2
0
        /// <summary>
        /// 添加一个触发控制器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripMenuItemAddTrigCtrl_Click(object sender, EventArgs e)
        {
            FormAddMChnDev fm = new FormAddMChnDev();

            fm.Text = "添加触发控制器设备";
            string[] devIDs = JFHubCenter.Instance.InitorManager.GetIDs(typeof(IJFDevice_TrigController)); //所有触发控制设备ID,过滤掉其中的光源控制器
            if (null == devIDs || 0 == devIDs.Length)
            {
                MessageBox.Show("设备列表中不存在触发控制器设备");
                return;
            }
            List <string> trigDevIDs = new List <string>();

            foreach (string devID in devIDs)
            {
                if (!typeof(IJFDevice_LightController).IsAssignableFrom(JFHubCenter.Instance.InitorManager.GetInitor(devID).GetType()))
                {
                    trigDevIDs.Add(devID);
                }
            }
            if (trigDevIDs.Count == 0)
            {
                MessageBox.Show("设备列表中不存在触发控制器设备...");
                return;
            }
            fm.SetOptionalDeviceIDs(trigDevIDs.ToArray());
            fm.SetChannelTypes(new string[] { "触发通道数量:" });
            if (DialogResult.OK != fm.ShowDialog())
            {
                return;
            }

            JFHubCenter.Instance.MDCellNameMgr.AddTrigCtrlDev(fm.DeviceID);
            JFHubCenter.Instance.MDCellNameMgr.SetTrigCtrlChannelCount(fm.DeviceID, fm.ChannelCount[0]);
            _AddDevNode(fm.DeviceID, DevNodeCategory.TrigCtrlDev);
        }
Esempio n. 3
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);
            }
        }