コード例 #1
0
 /// <summary>
 /// Do following when TboxLoadConcentratedMoment focus changes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TboxLoadConcentratedMoment_LostFocus(object sender, RoutedEventArgs e)
 {
     _ = sender;     // Discard unused parameter.
     _ = e;          // Discard unused parameter.
     //Debug.WriteLine($"TboxLoadConcentratedMoment_LostFocus(): Event fired!");
     boolEnteredLoadConcentratedMoment = false;
     if (TboxLoadConcentratedMoment.Text.Length > 0)
     {
         doubleLoadConcentratedMoment = LibNum.TextBoxGetDouble(TboxLoadConcentratedMoment, EnumTextBoxUpdate.Yes);   // Get the input from the TextBox and convert to matching numeric.
         if (doubleLoadConcentratedMoment >= -doubleLoadConcentratedValueMax && doubleLoadConcentratedMoment <= doubleLoadConcentratedValueMax)
         {
             boolEnteredLoadConcentratedMoment = true;
             LibMPC.OutputMsgSuccess(TblkLoadConcentratedLostFocus, $"{CommonItems.stringConstMoment} valid.");
         }
         else
         {
             LibMPC.OutputMsgError(TblkLoadConcentratedLostFocus, $"{CommonItems.stringConstMoment} not valid since not in range of +/- {doubleLoadConcentratedValueMax:G}.");
         }
     }
     else
     {
         LibMPC.OutputMsgError(TblkLoadConcentratedLostFocus, $"{CommonItems.stringConstMoment} not valid since no value entered.");
     }
     CheckLoadConcentratedInputValues();
 }
コード例 #2
0
 /// <summary>
 /// Do following when TboxSupportPosition focus changes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TboxSupportPosition_LostFocus(object sender, RoutedEventArgs e)
 {
     _ = sender;     // Discard unused parameter.
     _ = e;          // Discard unused parameter.
     //Debug.WriteLine($"TboxSupportPosition_LostFocus(): Event fired.");
     boolEnteredSupportPosition = false;
     if (TboxSupportPosition.Text.Length > 0)
     {
         doubleSupportPosition = LibNum.TextBoxGetDouble(TboxSupportPosition, EnumTextBoxUpdate.Yes); // Get the input from the TextBox and convert to matching numeric.
         if (doubleSupportPosition >= 0d && doubleSupportPosition <= CommonItems.doubleBeamLength)    // Verify support is on beam.
         {
             boolEnteredSupportPosition = true;
             LibMPC.OutputMsgSuccess(TblkSupportLostFocus, "Valid support position entered.");
         }
         else
         {
             LibMPC.OutputMsgError(TblkSupportLostFocus, "Invalid support position entered.  Support must be on beam.");
         }
     }
     else
     {
         LibMPC.OutputMsgError(TblkSupportLostFocus, "Invalid support position since no value entered.");
     }
     CheckSupportInputValues();
 }
コード例 #3
0
 /// <summary>
 /// Do following when TboxLoadConcentratedPosition focus changes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TboxLoadConcentratedPosition_LostFocus(object sender, RoutedEventArgs e)
 {
     _ = sender;     // Discard unused parameter.
     _ = e;          // Discard unused parameter.
     //Debug.WriteLine($"TTboxLoadConcentratedPosition_LostFocus(): Event fired.");
     boolEnteredLoadConcentratedPosition = false;
     if (TboxLoadConcentratedPosition.Text.Length > 0)
     {
         doubleLoadConcentratedPosition = LibNum.TextBoxGetDouble(TboxLoadConcentratedPosition, EnumTextBoxUpdate.Yes); // Get the input from the TextBox and convert to matching numeric.
         if (doubleLoadConcentratedPosition >= 0d && doubleLoadConcentratedPosition <= CommonItems.doubleBeamLength)    // Verify concentrated load is on beam.
         {
             boolEnteredLoadConcentratedPosition = true;
             LibMPC.OutputMsgSuccess(TblkLoadConcentratedLostFocus, $"{CommonItems.stringConstPosition} valid.");
         }
         else
         {
             LibMPC.OutputMsgError(TblkLoadConcentratedLostFocus, $"{CommonItems.stringConstPosition} not valid since not on beam.");
         }
     }
     else
     {
         LibMPC.OutputMsgError(TblkLoadConcentratedLostFocus, $"{CommonItems.stringConstPosition} not valid since no value entered.");
     }
     CheckLoadConcentratedInputValues();
 }
コード例 #4
0
 /// <summary>
 /// Do following when TboxLoadConcentratedForce focus changes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TboxLoadConcentratedForce_LostFocus(object sender, RoutedEventArgs e)
 {
     _ = sender;     // Discard unused parameter.
     _ = e;          // Discard unused parameter.
     //Debug.WriteLine($"TboxLoadConcentratedForce_LostFocus(): Event fired.");
     boolEnteredLoadConcentratedForce = false;
     if (TboxLoadConcentratedForce.Text.Length > 0)
     {
         doubleLoadConcentratedForce = LibNum.TextBoxGetDouble(TboxLoadConcentratedForce, EnumTextBoxUpdate.Yes);           // Get the input from the TextBox and convert to matching numeric.
         // Limit maximum force to resonable value. Value can be positive or negative.
         if (doubleLoadConcentratedForce >= -doubleLoadConcentratedValueMax && doubleLoadConcentratedForce <= doubleLoadConcentratedValueMax)
         {
             boolEnteredLoadConcentratedForce = true;
             LibMPC.OutputMsgSuccess(TblkLoadConcentratedLostFocus, $"{CommonItems.stringConstForce} valid.");
         }
         else
         {
             LibMPC.OutputMsgError(TblkLoadConcentratedLostFocus, $"{CommonItems.stringConstForce} not valid since not in range of +/- {doubleLoadConcentratedValueMax:G}.");
         }
     }
     else
     {
         LibMPC.OutputMsgError(TblkLoadConcentratedLostFocus, $"{CommonItems.stringConstForce} not valid since no value entered.");
     }
     CheckLoadConcentratedInputValues();
 }
コード例 #5
0
 /// <summary>
 /// Do following when TboxLoadUniformForceRight focus changes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TboxLoadUniformForceRight_LostFocus(object sender, RoutedEventArgs e)
 {
     _ = sender;     // Discard unused parameter.
     _ = e;          // Discard unused parameter.
     //Debug.WriteLine($"TboxLoadUniformForceRight_LostFocus(): Event fired.");
     boolEnteredLoadUniformForceRight = false;
     if (TboxLoadUniformForceRight.Text.Length > 0)
     {
         doubleLoadUniformForceRight = LibNum.TextBoxGetDouble(TboxLoadUniformForceRight, EnumTextBoxUpdate.Yes);           // Get the input from the TextBox and convert to matching numeric.
         // Limit maximum force to resonable value. Value can be positive or negative.
         if (doubleLoadUniformForceRight >= -doubleLoadUniformForceMaximum && doubleLoadUniformForceRight <= doubleLoadUniformForceMaximum)
         {
             // Skip error messages if right value not entered.
             if (TboxLoadUniformForceRight.Text.Length == 0 || CheckSignSameDouble(doubleLoadUniformForceLeft, doubleLoadUniformForceRight))
             {
                 boolEnteredLoadUniformForceRight = true;
                 LibMPC.OutputMsgSuccess(TblkLoadUniformLostFocus, $"{CommonItems.stringConstForceRight} valid.");
             }
             else
             {
                 LibMPC.OutputMsgError(TblkLoadUniformLostFocus, $"{CommonItems.stringConstForceRight} not valid since sign not same as {CommonItems.stringConstForceLeft}.");
             }
         }
         else
         {
             LibMPC.OutputMsgError(TblkLoadUniformLostFocus, $"{CommonItems.stringConstForceRight} not valid since not in range of +/- {doubleLoadUniformForceMaximum:G}.");
         }
     }
     else
     {
         LibMPC.OutputMsgError(TblkLoadUniformLostFocus, $"{CommonItems.stringConstForceRight} not valid since no value entered.");
     }
     CheckLoadUniformInputValues();
 }
コード例 #6
0
 /// <summary>
 /// Do following when TboxBeamPropertiesInertia focus changes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TboxBeamPropertiesInertia_LostFocus(object sender, RoutedEventArgs e)
 {
     _ = sender;                                                                                            // Discard unused parameter.
     _ = e;                                                                                                 // Discard unused parameter.
     //Debug.WriteLine($"TboxBeamPropertiesInertia_LostFocus(): Event fired.");
     CommonItems.doubleInertia = LibNum.TextBoxGetDouble(TboxBeamPropertiesInertia, EnumTextBoxUpdate.Yes); // Get the input from the TextBox and convert to matching numeric.
     if (CommonItems.doubleInertia >= doubleInertiaMinimum && CommonItems.doubleInertia <= doubleInertiaMaximum)
     {
         CommonItems.boolEnteredInertia = true;
         LibMPC.OutputMsgSuccess(TblkBeamPropertiesLostFocus, $"{CommonItems.stringConstInertia} valid.");
     }
     else
     {
         CommonItems.boolEnteredInertia = false;
         CommonItems.doubleInertia      = 0d;
         LibMPC.OutputMsgError(TblkBeamPropertiesLostFocus, $"{CommonItems.stringConstInertia} not valid.  Value must be in range of {doubleInertiaMinimum.ToString(LibNum.fpNumericFormatNone)} to {doubleInertiaMaximum.ToString(LibNum.fpNumericFormatNone)}.");
     }
     mainPage.applicationDataContainer.Values[CommonItems.ds_DoubleInertia] = CommonItems.doubleInertia;
     if (CommonItems.doubleInertia.Equals(0d))
     {
         TboxBeamPropertiesInertia.Text = string.Empty;
     }
     else
     {
         TboxBeamPropertiesInertia.Text = CommonItems.doubleInertia.ToString(LibNum.fpNumericFormatNone);
     }
     CheckBeamPropertyInputValues();
 }
コード例 #7
0
 /// <summary>
 /// Do following when TboxBeamPropertiesPoissonsRatio focus changes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TboxBeamPropertiesPoissonsRatio_LostFocus(object sender, RoutedEventArgs e)
 {
     _ = sender;                                                                                                        // Discard unused parameter.
     _ = e;                                                                                                             // Discard unused parameter.
     //Debug.WriteLine($"TboxBeamPropertiesPoissonsRatio_LostFocus(): Event fired.");
     CommonItems.doublePoissonsRatio = LibNum.TextBoxGetDouble(TboxBeamPropertiesPoissonsRatio, EnumTextBoxUpdate.Yes); // Get the input from the TextBox and convert to matching numeric.
     if (CommonItems.doublePoissonsRatio > 0d && CommonItems.doublePoissonsRatio < 1d)                                  // Poisson is a ratio so value must be between 0 and 1.
     {
         CommonItems.boolEnteredPoissonsRatio = true;
         LibMPC.OutputMsgSuccess(TblkBeamPropertiesLostFocus, $"{CommonItems.stringConstPoissonsRatio} valid.");
     }
     else
     {
         CommonItems.boolEnteredPoissonsRatio = false;
         CommonItems.doublePoissonsRatio      = 0d;
         LibMPC.OutputMsgError(TblkBeamPropertiesLostFocus, $"{CommonItems.stringConstPoissonsRatio} not valid.  Value must be between 0 and 1.");
     }
     mainPage.applicationDataContainer.Values[CommonItems.ds_DoublePoissonsRatio] = CommonItems.doublePoissonsRatio;
     if (CommonItems.doublePoissonsRatio.Equals(0d))
     {
         TboxBeamPropertiesPoissonsRatio.Text = string.Empty;
     }
     else
     {
         TboxBeamPropertiesPoissonsRatio.Text = CommonItems.doublePoissonsRatio.ToString(LibNum.fpNumericFormatNone);
     }
     CheckBeamPropertyInputValues();
 }
コード例 #8
0
        /// <summary>
        /// Do following when TboxBeamPropertiesLength focus changes.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TboxBeamPropertiesLength_LostFocus(object sender, RoutedEventArgs e)
        {
            _ = sender;     // Discard unused parameter.
            _ = e;          // Discard unused parameter.
            //Debug.WriteLine($"TboxBeamPropertiesLength_LostFocus(): Event fired.");
            // Save input to local beam length value, then check if valid, if valid then compare to global variable to check if value has changed.
            double doubleBeamLength = LibNum.TextBoxGetDouble(TboxBeamPropertiesLength, EnumTextBoxUpdate.Yes);   // Get the input from the TextBox and convert to matching numeric.

            if (doubleBeamLength >= doubleBeamLengthMinimum && doubleBeamLength <= doubleBeamLengthMaximum)
            {
                string stringSuccessMessage = $"{CommonItems.stringConstBeamLength} valid.";     // Default success string.
                CommonItems.boolEnteredBeamLength = true;
                if (!doubleBeamLength.Equals(CommonItems.doubleBeamLength))
                {
                    // Beam length changed.
                    CommonItems.doubleBeamLength = doubleBeamLength;
                    if (CommonItems.ClearLoadsConcentrated() || CommonItems.ClearLoadsUniform())
                    {
                        // Loads cannot be entered unless supports entered, so also clear supports.
                        CommonItems.ClearSupports();
                        stringSuccessMessage = $"{CommonItems.stringConstBeamLength} valid but has changed so cleared existing supports and loads.";
                    }
                    else if (CommonItems.ClearSupports())
                    {
                        stringSuccessMessage = $"{CommonItems.stringConstBeamLength} valid but has changed so cleared existing supports.";
                    }
                }
                LibMPC.OutputMsgSuccess(TblkBeamPropertiesLostFocus, stringSuccessMessage);
            }
            else
            {
                CommonItems.boolEnteredBeamLength = false;
                CommonItems.doubleBeamLength      = 0d;
                LibMPC.OutputMsgError(TblkBeamPropertiesLostFocus, $"{CommonItems.stringConstBeamLength} not valid.  Value must be in range of {doubleBeamLengthMinimum.ToString(LibNum.fpNumericFormatNone)} to {doubleBeamLengthMaximum.ToString(LibNum.fpNumericFormatNone)}.");
            }
            mainPage.applicationDataContainer.Values[CommonItems.ds_DoubleBeamLength] = CommonItems.doubleBeamLength;
            if (CommonItems.doubleBeamLength.Equals(0d))
            {
                TboxBeamPropertiesLength.Text = string.Empty;
            }
            else
            {
                TboxBeamPropertiesLength.Text = CommonItems.doubleBeamLength.ToString(LibNum.fpNumericFormatNone);
            }
            CheckBeamPropertyInputValues();
        }
コード例 #9
0
 /// <summary>
 /// Do following when TboxLoadUniformPositionRight focus changes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TboxLoadUniformPositionRight_LostFocus(object sender, RoutedEventArgs e)
 {
     _ = sender;     // Discard unused parameter.
     _ = e;          // Discard unused parameter.
     //Debug.WriteLine($"TboxLoadUniformPositionRight_LostFocus(): Event fired.");
     boolEnteredLoadUniformPositionRight = false;
     if (TboxLoadUniformPositionRight.Text.Length > 0)
     {
         doubleLoadUniformPositionRight = LibNum.TextBoxGetDouble(TboxLoadUniformPositionRight, EnumTextBoxUpdate.Yes); // Get the input from the TextBox and convert to matching numeric.
         if (doubleLoadUniformPositionRight >= 0d && doubleLoadUniformPositionRight <= CommonItems.doubleBeamLength)    // Verify uniform load is on beam.
         {
             //Debug.WriteLine($"TboxLoadUniformPositionRight_LostFocus(): doubleLoadUniformPositionLeft={doubleLoadUniformPositionLeft}, TboxLoadUniformPositionLeft.Text.Length={TboxLoadUniformPositionLeft.Text.Length}");
             // Skip error messages if left value not entered.
             if (TboxLoadUniformPositionLeft.Text.Length == 0 || doubleLoadUniformPositionLeft < doubleLoadUniformPositionRight)
             {
                 // Require uniform load length to be at least 1 length unit.
                 if (TboxLoadUniformPositionLeft.Text.Length == 0 || (doubleLoadUniformPositionRight - doubleLoadUniformPositionLeft) >= 1d)
                 {
                     boolEnteredLoadUniformPositionRight = true;
                     LibMPC.OutputMsgSuccess(TblkLoadUniformLostFocus, $"{CommonItems.stringConstPositionRight} valid.");
                 }
                 else
                 {
                     LibMPC.OutputMsgError(TblkLoadUniformLostFocus, $"{CommonItems.stringConstPositionRight} not valid since uniform load length must be greater than or equal to 1.0.  Model load as a concentrated load.");
                 }
             }
             else
             {
                 LibMPC.OutputMsgError(TblkLoadUniformLostFocus, $"{CommonItems.stringConstPositionRight} not valid since must be greater than {CommonItems.stringConstPositionLeft} value.");
             }
         }
         else
         {
             LibMPC.OutputMsgError(TblkLoadUniformLostFocus, $"{CommonItems.stringConstPositionRight} not valid since not on beam.");
         }
     }
     else
     {
         LibMPC.OutputMsgError(TblkLoadUniformLostFocus, $"{CommonItems.stringConstPositionRight} not valid since no value entered.");
     }
     CheckLoadUniformInputValues();
 }