コード例 #1
0
        private void save_btn_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog=new SaveFileDialog();
            saveFileDialog.Filter = "xml files (*.xml)|*.xml*";
            saveFileDialog.FilterIndex=2;
            saveFileDialog.RestoreDirectory=true;
            string fName = "";

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                fName = saveFileDialog.FileName;
            }
            else
            {
                return;
            }
            XmlDocument myXmlDoc = new XmlDocument();

            OperateXML operateXML = new OperateXML(fName, myXmlDoc, this);
            operateXML.GenerateXMLFile();
        }
コード例 #2
0
        private void load_btn_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();
            fileDialog.Title = "选择文件";
            fileDialog.Filter = "xml files (*.xml)|*.xml";
            fileDialog.FilterIndex = 1;
            fileDialog.RestoreDirectory = true;
            String fileName = "";

            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                fileName = fileDialog.FileName;

            }
            else
            {
                return;
            }

            XmlDocument myXmlDoc = new XmlDocument();
            OperateXML operateXML = new OperateXML(fileName, myXmlDoc, this);

            paraName_tb = new TextBox();
            paraValue_tb = new TextBox();
            paraType_tb = new ComboBox();
            paraDataType_cb = new ComboBox();

            this.removeAllPara();

            operateXML.loadXmlFile();
        }