Esempio n. 1
0
        private void tsmi_SaveIOConfig_Click(object sender, EventArgs e)
        {
            this.tab_Main.SelectedTab = tab_IO;
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = "XML文件|*.xml";
            if (DialogResult.OK == sfd.ShowDialog())
            {
                Xml    xl      = new Xml(sfd.FileName);
                string section = "IO";
                foreach (Control ctl in splitContainer6.Panel1.Controls)
                {
                    if (ctl is TextBox)
                    {
                        xl.SetValue(section, ctl.Name, ctl.Text);
                    }
                }

                DataTable    dt     = GetDgvToTable(dgv_io);
                StringWriter writer = new StringWriter();
                dt.WriteXml(writer);
                xl.SetValue(section, "DataTable", writer.ToString());
            }
        }
Esempio n. 2
0
        private void tsmi_SaveControlConfig_Click(object sender, EventArgs e)
        {
            this.tab_Main.SelectedTab = tab_Control;
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = "XML文件|*.xml";
            if (DialogResult.OK == sfd.ShowDialog())
            {
                Xml    xl      = new Xml(sfd.FileName);
                string section = "Control";

                DataTable    dt     = GetDgvToTable(dgv_control);
                StringWriter writer = new StringWriter();
                dt.WriteXml(writer);
                xl.SetValue(section, "DataTable", writer.ToString());
            }
        }