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() : ");
     }
 }
 private void UIElement_OnMouseDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (_dataGridValues.SelectedItems.Count == 1)
         {
             _dcsbiosControl = (DCSBIOSControl)_dataGridValues.SelectedItem;
             _dcsBiosOutput  = new DCSBIOSOutput();
             _dcsBiosOutput.Consume(_dcsbiosControl);
             ShowValues2();
             if (_dcsBiosOutput.DCSBiosOutputType == DCSBiosOutputType.INTEGER_TYPE)
             {
                 TextBoxTriggerValue.Text = "0";
             }
             else if (_dcsBiosOutput.DCSBiosOutputType == DCSBiosOutputType.STRING_TYPE)
             {
                 TextBoxTriggerValue.Text = "<string>";
             }
         }
         _popupSearch.IsOpen = false;
         SetFormState();
     }
     catch (Exception ex)
     {
         Common.ShowErrorMessageBox(ex);
     }
 }
예제 #3
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);
 }
 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();
 }
예제 #7
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();
 }
 private void Control_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (_dataGridValues.SelectedItems.Count == 1)
         {
             var dcsbiosControl = (DCSBIOSControl)_dataGridValues.SelectedItem;
             var dcsBiosOutput  = DCSBIOSControlLocator.GetDCSBIOSOutput(dcsbiosControl.identifier);
             var textBox        = (TextBox)_dataGridValues.Tag;
             if (Equals(textBox, TextBoxSearch1))
             {
                 _dcsbiosOutput1     = dcsBiosOutput;
                 _dcsbiosControl1    = dcsbiosControl;
                 TextBoxId1.Text     = _dcsbiosControl1.identifier;
                 TextBoxSearch1.Text = _typeToSearch;
             }
             if (Equals(textBox, TextBoxSearch2))
             {
                 _dcsbiosOutput2     = dcsBiosOutput;
                 _dcsbiosControl2    = dcsbiosControl;
                 TextBoxId2.Text     = _dcsbiosControl2.identifier;
                 TextBoxSearch2.Text = _typeToSearch;
             }
             if (Equals(textBox, TextBoxSearch3))
             {
                 _dcsbiosOutput3     = dcsBiosOutput;
                 _dcsbiosControl3    = dcsbiosControl;
                 TextBoxId3.Text     = _dcsbiosControl3.identifier;
                 TextBoxSearch3.Text = _typeToSearch;
             }
             if (Equals(textBox, TextBoxSearch4))
             {
                 _dcsbiosOutput4     = dcsBiosOutput;
                 _dcsbiosControl4    = dcsbiosControl;
                 TextBoxId4.Text     = _dcsbiosControl4.identifier;
                 TextBoxSearch4.Text = _typeToSearch;
             }
             if (Equals(textBox, TextBoxSearch5))
             {
                 _dcsbiosOutput5     = dcsBiosOutput;
                 _dcsbiosControl5    = dcsbiosControl;
                 TextBoxId5.Text     = _dcsbiosControl5.identifier;
                 TextBoxSearch5.Text = _typeToSearch;
             }
             SetFormState();
         }
         _popupSearch.IsOpen = false;
         SetFormState();
     }
     catch (Exception ex)
     {
         Common.ShowErrorMessageBox(ex);
     }
 }
 private void ButtonClearAll_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         _dcsbiosControl = null;
         _dcsBiosOutput  = null;
         SetFormState();
     }
     catch (Exception ex)
     {
         Common.ShowErrorMessageBox(ex);
     }
 }
 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 ButtonClear5_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         TextBoxId5.Text           = "";
         TextBoxSearch5.Text       = _typeToSearch;
         TextBoxSearch5.Foreground = new SolidColorBrush(Colors.Gainsboro);
         _dcsbiosOutput5           = null;
         _dcsbiosControl5          = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #12
0
 private void ButtonClearAll_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         CheckBoxUseFormula.IsChecked = false;
         _dcsbiosControl     = null;
         _dcsBiosOutput      = null;
         TextBoxFormula.Text = "";
         SetFormState();
     }
     catch (Exception ex)
     {
         Common.ShowErrorMessageBox(106, ex);
     }
 }
 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}");
     }
 }
 private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (_dataGridValues.SelectedItems.Count == 1)
         {
             _dcsbiosControl = (DCSBIOSControl)_dataGridValues.SelectedItem;
             _dcsBiosOutput  = new DCSBIOSOutput();
             _dcsBiosOutput.Consume(_dcsbiosControl);
             ShowValues2();
         }
         SetFormState();
     }
     catch (Exception ex)
     {
         Common.ShowErrorMessageBox(ex);
     }
 }
 private void ButtonClear_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         TextBoxDCSBIOSId.Text        = "";
         LabelSourceRawValue.Content  = "";
         LabelResult.Content          = "";
         LabelErrors.Content          = "";
         TextBoxSearchWord.Text       = "";
         TextBoxSearchWord.Foreground = new SolidColorBrush(Colors.Gainsboro);
         _dcsbiosDecoder.RemoveDCSBIOSOutput();
         _dcsbiosControl = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #16
0
 private void UIElement_OnMouseDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (_dataGridValues.SelectedItems.Count == 1)
         {
             _dcsbiosControl = (DCSBIOSControl)_dataGridValues.SelectedItem;
             _dcsBiosOutput  = new DCSBIOSOutput();
             _dcsBiosOutput.Consume(_dcsbiosControl);
             ShowValues2();
         }
         _popupSearch.IsOpen = false;
         SetFormState();
     }
     catch (Exception ex)
     {
         Common.ShowErrorMessageBox(1006, ex);
     }
 }
        private void Control_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (_popupDataGrid.SelectedItems.Count == 1)
                {
                    _dcsbiosControl = (DCSBIOSControl)_popupDataGrid.SelectedItem;
                    _dcsbiosDecoder.DCSBIOSOutput = DCSBIOSControlLocator.GetDCSBIOSOutput(_dcsbiosControl.identifier);

                    TextBoxDCSBIOSId.Text = _dcsbiosControl.identifier;
                    SetIsDirty();
                    SetFormState();
                }
                _popupSearch.IsOpen = false;
            }
            catch (Exception ex)
            {
                Common.ShowErrorMessageBox(ex);
            }
        }
 private void DataGridValues_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (_dataGridValues.SelectedItems.Count == 1)
         {
             _dcsbiosControl = (DCSBIOSControl)_dataGridValues.SelectedItem;
             _dcsBiosInput   = new DCSBIOSInput();
             _dcsBiosInput.Consume(_dcsbiosControl);
             _dcsBiosInput.SetSelectedInputBasedOnInterfaceType(GetChosenInterfaceType());
             PopulateComboBoxInterfaceType(_dcsBiosInput);
             //TextBoxInputTypeDescription.Text = _dcsBiosInput.GetDescriptionForInterface(GetChosenInterfaceType());
             //TextBoxMaxValue.Text = _dcsBiosInput.GetMaxValueForInterface(GetChosenInterfaceType()).ToString();
             ShowValues2();
         }
         SetFormState();
     }
     catch (Exception ex)
     {
         Common.ShowErrorMessageBox(1007, ex);
     }
 }
예제 #19
0
 private void DataGridValues_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (_dataGridValues.SelectedItems.Count == 1)
         {
             _dcsbiosControl = (DCSBIOSControl)_dataGridValues.SelectedItem;
             _dcsBiosInput   = new DCSBIOSInput();
             _dcsBiosInput.Consume(_dcsbiosControl);
             _dcsBiosInput.SetSelectedInputBasedOnInterfaceType(GetChosenInterfaceType());
             PopulateComboBoxInterfaceType(_dcsBiosInput);
             //TextBoxInputTypeDescription.Text = _dcsBiosInput.GetDescriptionForInterface(GetChosenInterfaceType());
             //TextBoxMaxValue.Text = _dcsBiosInput.GetMaxValueForInterface(GetChosenInterfaceType()).ToString();
             ShowValues2();
             SetFormState();
         }
         _popupSearch.IsOpen = false;
         SetFormState();
     }
     catch (Exception ex)
     {
         Common.ShowErrorMessageBox(ex);
     }
 }
 private void ClearAll()
 {
     _dcsbiosControl = null;
     _dcsBiosOutput  = null;
 }