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();
 }
Example #2
0
        public void AddOrUpdateBIPLinkKeyBinding(RadioPanelPZ69KnobsEmulator radioPanelPZ69Knob, BIPLinkPZ69 bipLinkPZ69, bool whenTurnedOn)
        {
            if (bipLinkPZ69.BIPLights.Count == 0)
            {
                RemoveRadioPanelKnobFromList(ControlListPZ69.BIPS, radioPanelPZ69Knob, whenTurnedOn);
                IsDirtyMethod();
                return;
            }
            //This must accept lists
            var found = false;

            foreach (var bipLink in _bipLinks)
            {
                if (bipLink.RadioPanelPZ69Knob == radioPanelPZ69Knob && bipLink.WhenTurnedOn == whenTurnedOn)
                {
                    bipLink.BIPLights          = bipLinkPZ69.BIPLights;
                    bipLink.Description        = bipLinkPZ69.Description;
                    bipLink.RadioPanelPZ69Knob = radioPanelPZ69Knob;
                    bipLink.WhenTurnedOn       = whenTurnedOn;
                    found = true;
                    break;
                }
            }
            if (!found && bipLinkPZ69.BIPLights.Count > 0)
            {
                bipLinkPZ69.RadioPanelPZ69Knob = radioPanelPZ69Knob;
                bipLinkPZ69.WhenTurnedOn       = whenTurnedOn;
                _bipLinks.Add(bipLinkPZ69);
            }
            IsDirtyMethod();
        }