private void btnCalculate_Click(object sender, EventArgs e) { if (groupBoxSysBowSpecs.Text == "Bow Specifications") { MessageBox.Show("Calculations done with no selected bow"); } Compare(); BowPhysics cPhysics = new BowPhysics(); double cIBOSpeed = Convert.ToDouble(txtUsrIBOSpeed.Text); double cDrawWeight = Convert.ToDouble(txtUsrDrawWeight.Text); double cDrawLength = Convert.ToDouble(txtUsrDrawLength.Text); double cArrowWeight = Convert.ToDouble(txtUsrArrowWeight.Text); double cStringWeight = Convert.ToDouble(txtUsrStringWeight.Text); double cVelocity = cPhysics.CalcBowSpeed(cIBOSpeed, cDrawWeight, cDrawLength, cArrowWeight, cStringWeight); double cKineticEnergy = cPhysics.CalcKE(cVelocity, cArrowWeight); txtCalcBowSpeed.Text = cVelocity.ToString(); txtCalcKE.Text = cKineticEnergy.ToString(); txtCalcMomentum.Text = cPhysics.CalcMom(cVelocity, cArrowWeight).ToString(); lblRecommendedGame.Text = cPhysics.CalcMaxGame(cKineticEnergy); lblArrowLength.Text = "A minimum arrow length of " + cPhysics.CalcMinArrowLength(cDrawLength).ToString() + "\""; lblArrowWeight.Text = "A minumum arrow weight of " + cPhysics.CalcMinArrowWeight(cDrawWeight).ToString() + "grains"; }
private void Calculate() { BowPhysics awBowPhysics = new BowPhysics(); double dHeight = 0; double dWeight = 0; if (btnConvert.Text == "Metric") { dHeight = Convert.ToDouble(txtUsrHeight.Text); dWeight = Convert.ToDouble(txtUsrWeight.Text); } else { dHeight = Convert.ToDouble(LengthConvertToMeters(txtUsrHeight.Text)); dWeight = Convert.ToDouble(WeightConvertToLBS(Convert.ToDouble(txtUsrWeight.Text))); } DateTime dtNow = Convert.ToDateTime(DateTime.Now); DateTime dtBorn = Convert.ToDateTime(dateTimePickerUsrAge.Value.ToString()); var dtAge = dtNow - dtBorn; lblAge.Text = getAge(dtAge.ToString()).ToString(); lblCalcDrawDistance.Text = awBowPhysics.GetRecommendedDrawDistance(dHeight).ToString(); lblCalcDrawWeight.Text = awBowPhysics.GetRecommendedBowWeight(dWeight, comboBoxUsrGender.Text, getAge(dtAge.ToString())); txtUsrDrawLength.Text = Convert.ToString(Math.Round(Convert.ToDouble(lblCalcDrawDistance.Text))); txtUsrDrawWeight.Text = lblCalcDrawWeight.Text.Substring(0, 2).ToString(); if (txtUsrName.Text == "") { txtUsrName.Text = "Unknown"; } }
private void Calculate() { BowPhysics awBowPhysics = new BowPhysics(); double dShaftLength = Convert.ToDouble(txtUsrShaftLength.Text); double dShaftGpI = Convert.ToDouble(txtUsrGpI.Text); double dTipWeight = Convert.ToDouble(comboBoxUsrTipWeight.Text); //usrTipWeightDropDown.Entry.Text); double dInsertWeight = GetComboBoxValue(comboBoxUsrInsert, "Inserts"); double dNockWeight = GetComboBoxValue(comboBoxUsrNock, "Nocks"); double dFletchWeight = GetComboBoxValue(comboBoxUsrFletches, "Fletches"); double dTotalFletchingWeight = dFletchWeight * 3; double dRearWeight = dNockWeight + dFletchWeight * 3; double dTotalTipWeight = dTipWeight + dInsertWeight; double dTotalShaftWeight = dShaftLength * dShaftGpI; double dTotalArrowWeight = dTotalShaftWeight + dTotalTipWeight + dRearWeight; string sFOC = awBowPhysics.CalcFOC(dNockWeight, dShaftLength, dTotalFletchingWeight, dShaftGpI, dTipWeight); lblSysRearWeight.Text = dRearWeight.ToString(); lblSysTipWeight.Text = dTotalTipWeight.ToString(); lblSysShaftWeight.Text = dTotalShaftWeight.ToString(); lblSysTotalWeight.Text = dTotalArrowWeight.ToString(); lblSysFOC.Text = sFOC + " %"; lblNote.Text = GetFOCRecommendation(sFOC); }