Exemple #1
0
        public void AddModule(IJFModule_AIO module, string moduleName)
        {
            if (null == module)
            {
                return;
            }
            if (_lstModules.Contains(module))
            {
                return;
            }

            if (null == moduleName)
            {
                moduleName = "AIO";
            }
            TabPage tp = new TabPage();

            tabCtrl.TabPages.Add(tp);
            UcAIO uc = new UcAIO();

            uc.Dock    = DockStyle.Fill;
            uc.Parent  = tp;
            uc.Visible = true;
            uc.SetModuleInfo(module, null, null);//uc.SetDioModule(module, null, null);
            tp.Text = moduleName;
            tp.Name = moduleName;
            tp.Controls.Add(uc);
            _lstModules.Add(module);
        }
Exemple #2
0
 public void RemoveIO(IJFModule_AIO aio, int index)
 {
     foreach (UcAIOChn uc in lstUcAio)
     {
         if (uc.AIOModule == aio && index == uc.IOIndex)
         {
             lstUcAio.Remove(uc);
             Controls.Remove(uc);
             AdjustIOView();
             return;
         }
     }
 }
        public void UpdateChannelsInfo(string devID, int moduleIndex)
        {
            //int nBottom = 0;
            pnAi.Controls.Clear();
            pnAo.Controls.Clear();
            JFDevCellNameManeger mgr = JFHubCenter.Instance.MDCellNameMgr;
            IJFModule_AIO        md  = null;
            IJFDevice_MotionDaq  dev = JFHubCenter.Instance.InitorManager.GetInitor(devID) as IJFDevice_MotionDaq;

            if (dev != null && dev.DioCount > moduleIndex)
            {
                md = dev.GetAio(moduleIndex);
            }
            int AiCount = mgr.GetAiChannelCount(devID, moduleIndex);

            for (int i = 0; i < AiCount; i++)
            {
                Label lbIndex = new Label();
                lbIndex.Text     = i.ToString("D2");
                lbIndex.Location = new Point(2, 10 + i * 33 + 2);
                lbIndex.Width    = 30;
                pnAi.Controls.Add(lbIndex);
                UcAIOChn ucAi = new UcAIOChn();
                pnAi.Controls.Add(ucAi);
                ucAi.Location = new Point(32, 2 + i * 33);
                ucAi.Width    = pnAi.Width - 34;
                ucAi.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                ucAi.SetIOInfo(md, i, false, mgr.GetAiName(devID, moduleIndex, i));
                //nBottom = ucAi.Bottom;
            }
            int aoCount = mgr.GetAoChannelCount(devID, moduleIndex);

            for (int i = 0; i < aoCount; i++)
            {
                Label lbIndex = new Label();
                lbIndex.Text     = i.ToString("D2");
                lbIndex.Location = new Point(2, 10 + i * 33 + 2);
                lbIndex.Width    = 30;
                pnAo.Controls.Add(lbIndex);
                UcAIOChn ucAo = new UcAIOChn();
                pnAo.Controls.Add(ucAo);
                ucAo.Location = new Point(32, 2 + i * 33);
                ucAo.Width    = pnAi.Width - 34;
                ucAo.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                ucAo.SetIOInfo(md, i, true, mgr.GetAoName(devID, moduleIndex, i));
                //if (nBottom < ucAo.Bottom)
                //    nBottom = ucAo.Bottom;
            }

            //rtTips.Top = nBottom + 10;
        }
Exemple #4
0
 public void SetIOInfo(IJFModule_AIO aio,int ioIndex,bool isAo,string name)
 {
     if(InvokeRequired)
     {
         Invoke(new DgSetIOInfo(SetIOInfo), new object[] { aio, ioIndex, isAo, name });
         return;
     }
     IOName = name;
     _isAo = isAo;
     tbIOValue.Enabled = _isAo;
     _aio = aio;
     if(null == _aio)
         tbIOValue.Enabled = false;
     _ioIndex = ioIndex;
 }
Exemple #5
0
 public void SetModuleInfo(IJFModule_AIO module, string[] aiNames, string[] aoNames)
 {
     if (InvokeRequired)
     {
         Invoke(new dgSetModule(SetModuleInfo), new object[] { module, aiNames, aoNames });
         return;
     }
     ucAiPanel.RemoveAllAIO();
     ucAoPanel.RemoveAllAIO();
     if (null == module)
     {
         return;
     }
     for (int i = 0; i < module.AICount; i++)
     {
         ucAiPanel.AddIO(module, i, aiNames == null ? null : (aiNames.Length > i ? aiNames[i] : null));
     }
     for (int i = 0; i < module.AOCount; i++)
     {
         ucAoPanel.AddIO(module, i, aoNames == null ? null : (aoNames.Length > i ? aoNames[i] : null));
     }
 }
Exemple #6
0
        public void AddIO(IJFModule_AIO aio, int index, string name = null)
        {
            if (name == null)
            {
                name = (IsAnalogOut ? "Out_" : "In_") + index.ToString("D2");
            }
            foreach (UcAIOChn uc in lstUcAio)
            {
                if (uc.AIOModule == aio && index == uc.IOIndex)
                {
                    return;
                }
            }
            UcAIOChn uc2Add = new UcAIOChn();

            uc2Add.Height = 23;
            uc2Add.SetIOInfo(aio, index, IsAnalogOut, name);
            Controls.Add(uc2Add);
            lstUcAio.Add(uc2Add);
            if (_isLoaded)
            {
                AdjustIOView();
            }
        }