Beispiel #1
0
        /// <summary>
        /// 修改Module所属的通道数量 轴/Dio/Aio/Trig等等
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolStripMenuItemResetChannelCount_Click(object sender, EventArgs e)
        {
            TreeNode              currNode = tvDevs.SelectedNode;
            DevNodeInfo           nodeInfo = currNode.Tag as DevNodeInfo;
            JFDevCellNameManeger  mgr      = JFHubCenter.Instance.MDCellNameMgr;
            FormSetModuleChnCount fm       = new FormSetModuleChnCount();

            if (nodeInfo.Categoty == DevNodeCategory.MotionModule)
            {
                fm.Category      = FormSetModuleChnCount.ModuleCategory.Motion;
                fm.ChannelCount1 = mgr.GetAxisCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    mgr.SetAxisCount(nodeInfo.DevID, nodeInfo.ModuleIndex, fm.ChannelCount1);
                    _UpdateChannelNode(currNode);//_UpdateCfg2UI();
                }
            }
            else if (nodeInfo.Categoty == DevNodeCategory.CmpTrigModule)
            {
                fm.Category      = FormSetModuleChnCount.ModuleCategory.Trig;
                fm.ChannelCount1 = mgr.GetCmpTrigCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    mgr.SetCmpTrigCount(nodeInfo.DevID, nodeInfo.ModuleIndex, fm.ChannelCount1);
                    _UpdateChannelNode(currNode);//_UpdateCfg2UI();
                }
            }
            else if (nodeInfo.Categoty == DevNodeCategory.DioModule)
            {
                fm.Category      = FormSetModuleChnCount.ModuleCategory.Dio;
                fm.ChannelCount1 = mgr.GetDiChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                fm.ChannelCount2 = mgr.GetDoChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    mgr.SetDiChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex, fm.ChannelCount1);
                    mgr.SetDoChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex, fm.ChannelCount2);
                    _UpdateChannelNode(currNode);////_UpdateCfg2UI();
                }
            }
            else if (nodeInfo.Categoty == DevNodeCategory.AioModule)
            {
                fm.Category      = FormSetModuleChnCount.ModuleCategory.Aio;
                fm.ChannelCount1 = mgr.GetAiChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                fm.ChannelCount2 = mgr.GetAoChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    mgr.SetAiChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex, fm.ChannelCount1);
                    mgr.SetAoChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex, fm.ChannelCount2);
                    _UpdateChannelNode(currNode);// _UpdateCfg2UI();
                }
            }
        }