Exemplo n.º 1
0
 public void ClearAllBindings(TPMPanelSwitch.TPMPanelSwitchOnOff tpmPanelSwitchOnOff)
 {
     //This must accept lists
     foreach (var keyBinding in _keyBindings)
     {
         if (keyBinding.TPMSwitch == tpmPanelSwitchOnOff.TPMSwitch && keyBinding.WhenTurnedOn == tpmPanelSwitchOnOff.On)
         {
             keyBinding.OSKeyPress = null;
         }
     }
     foreach (var dcsBiosBinding in _dcsBiosBindings)
     {
         if (dcsBiosBinding.TPMSwitch == tpmPanelSwitchOnOff.TPMSwitch && dcsBiosBinding.WhenTurnedOn == tpmPanelSwitchOnOff.On)
         {
             dcsBiosBinding.DCSBIOSInputs.Clear();
         }
     }
     Common.DebugP("TPMPanel _keyBindings : " + _keyBindings.Count);
     Common.DebugP("TPMPanel _dcsBiosBindings : " + _dcsBiosBindings.Count);
     IsDirtyMethod();
 }
Exemplo n.º 2
0
        public void AddOrUpdateSingleKeyBinding(TPMPanelSwitches tpmPanelSwitch, string keys, KeyPressLength keyPressLength, bool whenTurnedOn = true)
        {
            if (string.IsNullOrEmpty(keys))
            {
                var tmp = new TPMPanelSwitch.TPMPanelSwitchOnOff(tpmPanelSwitch, whenTurnedOn);
                ClearAllBindings(tmp);
                return;
            }
            var found = false;

            foreach (var keyBinding in _keyBindings)
            {
                if (keyBinding.TPMSwitch == tpmPanelSwitch && keyBinding.WhenTurnedOn == whenTurnedOn)
                {
                    if (string.IsNullOrEmpty(keys))
                    {
                        keyBinding.OSKeyPress = null;
                    }
                    else
                    {
                        keyBinding.OSKeyPress   = new OSKeyPress(keys, keyPressLength);
                        keyBinding.WhenTurnedOn = whenTurnedOn;
                    }
                    found = true;
                }
            }
            if (!found && !string.IsNullOrEmpty(keys))
            {
                var keyBinding = new KeyBindingTPM();
                keyBinding.TPMSwitch    = tpmPanelSwitch;
                keyBinding.OSKeyPress   = new OSKeyPress(keys, keyPressLength);
                keyBinding.WhenTurnedOn = whenTurnedOn;
                _keyBindings.Add(keyBinding);
            }
            Common.DebugP("TPMPanel _keyBindings : " + _keyBindings.Count);
            IsDirtyMethod();
        }