コード例 #1
0
 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);
     }
 }
コード例 #2
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);
     }
 }
コード例 #3
0
        private void CopyValues()
        {
            try
            {
                /*
                 * fixed_step = <INC/DEC>
                 * set_state = <integer>
                 * action = TOGGLE
                 * variable_step = <new_value>|-<decrease_by>|+<increase_by>
                 */
                _dcsBiosInput.SetSelectedInputBasedOnInterfaceType(GetChosenInterfaceType());
                switch (_dcsBiosInput.SelectedDCSBIOSInput.Interface)
                {
                case DCSBIOSInputType.ACTION:
                {
                    _dcsBiosInput.SelectedDCSBIOSInput.SpecifiedActionArgument = ComboBoxInputValueAction.SelectedValue.ToString();
                    break;
                }

                case DCSBIOSInputType.SET_STATE:
                {
                    uint tmp;
                    try
                    {
                        tmp = uint.Parse(TextBoxInputValueSetState.Text);
                    }
                    catch (Exception)
                    {
                        var dcsbiosInputString = "";
                        if (_dcsBiosInput != null)
                        {
                            dcsbiosInputString = _dcsBiosInput.ControlId + " / " + _dcsBiosInput.SelectedDCSBIOSInput.Interface;
                        }
                        throw new Exception("Please enter a valid value (positive whole number). Value found : [" + TextBoxInputValueSetState.Text + "]" + Environment.NewLine + " DCS-BIOS Input is " + dcsbiosInputString);
                    }
                    if (tmp > _dcsBiosInput.SelectedDCSBIOSInput.MaxValue)
                    {
                        throw new Exception("Input value must be between 0 - " + _dcsBiosInput.SelectedDCSBIOSInput.MaxValue);
                    }
                    _dcsBiosInput.SelectedDCSBIOSInput.SpecifiedSetStateArgument = tmp;

                    break;
                }

                case DCSBIOSInputType.VARIABLE_STEP:
                {
                    int tmp;
                    try
                    {
                        tmp = int.Parse(TextBoxInputValueSetState.Text);
                    }
                    catch (Exception)
                    {
                        var dcsbiosInputString = "";
                        if (_dcsBiosInput != null)
                        {
                            dcsbiosInputString = _dcsBiosInput.ControlId + " / " + _dcsBiosInput.SelectedDCSBIOSInput.Interface;
                        }
                        throw new Exception("Please enter a valid value (whole number). Value found : [" + TextBoxInputValueSetState.Text + "]" + Environment.NewLine + " DCS-BIOS Input is " + dcsbiosInputString);
                    }
                    if (tmp > _dcsBiosInput.SelectedDCSBIOSInput.MaxValue)
                    {
                        throw new Exception("Input value must be between 0 - " + _dcsBiosInput.SelectedDCSBIOSInput.MaxValue);
                    }
                    _dcsBiosInput.SelectedDCSBIOSInput.SpecifiedVariableStepArgument = tmp;
                    break;
                }

                case DCSBIOSInputType.FIXED_STEP:
                {
                    _dcsBiosInput.SelectedDCSBIOSInput.SpecifiedFixedStepArgument = (DCSBIOSFixedStepInput)Enum.Parse(typeof(DCSBIOSFixedStepInput), ComboBoxInputValueFixedStep.SelectedValue.ToString());
                    break;
                }
                }
            }
            catch (Exception e)
            {
                throw new Exception("1003351 Error in CopyValues() : " + e.Message);
            }
        }