/// <summary> /// User has clicked the check button - display any errors found in soil. /// </summary> private void CheckButton_Click(object sender, EventArgs e) { OnSave(); bool inSimulation = false; OurComponent = Controller.ApsimData.Find(NodePath); ApsimFile.Component parent = OurComponent.Parent; while (parent != null && !inSimulation) { if (parent.Type.ToLower() == "simulation") { inSimulation = true; } parent = parent.Parent; } //string Msg = Soil.Check(Configuration.Instance.ApplicationName != "ApsimUI"); string Msg = Soil.Check(!inSimulation); if (Msg == "") { MessageBox.Show("No errors found", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(Msg, "Soil Errors", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void CheckSoil(object sender, EventArgs e) { Soil currentSoil = Apsim.Get(this.explorerPresenter.ApsimXFile, this.explorerPresenter.CurrentNodePath) as Soil; if (currentSoil != null) { string errorMessages = currentSoil.Check(false); if (errorMessages != string.Empty) { this.explorerPresenter.MainPresenter.ShowMessage(errorMessages, DataStore.ErrorLevel.Error); } } }
/// <summary> /// User has clicked the check button - display any errors found in soil. /// </summary> private void CheckButtonClick(object sender, EventArgs e) { OnSave(); string Msg = Soil.Check(Configuration.Instance.ApplicationName != "ApsimUI"); if (Msg == "") { MessageBox.Show("No errors found", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(Msg, "Soil Errors", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void CheckSoil(object sender, EventArgs e) { Soil currentSoil = Apsim.Get(this.explorerPresenter.ApsimXFile, this.explorerPresenter.CurrentNodePath) as Soil; if (currentSoil != null) { string errorMessages = currentSoil.Check(false); if (!string.IsNullOrEmpty(errorMessages)) { explorerPresenter.MainPresenter.ShowError(errorMessages); } else { explorerPresenter.MainPresenter.ShowMessage("Soil water parameters are valid.", Simulation.MessageType.Information); } } }
private static void CheckSoils(ApsimFile.Component Data, ref string ErrorMessage) { if (Data.Type.ToLower() == "soil") { Soil ThisSoil = Soil.Create(Data.FullXML()); string Errors = ThisSoil.Check(true); if (!string.IsNullOrEmpty(Errors)) { ErrorMessage += Environment.NewLine + Data.FullPath + Environment.NewLine + StringManip.IndentText(Errors, 6); } } else if (Data.Type.ToLower() == "folder") { foreach (ApsimFile.Component Child in Data.ChildNodes) { CheckSoils(Child, ref ErrorMessage); } } }
/// <summary>Check selected soils and show error messages.</summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnCheckSoilsClick(object sender, EventArgs e) { string labelText = string.Empty; using (ApsoilWeb.Service soilsDB = new Apsoil.ApsoilWeb.Service()) { foreach (ListItem item in ListBox.Items) { if (item.Selected) { string soilPath = item.Text; Soil soil = Soil.Create(soilsDB.SoilXML(soilPath)); string messages = soil.Check(true); if (messages != string.Empty) { labelText += soilPath + "\r\n"; labelText += messages + "\r\n"; } } } } label3.Text = labelText.Replace("\r\n", "<br/>"); }