Example #1
0
 private void SlopeTextBox_TextChanged(object sender, EventArgs e)
 {
     if (TextValidation(SlopeTextBox.Text) == false)
     {
         SlopeTextBox.Text = "";
         return;
     }
     //Automatically calculates the roof slope, based on text entered in the slope textbox (based on 1'-0" base)
     if (SlopeTextBox.Text == "")
     {
         OverWriteAngleTextBox.Text = "";
         return;
     }
     try
     {
         var radians = TrigFunctions.BaseRiseToRadian(12, Convert.ToDecimal(SlopeTextBox.Text));
         var angle   = Conversions.RadiansToAngle(radians);
         OverWriteAngleTextBox.Text = Convert.ToString(angle);
     }
     catch (FormatException fe)
     {
         SlopeTextBox.Text = "";
         MessageBox.Show(fe.Message.ToString() + Environment.NewLine + "Please include a 0 before any number smaller than 1. (i.e. 0.5 instead of .5)");
         return;
     }
 }
Example #2
0
        private void BaseRiseToAngle()
        {
            decimal angle = TrigFunctions.BaseRiseToRadian(Convert.ToDecimal(BaseTextBox.Text), Convert.ToDecimal(RiseTextBox.Text));

            angle = Conversions.RadiansToAngle(angle);
            OverWriteAngleTextBox.Text = Convert.ToString(angle);
            OverwriteAngles(_Settings.ActiveAngle, Convert.ToDecimal(OverWriteAngleTextBox.Text));
        }
Example #3
0
 private void BaseRiseCalc(decimal bayse, decimal rise)
 {
     if (_Settings.IsDetailingMathMethod == true)
     {
         bayse = Conversions.FootToDecimalFoot(Convert.ToDecimal(bayse));
         rise  = Conversions.FootToDecimalFoot(Convert.ToDecimal(rise));
     }
     try
     {
         var radians = TrigFunctions.BaseRiseToRadian(bayse, rise);
         var angle   = Conversions.RadiansToAngle(radians);
         OverWriteAngleTextBox.Text = Convert.ToString(angle);
     }
     catch (FormatException fe)
     {
         BaseTextBox.Text = "";
         MessageBox.Show(fe.Message.ToString() + Environment.NewLine + "Please include a 0 before any number smaller than 1. (i.e. 0.5 instead of .5)");
         return;
     }
 }
        /// <summary>
        /// Returns a number, taking into account the detailing method selected. Trig is used to determine what formula is used.
        /// </summary>
        /// <param name="num"></param>
        /// <param name="angle"></param>
        /// <param name="function"></param>
        /// <param name="isDetailingMathMethod"></param>
        /// <returns>Returns a number.</returns>
        public static decimal TrigFunctionButtonClick(decimal num, decimal angle, string function, bool isDetailingMathMethod)
        {
            num = (isDetailingMathMethod == true) ? Conversions.FootToDecimalFoot(num) : num;

            switch (function)
            {
            case "b2s":
                return((isDetailingMathMethod == true) ? Conversions.DecimalFootToFoot(TrigFunctions.BaseToSlope(num, angle)) : TrigFunctions.BaseToSlope(num, angle));

            case "b2r":
                return((isDetailingMathMethod == true) ? Conversions.DecimalFootToFoot(TrigFunctions.BaseToRise(num, angle)) : TrigFunctions.BaseToRise(num, angle));

            case "s2b":
                return((isDetailingMathMethod == true) ? Conversions.DecimalFootToFoot(TrigFunctions.SlopeToBase(num, angle)) : TrigFunctions.SlopeToBase(num, angle));

            case "s2r":
                return((isDetailingMathMethod == true) ? Conversions.DecimalFootToFoot(TrigFunctions.SlopeToRise(num, angle)) : TrigFunctions.SlopeToRise(num, angle));

            case "r2b":
                return((isDetailingMathMethod == true) ? Conversions.DecimalFootToFoot(TrigFunctions.RiseToBase(num, angle)) : TrigFunctions.RiseToBase(num, angle));

            case "r2s":
                return((isDetailingMathMethod == true) ? Conversions.DecimalFootToFoot(TrigFunctions.RiseToSlope(num, angle)) : TrigFunctions.RiseToSlope(num, angle));

            default:
                return(0);
            }
        }