/// <summary>
        /// 将界面上的内容保存到Station配置中
        /// </summary>
        /// <returns></returns>
        bool Save2Station(out string errorInfo)
        {
            errorInfo = "Success";
            if (_station == null)
            {
                return(true);
            }
            bool          isCheckOK   = true;
            StringBuilder sbErrorInfo = new StringBuilder();

            //先检查所有参数合法性
            foreach (TabPage tp in tabControlCF1.TabPages)
            {
                DataGridView dgv     = tp.Controls[0] as DataGridView;
                NamedChnType chnType = (NamedChnType)tp.Tag;
                foreach (DataGridViewRow row in dgv.Rows)
                {
                    List <List <string> > locAndGlobMaps = null;
                    string[] allGlobChnNamesInStation    = null; //所有可供绑定的全局通道名称
                    switch (chnType)
                    {
                    case NamedChnType.Di:    //数字输入
                        locAndGlobMaps           = _station.DeclearedDevChnMapping[NamedChnType.Di];
                        allGlobChnNamesInStation = _station.DINames;
                        break;

                    case NamedChnType.Do:    //
                        locAndGlobMaps           = _station.DeclearedDevChnMapping[NamedChnType.Do];
                        allGlobChnNamesInStation = _station.DONames;
                        break;

                    case NamedChnType.Axis:    //
                        locAndGlobMaps           = _station.DeclearedDevChnMapping[NamedChnType.Axis];
                        allGlobChnNamesInStation = _station.AxisNames;
                        break;

                    case NamedChnType.CmpTrig:    //
                        locAndGlobMaps           = _station.DeclearedDevChnMapping[NamedChnType.CmpTrig];
                        allGlobChnNamesInStation = _station.CmpTrigNames;
                        break;

                    case NamedChnType.Ai:    //
                        locAndGlobMaps           = _station.DeclearedDevChnMapping[NamedChnType.Ai];
                        allGlobChnNamesInStation = _station.AINames;
                        break;

                    case NamedChnType.Ao:    //
                        locAndGlobMaps           = _station.DeclearedDevChnMapping[NamedChnType.Ao];
                        allGlobChnNamesInStation = _station.AONames;
                        break;

                    case NamedChnType.Camera:
                        locAndGlobMaps           = _station.DeclearedDevChnMapping[NamedChnType.Camera];
                        allGlobChnNamesInStation = _station.CameraNames;
                        break;

                    case NamedChnType.Light:    //
                        locAndGlobMaps           = _station.DeclearedDevChnMapping[NamedChnType.Light];
                        allGlobChnNamesInStation = _station.LightChannelNames;
                        break;

                    case NamedChnType.Trig:    //数字输入
                        locAndGlobMaps           = _station.DeclearedDevChnMapping[NamedChnType.Trig];
                        allGlobChnNamesInStation = _station.TrigChannelNames;
                        break;

                    default:
                        continue;
                    }
                    string chnLocName = row.Cells[0].Value as string;//站内通道名称
                    //string currGlobName = null;//当前绑定的全局通道名
                    //foreach (List<string> kv in locAndGlobMaps)
                    //    if (kv[0] == chnLocName)
                    //        currGlobName = kv[1];
                    DataGridViewComboBoxCell cellGlobNames = row.Cells[1] as DataGridViewComboBoxCell;
                    string currGlobNameSel = cellGlobNames.Value as string; //当前所选的全局通道名称
                    if (string.IsNullOrEmpty(currGlobNameSel))
                    {
                        isCheckOK = false;
                        sbErrorInfo.AppendLine("站内" + chnType.ToString() + "通道:\"" + chnLocName + "\"未绑定全局ID");
                    }
                    else
                    {
                        if (null == allGlobChnNamesInStation || !allGlobChnNamesInStation.Contains(currGlobNameSel))
                        {
                            isCheckOK = false;
                            sbErrorInfo.AppendLine("站内" + chnType.ToString() + "通道:\"" + chnLocName + "\n绑定的全局ID = \"" + currGlobNameSel + "\"在工站设备表中不存在");
                        }
                    }
                }
            }
            if (!isCheckOK)
            {
                errorInfo = sbErrorInfo.ToString();
                return(false);
            }
            //保存所有参数

            foreach (TabPage tp in tabControlCF1.TabPages)
            {
                DataGridView dgv     = tp.Controls[0] as DataGridView;
                NamedChnType chnType = (NamedChnType)tp.Tag;
                foreach (DataGridViewRow row in dgv.Rows)
                {
                    string locName  = row.Cells[0].Value as string;
                    string globName = row.Cells[1].Value as string;
                    List <List <string> > locGlobMappings = _station.DeclearedDevChnMapping[chnType];
                    foreach (List <string> lg in locGlobMappings)
                    {
                        if (lg[0] == locName)
                        {
                            lg[1] = globName;
                            break;
                        }
                    }
                }
            }
            _station.SaveCfg();
            return(true);
        }
        void UpdateStation2UI()
        {
            if (InvokeRequired)
            {
                Invoke(new Action(UpdateStation2UI));
                return;
            }
            dgvNameInfos.Rows.Clear();
            if (null == _station)
            {
                btAdd.Enabled = false;
                btDel.Enabled = false;
                lbTital.Text  = "工站未设置";
                ShowTips("工站未设置,不能编辑命名通道!");
                return;
            }
            lbTital.Text = "工站:" + _station.Name;
            if (_chnType == NamedChnType.None)
            {
                btAdd.Enabled = false;
                btDel.Enabled = false;
                lbTital.Text += " 通道类型未设置";
                ShowTips("通道类型未设置,不能编辑!");
                return;
            }

            btAdd.Enabled = true;
            btDel.Enabled = true;
            lbTital.Text += (" " + _chnType.ToString() + "通道名称列表");

            switch (_chnType)
            {
            case NamedChnType.Ai:
                _UpdateAI();
                break;

            case NamedChnType.Ao:
                _UpDateAO();
                break;

            case NamedChnType.Axis:
                _UpdateAxis();
                break;

            case NamedChnType.Di:
                _UpdateDI();
                break;

            case NamedChnType.Do:
                _UpdateDO();
                break;

            case NamedChnType.CmpTrig:
                _UpdateCmpTrig();
                break;

            case NamedChnType.Camera:
                _UpdateCmr();
                break;

            case NamedChnType.Light:
                _UpdateLight();
                break;

            case NamedChnType.Trig:
                _UpdateTrig();
                break;

            default:
                btAdd.Enabled = false;
                btDel.Enabled = false;
                ShowTips("暂不支持的通道类型:" + _chnType.ToString());
                break;
            }
        }