private void CopyValues()
 {
     try
     {
         //This is were DCSBiosOutput (subset of DCSBIOSControl) get populated from DCSBIOSControl
         if (string.IsNullOrEmpty(TextBoxTriggerValue.Text))
         {
             throw new Exception("Value cannot be empty");
         }
         if (ComboBoxComparisonCriteria.SelectedValue == null)
         {
             throw new Exception("Comparison criteria cannot be empty");
         }
         if (_dcsbiosControl == null)
         {
             _dcsbiosControl = DCSBIOSControlLocator.GetControl(TextBoxControlId.Text);
         }
         _dcsBiosOutput.Consume(_dcsbiosControl);
         if (!_showCriteria)
         {
             //Value isn't used anyways
             _dcsBiosOutput.DCSBiosOutputComparison = DCSBiosOutputComparison.Equals;
         }
         else
         {
             _dcsBiosOutput.DCSBiosOutputComparison = EnumEx.GetValueFromDescription <DCSBiosOutputComparison>(ComboBoxComparisonCriteria.SelectedValue.ToString());
         }
         try
         {
             if (_showCriteria)
             {
                 //Assume only Integer trigger values can be used. That is how it should be!!
                 try
                 {
                     var f = int.Parse(TextBoxTriggerValue.Text);
                 }
                 catch (Exception e)
                 {
                     throw new Exception("Error while checking Trigger value. Only integers are allowed : " + e.Message);
                 }
                 if (_dcsBiosOutput.DCSBiosOutputType == DCSBiosOutputType.INTEGER_TYPE)
                 {
                     _dcsBiosOutput.SpecifiedValueInt = (uint)Convert.ToInt32(TextBoxTriggerValue.Text);
                 }
                 else
                 {
                     throw new Exception("Error, DCSBIOSOutput can only have a Integer type output. This has String : " + _dcsBiosOutput.ControlId);
                 }
             }
         }
         catch (Exception e)
         {
             throw new Exception("Error while checking Value format : " + e.Message);
         }
     }
     catch (Exception e)
     {
         Common.ShowErrorMessageBox(e, "Error in CopyValues() : ");
     }
 }
Example #2
0
 private void CopyValues()
 {
     if (CheckBoxUseFormula.IsChecked.HasValue && CheckBoxUseFormula.IsChecked.Value)
     {
         //Use formula
         try
         {
             _dcsbiosOutputFormula = new DCSBIOSOutputFormula(TextBoxFormula.Text);
         }
         catch (Exception e)
         {
             throw new Exception("Error while creating formula object : " + e.Message);
         }
     }
     else
     {
         //Use single DCSBIOSOutput
         //This is were DCSBiosOutput (subset of DCSBIOSControl) get populated from DCSBIOSControl
         try
         {
             if (_dcsbiosControl == null && !string.IsNullOrWhiteSpace(TextBoxControlId.Text))
             {
                 _dcsbiosControl = DCSBIOSControlLocator.GetControl(TextBoxControlId.Text);
                 _dcsBiosOutput.Consume(_dcsbiosControl);
             }
         }
         catch (Exception e)
         {
             throw new Exception("Error while creating DCSBIOSOutput object : " + e.Message);
         }
     }
 }
 public DCSBiosInputWindow(string description, DCSBIOSInput dcsBiosInput)
 {
     InitializeComponent();
     _description     = description;
     _dcsBiosInput    = dcsBiosInput;
     _dcsbiosControl  = DCSBIOSControlLocator.GetControl(_dcsBiosInput.ControlId);
     _dcsbiosControls = DCSBIOSControlLocator.GetInputControls();
     PopulateComboBoxInterfaceType(_dcsBiosInput);
 }
Example #4
0
 public DCSBiosOutputFormulaWindow(DCSAirframe dcsAirframe, string description, DCSBIOSOutput dcsBiosOutput)
 {
     InitializeComponent();
     _dcsAirframe   = dcsAirframe;
     _description   = description;
     _dcsBiosOutput = dcsBiosOutput;
     DCSBIOSControlLocator.LoadControls();
     _dcsbiosControl  = DCSBIOSControlLocator.GetControl(_dcsBiosOutput.ControlId);
     _dcsbiosControls = DCSBIOSControlLocator.GetIntegerOutputControls();
 }
 public DCSBiosOutputTriggerWindow(string description, DCSBIOSOutput dcsBiosOutput, bool showCriteria = true)
 {
     InitializeComponent();
     _showCriteria  = showCriteria;
     _description   = description;
     _dcsBiosOutput = dcsBiosOutput;
     DCSBIOSControlLocator.LoadControls();
     _dcsbiosControl  = DCSBIOSControlLocator.GetControl(_dcsBiosOutput.ControlId);
     _dcsbiosControls = DCSBIOSControlLocator.GetIntegerOutputControls();
 }
 public DCSBiosOutputWindow(string description, DCSBIOSOutput dcsBiosOutput, bool userEditsDescription = false)
 {
     InitializeComponent();
     _description          = description;
     _userEditsDescription = userEditsDescription;
     _dcsBiosOutput        = dcsBiosOutput;
     DCSBIOSControlLocator.LoadControls();
     _dcsbiosControl  = DCSBIOSControlLocator.GetControl(_dcsBiosOutput.ControlId);
     _dcsbiosControls = DCSBIOSControlLocator.GetIntegerOutputControls();
 }
 public DCSBiosOutputFormulaWindow(string description, DCSBIOSOutput dcsBiosOutput, bool limitDecimals, int decimalPlaces, bool userEditsDescription = false, bool showDecimalSetting = false)
 {
     InitializeComponent();
     _description          = description;
     _userEditsDescription = userEditsDescription;
     _showDecimalSetting   = showDecimalSetting;
     _dcsBiosOutput        = dcsBiosOutput;
     _limitDecimals        = limitDecimals;
     _decimalPlaces        = decimalPlaces;
     DCSBIOSControlLocator.LoadControls();
     _dcsbiosControl  = DCSBIOSControlLocator.GetControl(_dcsBiosOutput.ControlId);
     _dcsbiosControls = DCSBIOSControlLocator.GetIntegerOutputControls();
     BIOSEventHandler.AttachDataListener(this);
 }
 private void CopyValues()
 {
     //Use single DCSBIOSOutput
     //This is were DCSBiosOutput (subset of DCSBIOSControl) get populated from DCSBIOSControl
     try
     {
         if (_dcsbiosControl == null && !string.IsNullOrWhiteSpace(TextBoxControlId.Text))
         {
             _dcsbiosControl = DCSBIOSControlLocator.GetControl(TextBoxControlId.Text);
             _dcsBiosOutput.Consume(_dcsbiosControl);
         }
     }
     catch (Exception ex)
     {
         throw new Exception($"Error while creating DCSBIOSOutput object : {ex.Message}");
     }
 }