コード例 #1
0
        void _AddTrigNames()
        {
            string[] allChnNames   = null; //系统中所有已命名的通道
            string[] existChnNames = null; //已存在的通道名称
            //JFInitorManager initorMgr = JFHubCenter.Instance.InitorManager;
            allChnNames   = JFHubCenter.Instance.MDCellNameMgr.AllTrigChannelNames();
            existChnNames = _station.TrigChannelNames; //工站中已有的DI通道名称

            if (null == allChnNames || 0 == allChnNames.Length)
            {
                MessageBox.Show("不存在" + _chnType.ToString() + "命名通道");
                return;
            }

            List <string> lstAddNames = new List <string>(); //可供添加的DI通道名称

            if (null == existChnNames || 0 == existChnNames.Length)
            {
                lstAddNames.AddRange(allChnNames);
            }
            else
            {
                foreach (string chnName in allChnNames)
                {
                    if (!existChnNames.Contains(chnName))
                    {
                        lstAddNames.Add(chnName);
                    }
                }
            }

            if (lstAddNames.Count == 0)
            {
                MessageBox.Show("没有可供添加的" + _chnType.ToString() + "命名通道");
                return;
            }
            List <string> lstAddInfos = new List <string>();

            foreach (string addName in lstAddNames)
            {
                JFDevCellInfo cellInfo = JFHubCenter.Instance.MDCellNameMgr.GetTrigCtrlChannelInfo(addName);
                if (null == cellInfo)
                {
                    lstAddInfos.Add("无设备通道信息");
                }
                else
                {
                    lstAddInfos.Add("设备:" + cellInfo.DeviceID + " 通道:" + cellInfo.ChannelIndex);
                }
            }
            FormAddNames frm = new FormAddNames();

            frm.Text = "为工站:" + _station.Name + " 添加触发光源命名通道";
            frm.SetAvailedNames(lstAddNames.ToArray(), lstAddInfos.ToArray());
            if (DialogResult.OK == frm.ShowDialog())
            {
                string[] chnNamesWillAdd = null;
                string[] chnInfosWillAdd = null;
                frm.GetSelectNameInfos(out chnNamesWillAdd, out chnInfosWillAdd);
                for (int i = 0; i < chnNamesWillAdd.Length; i++)
                {
                    string chnName = chnNamesWillAdd[i];
                    _station.AddTrigChannel(chnName);
                }
                _station.SaveCfg();
                UpdateStation2UI();
            }
        }
コード例 #2
0
        void _AddDINames()
        {
            string[]             allChnNames   = null; //系统中所有已命名的通道
            string[]             existChnNames = null; //已存在的通道名称
            JFDevCellNameManeger nameMgr       = JFHubCenter.Instance.MDCellNameMgr;

            allChnNames   = nameMgr.AllDiNames(); //系统名称表中所有可用的DI通道名称
            existChnNames = _station.DINames;     //工站中已有的DI通道名称

            if (null == allChnNames || 0 == allChnNames.Length)
            {
                MessageBox.Show("不存在" + _chnType.ToString() + "命名通道");
                return;
            }

            List <string> lstAddNames = new List <string>(); //可供添加的DI通道名称

            if (null == existChnNames || 0 == existChnNames.Length)
            {
                lstAddNames.AddRange(allChnNames);
            }
            else
            {
                foreach (string chnName in allChnNames)
                {
                    if (!existChnNames.Contains(chnName))
                    {
                        lstAddNames.Add(chnName);
                    }
                }
            }

            if (lstAddNames.Count == 0)
            {
                MessageBox.Show("没有可供添加的" + _chnType.ToString() + "命名通道");
                return;
            }
            List <string> lstAddInfos = new List <string>();

            foreach (string addName in lstAddNames)
            {
                JFDevCellInfo chnInfo = nameMgr.GetDiCellInfo(addName);
                lstAddInfos.Add(string.Format("控制器:{0} - 模块:{1} - 通道:{2}", chnInfo.DeviceID, chnInfo.ModuleIndex, chnInfo.ChannelIndex));
            }
            FormAddNames frm = new FormAddNames();

            frm.Text = "为工站:" + _station.Name + " 添加Di命名通道";
            frm.SetAvailedNames(lstAddNames.ToArray(), lstAddInfos.ToArray());
            if (DialogResult.OK == frm.ShowDialog())
            {
                string[] chnNamesWillAdd = null;
                string[] chnInfosWillAdd = null;
                frm.GetSelectNameInfos(out chnNamesWillAdd, out chnInfosWillAdd);
                for (int i = 0; i < chnNamesWillAdd.Length; i++)
                {
                    string chnName = chnNamesWillAdd[i];
                    _station.AddDI(chnName);
                }
                _station.SaveCfg();
                UpdateStation2UI();
            }
        }
コード例 #3
0
        void _AddCmrNames()
        {
            string[]        allChnNames   = null; //系统中所有已命名的通道
            string[]        existChnNames = null; //已存在的通道名称
            JFInitorManager initorMgr     = JFHubCenter.Instance.InitorManager;

            allChnNames   = initorMgr.GetIDs(typeof(IJFDevice_Camera));
            existChnNames = _station.CameraNames; //工站中已有的DI通道名称

            if (null == allChnNames || 0 == allChnNames.Length)
            {
                MessageBox.Show("不存在" + _chnType.ToString() + "命名通道");
                return;
            }

            List <string> lstAddNames = new List <string>(); //可供添加的DI通道名称

            if (null == existChnNames || 0 == existChnNames.Length)
            {
                lstAddNames.AddRange(allChnNames);
            }
            else
            {
                foreach (string chnName in allChnNames)
                {
                    if (!existChnNames.Contains(chnName))
                    {
                        lstAddNames.Add(chnName);
                    }
                }
            }

            if (lstAddNames.Count == 0)
            {
                MessageBox.Show("没有可供添加的" + _chnType.ToString() + "命名通道");
                return;
            }
            List <string> lstAddInfos = new List <string>();

            foreach (string addName in lstAddNames)
            {
                StringBuilder    sbDevInfo  = new StringBuilder();
                IJFDevice_Camera cmr        = initorMgr.GetInitor(addName) as IJFDevice_Camera;
                string[]         paramNames = cmr.InitParamNames;
                if (null != paramNames)
                {
                    foreach (string paramName in paramNames)
                    {
                        sbDevInfo.Append(paramName + ":" + cmr.GetInitParamValue(paramName).ToString() + " ");
                    }
                }

                lstAddInfos.Add(sbDevInfo.ToString());
            }
            FormAddNames frm = new FormAddNames();

            frm.Text = "为工站:" + _station.Name + " 添加Camera命名通道";
            frm.SetAvailedNames(lstAddNames.ToArray(), lstAddInfos.ToArray());
            if (DialogResult.OK == frm.ShowDialog())
            {
                string[] chnNamesWillAdd = null;
                string[] chnInfosWillAdd = null;
                frm.GetSelectNameInfos(out chnNamesWillAdd, out chnInfosWillAdd);
                for (int i = 0; i < chnNamesWillAdd.Length; i++)
                {
                    string chnName = chnNamesWillAdd[i];
                    _station.AddCamera(chnName);
                }
                _station.SaveCfg();
                UpdateStation2UI();
            }
        }