Exemplo n.º 1
0
        public void AddOrUpdateSequencedKeyBinding(string information, SwitchPanelPZ55Keys switchPanelPZ55Key, SortedList <int, KeyPressInfo> sortedList, bool whenTurnedOn = true)
        {
            //This must accept lists
            var found = false;

            RemoveSwitchPanelKeyFromList(2, switchPanelPZ55Key, whenTurnedOn);
            foreach (var keyBinding in _keyBindings)
            {
                if (keyBinding.SwitchPanelPZ55Key == switchPanelPZ55Key && keyBinding.WhenTurnedOn == whenTurnedOn)
                {
                    if (sortedList.Count == 0)
                    {
                        keyBinding.OSKeyPress = null;
                    }
                    else
                    {
                        keyBinding.OSKeyPress   = new OSKeyPress(information, sortedList);
                        keyBinding.WhenTurnedOn = whenTurnedOn;
                    }
                    found = true;
                    break;
                }
            }
            if (!found && sortedList.Count > 0)
            {
                var keyBinding = new KeyBindingPZ55();
                keyBinding.SwitchPanelPZ55Key = switchPanelPZ55Key;
                keyBinding.OSKeyPress         = new OSKeyPress(information, sortedList);
                keyBinding.WhenTurnedOn       = whenTurnedOn;
                _keyBindings.Add(keyBinding);
            }
            IsDirtyMethod();
        }
Exemplo n.º 2
0
 public override void ImportSettings(List <string> settings)
 {
     //Clear current bindings
     ClearSettings();
     if (settings == null || settings.Count == 0)
     {
         return;
     }
     foreach (var setting in settings)
     {
         if (!setting.StartsWith("#") && setting.Length > 2 && setting.Contains(InstanceId))
         {
             if (setting.StartsWith("SwitchPanelKey{"))
             {
                 var keyBinding = new KeyBindingPZ55();
                 keyBinding.ImportSettings(setting);
                 _keyBindings.Add(keyBinding);
             }
             else if (setting.StartsWith("SwitchPanelOSPZ55"))
             {
                 var osCommand = new OSCommandBindingPZ55();
                 osCommand.ImportSettings(setting);
                 _osCommandBindings.Add(osCommand);
             }
             else if (setting.StartsWith("SwitchPanelLed"))
             {
                 var colorOutput = new DcsOutputAndColorBindingPZ55();
                 colorOutput.ImportSettings(setting);
                 _listColorOutputBinding.Add(colorOutput);
             }
             else if (setting.StartsWith("SwitchPanelDCSBIOSControl{"))
             {
                 var dcsBIOSBindingPZ55 = new DCSBIOSBindingPZ55();
                 dcsBIOSBindingPZ55.ImportSettings(setting);
                 _dcsBiosBindings.Add(dcsBIOSBindingPZ55);
             }
             else if (setting.StartsWith("SwitchPanelBIPLink{"))
             {
                 var bipLinkPZ55 = new BIPLinkPZ55();
                 bipLinkPZ55.ImportSettings(setting);
                 _bipLinks.Add(bipLinkPZ55);
             }
             else if (setting.StartsWith("ManualLandingGearLEDs{"))
             {
                 _manualLandingGearLeds = setting.Contains("True");
             }
         }
     }
     OnSettingsApplied();
     _keyBindings = KeyBindingPZ55.SetNegators(_keyBindings);
 }
Exemplo n.º 3
0
        public void AddOrUpdateSingleKeyBinding(SwitchPanelPZ55Keys switchPanelPZ55Key, string keys, KeyPressLength keyPressLength, bool whenTurnedOn = true)
        {
            if (string.IsNullOrEmpty(keys))
            {
                var tmp = new SwitchPanelPZ55KeyOnOff(switchPanelPZ55Key, whenTurnedOn);
                ClearAllBindings(tmp);
                return;
            }
            var found = false;

            foreach (var keyBinding in _keyBindings)
            {
                if (keyBinding.SwitchPanelPZ55Key == switchPanelPZ55Key && 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 KeyBindingPZ55();
                keyBinding.SwitchPanelPZ55Key = switchPanelPZ55Key;
                keyBinding.OSKeyPress         = new OSKeyPress(keys, keyPressLength);
                keyBinding.WhenTurnedOn       = whenTurnedOn;
                _keyBindings.Add(keyBinding);
            }
            Common.DebugP("SwitchPanelPZ55 _keyBindings : " + _keyBindings.Count);
            IsDirtyMethod();
        }