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);
     }
 }
 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() : ");
     }
 }
示例#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);
         }
     }
 }
 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);
     }
 }
示例#6
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);
     }
 }