示例#1
0
        private void saveRow_Click(object sender, EventArgs e)
        {
            DataGridViewRowCollection rows = this.gvType.Rows;
            List <TypeData>           list = new List <TypeData>();

            foreach (DataGridViewRow row in rows)
            {
                TypeData type = new TypeData();
                type.Type      = row.Cells["devType"].Value == null ? "" : row.Cells["devType"].Value.ToString();
                type.Name      = row.Cells["devName"].Value == null ? "" : row.Cells["devName"].Value.ToString();
                type.Value1    = row.Cells["devUnit1"].Value == null ? "" : row.Cells["devUnit1"].Value.ToString();
                type.Value2    = row.Cells["devUnit2"].Value == null ? "" : row.Cells["devUnit2"].Value.ToString();
                type.DropType  = row.Cells["devDrop"].Value == null ? "" : row.Cells["devDrop"].Value.ToString();
                type.DropType2 = row.Cells["devDrop2"].Value == null ? "" : row.Cells["devDrop2"].Value.ToString();
                type.MinValue  = row.Cells["devMin"].Value == null ? "" : row.Cells["devMin"].Value.ToString();
                type.MaxValue  = row.Cells["devMax"].Value == null ? "" : row.Cells["devMax"].Value.ToString();
                if (type.Name == "" && type.DropType == "")
                {
                    continue;
                }
                list.Add(type);
            }
            string fileName = XmlUnits.saveType(list);

            if (fileName.Length > 0)
            {
                MessageBox.Show("保存成功!");
                //this.DialogResult = DialogResult.Yes;
            }
        }
示例#2
0
 private void loadDataType()
 {
     this.dataGridView2.Rows.Clear();
     typeList = XmlUnits.getTypeData();
     foreach (TypeData item in typeList)
     {
         int rowIndex = this.dataGridView2.Rows.Add();
         this.dataGridView2.Rows[rowIndex].Cells[0].Value = item.Name;
     }
 }
示例#3
0
        private void loadData()
        {
            List <TypeData> data = XmlUnits.getTypeData();

            foreach (TypeData item in data)
            {
                int rowIndex = this.gvType.Rows.Add();
                this.gvType.Rows[rowIndex].Cells["devType"].Value  = item.Type;
                this.gvType.Rows[rowIndex].Cells["devName"].Value  = item.Name;
                this.gvType.Rows[rowIndex].Cells["devUnit1"].Value = item.Value1;
                this.gvType.Rows[rowIndex].Cells["devUnit2"].Value = item.Value2;
                this.gvType.Rows[rowIndex].Cells["devDrop"].Value  = item.DropType;
                this.gvType.Rows[rowIndex].Cells["devDrop2"].Value = item.DropType2;
                this.gvType.Rows[rowIndex].Cells["devMin"].Value   = item.MinValue;
                this.gvType.Rows[rowIndex].Cells["devMax"].Value   = item.MaxValue;
            }
            //this.gvType.DataSource = data;
        }
示例#4
0
        public yyzq()
        {
            InitializeComponent();


            this.Text = Lib.AppInfor.AssemblyTitle + "[V" + Lib.AppInfor.AssemblyVersion + "][" + Lib.AppInfor.AssemblyCopyright + "]";

            Control[] controls = DataReceiver.Controls.Find("rbtnHex", false);
            if (controls.Length > 0)
            {
                (controls[0] as RadioButton).Checked = true;
            }

            Control[] controls1 = dataReceive1.Controls.Find("rbtnHex", false);
            if (controls1.Length > 0)
            {
                (controls1[0] as RadioButton).Checked = true;
            }
            loadDataType();
            deviceList = XmlUnits.getDeviceData();
        }
示例#5
0
        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            TabPage tabPage = this.tabControl1.SelectedTab;
            //tabPage.Controls.Count;
            Control dataGrid = findDataReciver(tabPage);
            BindingList <Model.CMD> dataSource = null;
            Command command = null;

            if (dataGrid != null)
            {
                Object gridView = ((DataGridView)dataGrid).DataSource;
                dataSource = gridView as BindingList <Model.CMD>;
            }


            if (dataSource != null)
            {
                string fileName = XmlUnits.saveXml(dataSource, command, tabPage.Name);
                MessageBox.Show("保存成功");
            }
        }
示例#6
0
        private void loadFile_Click(object sender, EventArgs e)
        {
            TabPage tabPage = this.tabControl1.SelectedTab;
            //tabPage.Controls.Count;
            Control dataGrid = findDataReciver(tabPage);

            if (dataGrid != null)
            {
                DataGridView gv = (DataGridView)dataGrid;

                BindingList <CMD> list = XmlUnits.getXmlData(tabPage.Name);
                if (list.Count == 0)
                {
                    MessageBox.Show("无数据!");
                    return;
                }
                gv.DataSource = list;
                for (int i = 0; i < gv.Rows.Count; i++)
                {
                    gv.Rows[i].Cells[4].Value = "发送";
                }
            }
        }