Ejemplo n.º 1
0
        private async void btnAxleEquivalencyFactor_Click(object sender, RoutedEventArgs e)
        {
            if (CalcHelper.Settings.TrafficMethod == TrafficMethod.TrafficMethod2)
            {
                var dlg = new AxleEquivalencyFactorSelector();
                await DialogHost.Show(dlg);

                txtAxleEquivalencyFactor.Text = CalcHelper.Settings.F_AxleEquivalencyFactor.ToString();
            }
            else
            {
                var dlg = new AxleEquivalencyFactorsSelector();
                await DialogHost.Show(dlg);

                txtF3.Text  = CalcHelper.GetFbyVehicleClass(3).ToString();
                txtF4.Text  = CalcHelper.GetFbyVehicleClass(4).ToString();
                txtF5.Text  = CalcHelper.GetFbyVehicleClass(5).ToString();
                txtF6.Text  = CalcHelper.GetFbyVehicleClass(6).ToString();
                txtF7.Text  = CalcHelper.GetFbyVehicleClass(7).ToString();
                txtF8.Text  = CalcHelper.GetFbyVehicleClass(8).ToString();
                txtF9.Text  = CalcHelper.GetFbyVehicleClass(9).ToString();
                txtF10.Text = CalcHelper.GetFbyVehicleClass(10).ToString();
                txtF11.Text = CalcHelper.GetFbyVehicleClass(11).ToString();
                txtF12.Text = CalcHelper.GetFbyVehicleClass(12).ToString();
            }
        }
Ejemplo n.º 2
0
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     if (CalcHelper.Settings.F_AxleEquivalencyFactor > 0 || CalcHelper.GetFbyVehicleClass(3) > 0)
     {
         btnOk.Command = DialogHost.CloseDialogCommand;
     }
 }
Ejemplo n.º 3
0
 private async void txtHVperc_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (await IsNumeric(txtHVperc))
     {
         CalcHelper.SetHVPerc(txtHVperc.Text);
     }
 }
Ejemplo n.º 4
0
 private async void txtAxleEquivalencyFactor_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (await IsNumeric(txtAxleEquivalencyFactor))
     {
         CalcHelper.SetAxleEquivalencyFactor(txtAxleEquivalencyFactor.Text);
     }
 }
Ejemplo n.º 5
0
        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();
                }
            }
        }
Ejemplo n.º 6
0
 private async void txtAADT_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (await IsNumeric(txtAADT))
     {
         CalcHelper.SetAADT(txtAADT.Text);
         UpdateGuiControls();
     }
 }
Ejemplo n.º 7
0
 private async void txtC12_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (await IsNumeric(txtC12))
     {
         CalcHelper.SetTrafficData(12, txtC12.Text, txtF12.Text);
         UpdateGuiControls();
     }
 }
Ejemplo n.º 8
0
 private async void txtLaneDistributionFactor_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (await IsNumeric(txtLaneDistributionFactor))
     {
         CalcHelper.SetLaneDistributionFactor(txtLaneDistributionFactor.Text);
         UpdateGuiControls();
     }
 }
Ejemplo n.º 9
0
 private async void txtHVGrowthRate_r2_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (await IsNumeric(txtHVGrowthRate_r2))
     {
         CalcHelper.SetHVGrowthRate_r2(txtHVGrowthRate_r2.Text);
         UpdateGuiControls();
     }
 }
Ejemplo n.º 10
0
 private void lvFactorsSpecific_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     lvFactorsGeneral.SelectedIndex = -1;
     if (lvFactorsSpecific.SelectedIndex > -1)
     {
         CalcHelper.SetAxleEquivalencyFactor(((AxleEquivalencyFactorData2)lvFactorsSpecific.SelectedItem).F);
     }
 }
Ejemplo n.º 11
0
 private void SetFbyVehicleClass(AxleEquivalencyFactorData1 data)
 {
     CalcHelper.SetFbyVehicleClass(3, data.F3);
     CalcHelper.SetFbyVehicleClass(4, data.F4);
     CalcHelper.SetFbyVehicleClass(5, data.F5);
     CalcHelper.SetFbyVehicleClass(6, data.F6);
     CalcHelper.SetFbyVehicleClass(7, data.F7);
     CalcHelper.SetFbyVehicleClass(8, data.F8);
     CalcHelper.SetFbyVehicleClass(9, data.F9);
     CalcHelper.SetFbyVehicleClass(10, data.F10);
     CalcHelper.SetFbyVehicleClass(11, data.F11);
     CalcHelper.SetFbyVehicleClass(12, data.F12);
 }
Ejemplo n.º 12
0
        private async void txtP_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (await IsNumeric(txtP_PavementDesignLife))
            {
                CalcHelper.SetPavementDesignLife(txtP_PavementDesignLife.Text);

                if (CalcHelper.Settings.P_PavementDesignLife > 0)
                {
                    spGrowthRate1.Visibility         = Visibility.Visible;
                    sliderQ_PavementDesignLife.Value = sliderQ_PavementDesignLife.Maximum = CalcHelper.Settings.P_PavementDesignLife;
                }

                UpdateGuiControls();
            }
        }
Ejemplo n.º 13
0
 private void txtESA_DesignTraffic_TextChanged(object sender, TextChangedEventArgs e)
 {
     CalcHelper.SetESA(txtESA_DesignTraffic.Text);
     UpdateGuiControls();
 }
Ejemplo n.º 14
0
 private void lvFactors_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     CalcHelper.SetLaneDistributionFactor(((LaneDistributionData)lvFactors.SelectedItem).DistributionFactor);
 }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
0
 private void btnCalcESA_Click(object sender, RoutedEventArgs e)
 {
     txtESA_DesignTraffic.Text = CalcHelper.GetESA().ToString("G3", CultureInfo.InvariantCulture);
     UpdateGuiControls();
 }
Ejemplo n.º 17
0
 private void sliderSubgradeCBR_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     CalcHelper.SetCbrSubgrade((uint)sliderSubgradeCBR.Value);
     UpdateGuiControls();
 }