private async void UpdateGuiControls() { if (IsGuiReady) { txtR_CumulativeGrowthFactor.Text = CalcHelper.GetR().ToString(); if (CalcHelper.Settings.TrafficMethod == TrafficMethod.TrafficMethod1) { txtHVperc.Text = CalcHelper.GetHVGrowthRate_r1().ToString("0.00"); txtAxleEquivalencyFactor.Text = CalcHelper.GetAECperHV().ToString("0.00"); } if (CalcHelper.GetHVGrowthRate_r1() > 100.0) // causes dialog is already open sometimes { var dlg = new CustomMessageBox("Total percentage of heavy vehicles is over 100%."); await DialogHost.Show(dlg); } else { txtThicknessGranular.Text = CalcHelper.GetThicknessGranuar().ToString(); txtThicknessBasecourse.Text = CalcHelper.GetThicknessBasecourse().ToString(); txtThicknessGranularRounded.Text = CalcHelper.GetThicknessGranuarRounded().ToString(); txtThicknessBasecourseRounded.Text = CalcHelper.GetThicknessBasecourseRounded().ToString(); } } }
public void WriteCsv(string fp) { StringBuilder sb = new StringBuilder(); sb.AppendLine($"Pavement design life,P, {P_PavementDesignLife}"); sb.AppendLine($"Subgrade CBR,CBR, {CBR_Subgrade}"); sb.AppendLine($"Traffic method used, {TrafficMethod.GetDescription()}"); sb.AppendLine($"Initial number of vehicles daily in one direction (1-way AADT),n, {n_AADT}"); if (Q_PavementDesignLifeFor_r1 <= P_PavementDesignLife) { sb.AppendLine($"Annual heavy vehicle growth rate (%),r, {r1_HVGrowthRate}"); } else { sb.AppendLine($"Annual heavy vehicle growth rate (%),r1, {r1_HVGrowthRate}"); sb.AppendLine($"First period (years),Q, {Q_PavementDesignLifeFor_r1}"); sb.AppendLine($"Annual heavy vehicle growth rate (%),r2, {r1_HVGrowthRate}"); sb.AppendLine($"Remaining period (years),P-Q, {P_PavementDesignLife - Q_PavementDesignLifeFor_r1}"); } sb.AppendLine($"Percentage of heavy vehicles using design lane (%),, {d_LaneDistributionFactor}"); if (TrafficMethod == TrafficMethod.TrafficMethod2) { sb.AppendLine($"Percentage of heavy vehicles (%),c, {c_HVPerc}"); sb.AppendLine($"Axle Equivalency Factor,F, {F_AxleEquivalencyFactor}"); } else { sb.AppendLine($"Percentage of heavy vehicles and axle equivalency factor by vehicle class"); for (int i = 0; i < 10; i++) { sb.AppendLine($"Class {i + 3}, c{i + 3},{TrafficData[i, 0]}, F{i + 3}, {TrafficData[i, 1]}"); } sb.AppendLine($"Percentage of heavy vehicles (%),c, {c_HVPerc}"); sb.AppendLine($"Axle Equivalency Factor,ESA/HV, {F_AxleEquivalencyFactor}"); } sb.AppendLine($"Cumulative growth factor,R, {R_CumulativeGrowthFactor}"); sb.AppendLine($"Calculated design traffic (ESA),ESA, {ESA_DesignTraffic}"); sb.AppendLine($"Minimum thickness of all granular material (mm),t_granular, {CalcHelper.GetThicknessGranuarRounded()}"); sb.AppendLine($"Minimum thickness of basecourse material (mm),t_basecourse, {CalcHelper.GetThicknessBasecourseRounded()}"); File.WriteAllText(fp, sb.ToString(), Encoding.UTF8); }