Ejemplo n.º 1
0
        /// <summary>
        /// 加载列配置字典
        /// </summary>
        public void Load()
        {
            string  _ErrorString = "";
            XmlNode _XmlNode     = clsXmlControl.LoadXml(Application.StartupPath + Const.Variable.CONST_COLSVISIABLE, out _ErrorString);

            if (_ErrorString != "" || _XmlNode.ChildNodes.Count < 1) //_XmlNode.ChildNodes.Count < 31)             //新增加5条
            {
                #region 初始化列显示参数信息
                _XmlNode = clsXmlControl.CreateXmlNode("ColsConfig");
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "任务编号", "Name", "任务编号", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "工单号", "Name", "工单号", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "计量编号", "Name", "计量编号", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "出厂编号", "Name", "出厂编号", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "表通信地址", "Name", "表通信地址", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "出厂日期", "Name", "出厂日期", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "证书编号", "Name", "证书编号", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "表名称", "Name", "表名称", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "铅封1", "Name", "铅封1", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "铅封2", "Name", "铅封2", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "铅封3", "Name", "铅封3", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "铅封4", "Name", "铅封4", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "铅封5", "Name", "铅封5", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "软件版本号", "Name", "软件版本号", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "硬件版本号", "Name", "硬件版本号", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "到货批次号", "Name", "到货批次号", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "备用1", "Name", "备用1", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "备用2", "Name", "备用2", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "备用3", "Name", "备用3", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "备用4", "Name", "备用4", "ShowType", "0"));
                _XmlNode.AppendChild(clsXmlControl.CreateXmlNode("R", "ID", "备用5", "Name", "备用5", "ShowType", "0"));

                clsXmlControl.SaveXml(_XmlNode, Application.StartupPath + Const.Variable.CONST_DGNDICTIONARY);
                #endregion
            }
            _ColsVisiable.Clear();
            for (int _i = 0; _i < _XmlNode.ChildNodes.Count; _i++)
            {
                Struct.StColsVisiable _Col = new CLDC_DataCore.Struct.StColsVisiable();
                _Col.ColName     = _XmlNode.ChildNodes[_i].Attributes[0].Value;
                _Col.ColShowName = _XmlNode.ChildNodes[_i].Attributes[1].Value;
                _Col.ColShowType = int.Parse(_XmlNode.ChildNodes[_i].Attributes[2].Value);

                _ColsVisiable.Add(_Col.ColName, _Col);
            }
        }
        private void btn_OK_Click(object sender, EventArgs e)
        {
            //TODO:处理界面更改
            Dictionary <string, StColsVisiable> _ColsVisiable = new Dictionary <string, StColsVisiable>();

            for (int i = 0; i < dgv_CXLRColsVisiable.Rows.Count; i++)
            {
                StColsVisiable _Col = new CLDC_DataCore.Struct.StColsVisiable();
                _Col.ColName     = dgv_CXLRColsVisiable.Rows[i].Cells[0].Value.ToString();
                _Col.ColShowName = dgv_CXLRColsVisiable.Rows[i].Cells[1].Value.ToString();
                _Col.ColShowType = (bool)dgv_CXLRColsVisiable.Rows[i].Cells[2].Value == true ? 1 : 0;
                _ColsVisiable.Add(_Col.ColName, _Col);
            }

            _SystemCol.ColsVisiable._ColsVisiable = _ColsVisiable;
            _SystemCol.ColsVisiable.Save();
            this.Close();
        }