Example #1
0
        public void UpdateChannelsInfo(string devID, int moduleIndex)
        {
            pnDi.Controls.Clear();
            pnDo.Controls.Clear();
            JFDevCellNameManeger mgr = JFHubCenter.Instance.MDCellNameMgr;
            IJFModule_DIO        md  = null;
            IJFDevice_MotionDaq  dev = JFHubCenter.Instance.InitorManager.GetInitor(devID) as IJFDevice_MotionDaq;

            if (dev != null && dev.DioCount > moduleIndex)
            {
                md = dev.GetDio(moduleIndex);
            }
            int diCount = mgr.GetDiChannelCount(devID, moduleIndex);

            for (int i = 0; i < diCount; i++)
            {
                Label lbIndex = new Label();
                lbIndex.Text     = i.ToString("D2");
                lbIndex.Location = new Point(2, 10 + i * 33 + 2);
                lbIndex.Width    = 30;
                pnDi.Controls.Add(lbIndex);
                UcDioChn ucDi = new UcDioChn();
                pnDi.Controls.Add(ucDi);
                ucDi.Location = new Point(32, 2 + i * 33);
                ucDi.Width    = pnDi.Width - 34;
                ucDi.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                ucDi.SetDioInfo(md, i, false, mgr.GetDiName(devID, moduleIndex, i));
            }
            int doCount = mgr.GetDoChannelCount(devID, moduleIndex);

            for (int i = 0; i < doCount; i++)
            {
                Label lbIndex = new Label();
                lbIndex.Text     = i.ToString("D2");
                lbIndex.Location = new Point(2, 10 + i * 33 + 2);
                lbIndex.Width    = 30;
                pnDo.Controls.Add(lbIndex);
                UcDioChn ucDo = new UcDioChn();
                pnDo.Controls.Add(ucDo);
                ucDo.Location = new Point(32, 2 + i * 33);
                ucDo.Width    = pnDi.Width - 34;
                ucDo.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                ucDo.SetDioInfo(md, i, true, mgr.GetDoName(devID, moduleIndex, i));
            }
        }