protected virtual void OnInfiltrationMethodChanged(InfiltrationMethodChangeEventArgs e) { EventHandler <InfiltrationMethodChangeEventArgs> handler = InfiltrationMethodChanged; if (handler != null) { handler(this, e); } }
private void RaiseInfilEvent(string aInfilRate, string aInfilDepth, string aInfilDrainTime) { InfiltrationMethodChangeEventArgs args = new InfiltrationMethodChangeEventArgs(); if (rdoInfilMethodMaryland.Checked) { args.InfilMethod = Infiltration_Calc.INFILCALCMETHODS.MARYLANDLOOKUP; } else if (rdoInfilMethodGAmp.Checked) { args.InfilMethod = Infiltration_Calc.INFILCALCMETHODS.GREENAMPT; } //Java "%.5f" -> 5 digits after decimal point if (string.IsNullOrEmpty(aInfilRate)) { args.ResultInfiltrationRate = String.Format("{0:0.00000}", (object)Infiltration_Calc.ResultInfiltrationRate); } else { args.ResultInfiltrationRate = aInfilRate; } if (string.IsNullOrEmpty(aInfilDepth)) { args.ResultInfiltrationDepth = String.Format("{0:0.00000}", Infiltration_Calc.ResultInfiltrationDepth); } else { args.ResultInfiltrationDepth = aInfilDepth; } if (string.IsNullOrEmpty(aInfilDrainTime)) { args.ResultInfiltrationDrainTime = String.Format("{0:0.00000}", Infiltration_Calc.ResultInfiltrationDrainTime); } else { args.ResultInfiltrationDrainTime = aInfilDrainTime; } OnInfiltrationMethodChanged(args); }
private void InfilMethodChanged(object sender, EventArgs e) { if (!pLoaded) { return; } if (rdoInfilMethodGAmp.Checked) { frameGAmp.Enabled = true; InfiltrationMethodChangeEventArgs args = new InfiltrationMethodChangeEventArgs(); args.InfilMethod = Infiltration_Calc.INFILCALCMETHODS.GREENAMPT; //Java "%.5f" -> 5 digits after decimal point args.ResultInfiltrationRate = String.Format("{0:0.00000}", Infiltration_Calc.ResultInfiltrationRate); args.ResultInfiltrationDepth = String.Format("{0:0.00000}", Infiltration_Calc.ResultInfiltrationDepth); args.ResultInfiltrationDrainTime = String.Format("{0:0.00000}", Infiltration_Calc.ResultInfiltrationDrainTime); OnInfiltrationMethodChanged(args); } else if (rdoInfilMethodMaryland.Checked) { frameGAmp.Enabled = false; cboSoilMenu_SelectedIndexChanged(null, null); } }
private void cboSoilMenu_SelectedIndexChanged(object sender, EventArgs e) { if (cboSoilMenu.SelectedItem == null) { System.Windows.Forms.MessageBox.Show("Must select a soil type first", "Infiltration Calculator"); return; } if (Calculator == null) { Calculator = new Infiltration_Calc(); } string lSoilName = cboSoilMenu.SelectedItem.ToString(); Dictionary <string, string> soilprop = Calculator.MDMethod(lSoilName); string lVal = ""; bool lValIsOK; foreach (string lKey in soilprop.Keys) { lValIsOK = false; if (soilprop.TryGetValue(lKey, out lVal)) { lValIsOK = true; } if (lKey.StartsWith("Porosity")) { if (lValIsOK) { txtGAmpPorosity.Text = lVal; } } else if (lKey.StartsWith("Effective Porosity")) { if (lValIsOK) { txtGAmpEffPorosity.Text = lVal; } } else if (lKey.StartsWith("Suction Head")) { if (lValIsOK) { txtGAmpSuction.Text = lVal; } } else if (lKey.StartsWith("Pore Size Distribution")) { } else if (lKey.StartsWith("Residual Water Content")) { if (lValIsOK) { txtGAmpResWater.Text = lVal; } } else if (lKey.StartsWith("Hydraulic Head")) { } else if (lKey.StartsWith("Hydraulic Conductivity")) { if (lValIsOK) { txtGAmpSatHydCond.Text = lVal; } } else if (lKey.StartsWith("Typical Water Capacity")) { } else if (lKey.StartsWith("Typical Infilteration Rate")) { if (rdoInfilMethodMaryland.Checked) { Infiltration_Calc.ResultInfiltrationRate = double.Parse(lVal); } } else if (lKey.StartsWith("Hydrologic Soil Group")) { } } if (rdoInfilMethodMaryland.Checked) { InfiltrationMethodChangeEventArgs args = new InfiltrationMethodChangeEventArgs(); args.InfilMethod = Infiltration_Calc.INFILCALCMETHODS.MARYLANDLOOKUP; args.ResultInfiltrationRate = Infiltration_Calc.ResultInfiltrationRate.ToString(); args.ResultInfiltrationDepth = ""; args.ResultInfiltrationDrainTime = ""; OnInfiltrationMethodChanged(args); } }