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("RadioPanelKey{"))
             {
                 var keyBinding = new KeyBindingPZ69();
                 keyBinding.ImportSettings(setting);
                 _keyBindings.Add(keyBinding);
             }
             else if (setting.StartsWith("PZ69DisplayValue{"))
             {
                 var radioPanelPZ69DisplayValue = new RadioPanelPZ69DisplayValue();
                 radioPanelPZ69DisplayValue.ImportSettings(setting);
                 _displayValues.Add(radioPanelPZ69DisplayValue);
             }
             else if (setting.StartsWith("RadioPanelBIPLink{"))
             {
                 var bipLinkPZ69 = new BIPLinkPZ69();
                 bipLinkPZ69.ImportSettings(setting);
                 _bipLinks.Add(bipLinkPZ69);
             }
         }
     }
     OnSettingsApplied();
 }
        public void AddOrUpdateSequencedKeyBinding(string information, RadioPanelPZ69KnobsEmulator radioPanelPZ69Knob, SortedList <int, KeyPressInfo> sortedList, bool whenTurnedOn)
        {
            if (sortedList.Count == 0)
            {
                RemoveRadioPanelKnobFromList(ControlListPZ69.KEYS, radioPanelPZ69Knob, whenTurnedOn);
                IsDirtyMethod();
                return;
            }
            //This must accept lists
            var found = false;

            foreach (var keyBinding in _keyBindings)
            {
                if (keyBinding.RadioPanelPZ69Key == radioPanelPZ69Knob && 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 KeyBindingPZ69();
                keyBinding.RadioPanelPZ69Key = radioPanelPZ69Knob;
                keyBinding.OSKeyPress        = new OSKeyPress(information, sortedList);
                keyBinding.WhenTurnedOn      = whenTurnedOn;
                _keyBindings.Add(keyBinding);
            }
            IsDirtyMethod();
        }
        public void AddOrUpdateSingleKeyBinding(RadioPanelPZ69KnobsEmulator radioPanelPZ69Knob, string keys, KeyPressLength keyPressLength, bool whenTurnedOn)
        {
            if (string.IsNullOrEmpty(keys))
            {
                var tmp = new RadioPanelPZ69KeyOnOff(radioPanelPZ69Knob, whenTurnedOn);
                ClearAllBindings(tmp);
                return;
            }
            var found = false;

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