Esempio n. 1
0
        private void LoadButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog configFileDialog = new OpenFileDialog {
                Filter = @"配置文件 |*.xml"
            };                                                    //定义新的文件打开位置控件

            if (configFileDialog.ShowDialog() == DialogResult.OK) //如果有选择打开的文件
            {
                InformationText.Clear();
                InformationText.AppendText("Read Configuration File:\n" + configFileDialog.FileName + "\n");


                if (XmlTool.GetInstance.Load(configFileDialog.FileName))
                {
                    InformationText.Text = XmlTool.GetInstance.Error;
                    LoadButton.BackColor = Color.Red;
                    return;
                }
                //FormRequest.FarField.Clear();

                InformationText.Text = @"Load Configuration Successfully!";
                LoadButton.BackColor = Color.MistyRose;

                HxjLocation.Text = configFileDialog.FileName;
            }
        }
Esempio n. 2
0
        private void TestButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog configFileDialog = new OpenFileDialog {
                Filter = @"配置文件 |*.json"
            };                                                    //定义新的文件打开位置控件

            if (configFileDialog.ShowDialog() == DialogResult.OK) //如果有选择打开的文件
            {
                InformationText.Clear();
                InformationText.AppendText("Load json File:\n" + configFileDialog.FileName + "\n");
                ConfigurationFullName = configFileDialog.FileName;
                RunButton.Enabled     = true;
                PostButton.Enabled    = true;
                InformationText.Text  = @"Load json Successfully!";
                LoadButton.BackColor  = Color.MistyRose;
            }
            //if (File.Exists(ConfigurationFullName))
            //    Process.Start("D:/Program Files/Softwares/UltraEdit/uedit64.exe", ConfigurationFullName);
            //else InformationText.Text = @"Not exist file:\n" + ConfigurationFullName;
        }
Esempio n. 3
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            SaveFileDialog configSaveFileDialog = new SaveFileDialog {
                Filter = @"配置文件 |*.xml"
            };                                                        //定义文件保存位置

            if (configSaveFileDialog.ShowDialog() == DialogResult.OK) //如果有保存路径
            {
                SaveButton.Enabled    = false;
                ConfigurationFullName = configSaveFileDialog.FileName;

                FormFile.Project.ChildNodes[0].InnerText = Path.GetFileNameWithoutExtension(configSaveFileDialog.FileName);
                FormFile.Project.ChildNodes[1].InnerText = Path.GetDirectoryName(configSaveFileDialog.FileName);
                FormFile.Project.ChildNodes[2].InnerText =
                    FormFile.Project.ChildNodes[1].InnerText + '\\' + FormFile.Project.FirstChild.InnerText + ".out";
                XmlTool.GetInstance.Root.Attributes["Date"].InnerText = DateTime.Now.ToString("s");

                XmlTool.GetInstance.Doc.Save(configSaveFileDialog.FileName);

                InformationText.Text = @"Configuration is written Successfully:";
                InformationText.AppendText("\n" + configSaveFileDialog.FileName);
#if DEBUG
                CoreFullname = @"E:\ZMC\Code\C_program\MUL\x64\Release\Core.exe ";
                string command = CoreFullname + ConfigurationFullName;
                BatDir = @"E:\ZMC\Code\C_program\MUL\x64\Release\Run.bat";
                Generate_BatFile(command);
                RunButton.Enabled = true;
#else
                RunButton.Enabled = File.Exists(CoreFullname);
                if (!RunButton.Enabled)
                {
                    InformationText.AppendText("\n\nError:The C++ tools Core.exe can't be found!\n");
                }
#endif
                if (FileButton.BackColor == Color.Green && BFButton.BackColor == Color.Green &&
                    FRButton.BackColor == Color.Green && RequestButton.BackColor == Color.Green)
                {
                    PostButton.Enabled = true;
                }
            }
        }