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; } }
private void ValidateButton_Click(object sender, EventArgs e) { RunButton.Enabled = false; InformationText.Clear(); if (!File.Exists(FormFile.MeshCard.FirstChild.InnerText)) { InformationText.Text = @"Mesh File is not exist!"; FileButton.BackColor = Color.Red; return; } if (FormMethod.MethodCard.FirstChild.InnerText != "1") { FormSolution.SolutionMod.FirstChild.ChildNodes[4].InnerText = "0"; } //BFButton.BackColor = int.Parse(FormBasicFunction.OSCard.FirstChild.InnerText) > -1 && // File.Exists(FormBasicFunction.OSCard.LastChild.InnerText) ? // Color.Green : Color.Yellow; if (XmlTool.GetInstance.Validate()) { InformationText.Text = XmlTool.GetInstance.Error; SaveButton.Enabled = false; ValidateButton.BackColor = Color.Red; } else { InformationText.Text = @"Configuration File is Corrected!"; SaveButton.Enabled = true; ValidateButton.BackColor = Color.MistyRose; } }
private void BFButton_Click(object sender, EventArgs e) { Form bf = new FormBasicFunction(); bf.ShowDialog(); InformationText.Clear(); InformationText.Text = @"Click BasicFunction"; BFButton.BackColor = Color.MistyRose; }
private void RequestButton_Click(object sender, EventArgs e) { Form re = new FormRequest(); re.ShowDialog(); InformationText.Clear(); InformationText.Text = @"Click Request"; RequestButton.BackColor = Color.MistyRose; }
private void SolutionButton_Click(object sender, EventArgs e) { Form sol = new FormSolution(); sol.ShowDialog(); InformationText.Clear(); InformationText.Text = @"Click Solution"; SolutionButton.BackColor = Color.MistyRose; }
private void ExcitationButton_Click(object sender, EventArgs e) { Form excitation = new FormExcitation(); excitation.ShowDialog(); InformationText.Clear(); InformationText.Text = @"Click Excitation"; ExcitationButton.BackColor = Color.MistyRose; }
private void FRButton_Click(object sender, EventArgs e) { Form fre = new FormFrequency(); fre.ShowDialog(); InformationText.Clear(); InformationText.Text = @"Click Parameter"; FRButton.BackColor = Color.MistyRose; }
private void ImpedanceButton_Click(object sender, EventArgs e) { Form imp = new FormMethod(); imp.ShowDialog(); InformationText.Clear(); InformationText.Text = @"Click Impedance"; ImpedanceButton.BackColor = Color.MistyRose; }
private void ScanMessage() { if (!_isEnabled) { InformationText.Show("Scan a QRCode."); } else { InformationText.Show(); } }
//Item API private void Mesh_Click(object sender, EventArgs e) { Form mesh = new FormFile(); mesh.ShowDialog(); InformationText.Clear(); InformationText.Text = @"Click Mesh"; FileButton.BackColor = Color.MistyRose; FormBasicFunction.OSCard.FirstChild.InnerText = "-1"; BFButton.BackColor = Color.MistyRose; }
public void Export() { if (_isDoingImportExport) { return; } _isDoingImportExport = true; bool success = TryExport(); if (!success) { InformationText.Show("Export failed. Contact an admin."); } _isDoingImportExport = false; }
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; }
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; } } }
void Start() { informationText = FindObjectOfType <InformationText>(); }
protected virtual void ActionWhenImportFail() { InformationText.Show("Missing data. Contact an admin."); }