Esempio n. 1
0
        private void buttonLoadFromXML_Click(object sender, EventArgs e)
        {
            //初步判断路径是否合法:
            string filePath = this.textBoxCreatingMethods.Text;

            if (filePath != "")
            {
                filePath = filePath.Replace("\\", "\\\\");//路径显示与String表达不一样,需要加两个“\\”
            }
            else//filePath
            {
                //路径为空就不需要执行后续步骤了!
                MessageBox.Show("文档路径不正确或无法读取!请双击【语法规则】输入框后重新选择文件!", "提醒",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Regex reg = new Regex(filePath);
            //Regex reg = new Regex("F:\\\\C#Projects\\\\BigDataCustomizationTool\\\\BigDataCustomizationTool\\\\bin\\Debug\\\\BigData.xml");
            Match matchStr = reg.Match("[a-z]|[A-Z]{1}(:\\).*?(.xml)");//基本符合文件路径+基本符合XML文档格式

            if (matchStr.Groups.Count != 1)
            {
                //需要判断是否文档路径,因为输入框是支持手动
                MessageBox.Show("文档路径不正确或无法读取!请双击【语法规则】输入框后重新选择文件!", "提醒",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                XmlDocumentLoadOrWriter.myMethodsXmlFilesReader(filePath); //获得选择的文件路径

                InitializeValuesFromVariable();
            }
        }
Esempio n. 2
0
        private void buttonSaveSettings_Click(object sender, EventArgs e)
        {
            initLocalVariables();//有可能用户过程中变更过设定值,因此再次初始化。

            XmlDocumentLoadOrWriter.myMethodsXmlFilesWriter();

            MessageBox.Show("保存完毕!", "温馨提示",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
        }