Exemplo n.º 1
0
 public void ClearAllBindings(PZ69DialPosition pz69DialPosition, RadioPanelPZ69KeyOnOff radioPanelPZ69KnobOnOff)
 {
     //This must accept lists
     foreach (var keyBinding in _keyBindings)
     {
         if (keyBinding.DialPosition == pz69DialPosition && keyBinding.RadioPanelPZ69Key == radioPanelPZ69KnobOnOff.RadioPanelPZ69Key && keyBinding.WhenTurnedOn == radioPanelPZ69KnobOnOff.ButtonState)
         {
             keyBinding.OSKeyPress = null;
         }
     }
     IsDirtyMethod();
 }
Exemplo n.º 2
0
        public void AddOrUpdateSingleKeyBinding(RadioPanelPZ69KnobsEmulator radioPanelPZ69Knob, string keys, KeyPressLength keyPressLength, bool whenTurnedOn)
        {
            var pz69DialPosition = GetDial(radioPanelPZ69Knob);

            if (string.IsNullOrEmpty(keys))
            {
                var tmp = new RadioPanelPZ69KeyOnOff(radioPanelPZ69Knob, whenTurnedOn);
                ClearAllBindings(pz69DialPosition, tmp);
                return;
            }
            var found = false;

            foreach (var keyBinding in _keyBindings)
            {
                if (keyBinding.RadioPanelPZ69Key == radioPanelPZ69Knob && keyBinding.WhenTurnedOn == whenTurnedOn && keyBinding.DialPosition == pz69DialPosition)
                {
                    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 KeyBindingPZ69DialPosition();
                keyBinding.RadioPanelPZ69Key = radioPanelPZ69Knob;
                keyBinding.DialPosition      = pz69DialPosition;
                keyBinding.OSKeyPress        = new OSKeyPress(keys, keyPressLength);
                keyBinding.WhenTurnedOn      = whenTurnedOn;
                _keyBindings.Add(keyBinding);
            }
            Common.DebugP("RadioPanelPZ69FullEmulator _keyBindings : " + _keyBindings.Count);
            IsDirtyMethod();
        }