public void PlotClick(object sender, RoutedEventArgs e) { // declare/instantiate variables E80Analysis analysis = new E80Analysis(); int plotPoints; // get user inputs try { plotPoints = int.Parse(PlotPoints.Text); analysis.Span = double.Parse(SpanLength.Text); analysis.IncrementInches = double.Parse(Increment.Text); analysis.ImpactFactor = double.Parse(ImpactFactor.Text); analysis.DistFactor = double.Parse(DistributionFactor.Text); analysis.GetTrainType(LoadType.SelectedIndex); } catch (Exception) { MessageBox.Show("Invalid input!"); return; } analysis.GetTrain(); Tuple <double[], double[]> vals = analysis.CalculateEnvelope(plotPoints); double[] maxMs = vals.Item1; double[] maxVs = vals.Item2; MPlot = MakePlot("Moments", maxMs, analysis.Span); VPlot = MakePlot("Shears", maxVs, analysis.Span); PlotWindow plots = new PlotWindow(); plots.Show(); }
public void ValClick(object sender, RoutedEventArgs e) { // declare/instantiate variables E80Analysis analysis = new E80Analysis(); int plotPoints; // get user inputs try { plotPoints = int.Parse(PlotPoints.Text); analysis.Span = double.Parse(SpanLength.Text); analysis.IncrementInches = double.Parse(Increment.Text); analysis.ImpactFactor = double.Parse(ImpactFactor.Text); analysis.DistFactor = double.Parse(DistributionFactor.Text); analysis.GetTrainType(LoadType.SelectedIndex); } catch (Exception) { MessageBox.Show("Invalid input!"); return; } analysis.GetTrain(); Tuple <double[], double[]> vals = analysis.CalculateEnvelope(plotPoints); double[] maxMs = vals.Item1; double[] maxVs = vals.Item2; TextResultsWindow results = new TextResultsWindow(); double[] locations = new double[plotPoints + 1]; for (int i = 0; i < plotPoints + 1; ++i) { locations[i] = analysis.Span / (plotPoints) * i; } results.Locations.Text = MakeList(locations); results.Moments.Text = MakeList(maxMs); results.Shears.Text = MakeList(maxVs); results.Show(); }