public override void ImportSettings(GenericPanelBinding genericPanelBinding) { ClearSettings(); BindingHash = genericPanelBinding.BindingHash; var settings = genericPanelBinding.Settings; SettingsLoading = true; foreach (var setting in settings) { if (!setting.StartsWith("#") && setting.Length > 2) { if (setting.StartsWith("MultiPanelKnob{")) { var knobBinding = new KeyBindingPZ70(); knobBinding.ImportSettings(setting); _knobBindings.Add(knobBinding); } else if (setting.StartsWith("MultiPanelOSPZ70")) { var osCommand = new OSCommandBindingPZ70(); osCommand.ImportSettings(setting); _osCommandBindings.Add(osCommand); } else if (setting.StartsWith("MultiPanelDCSBIOSControl{")) { var dcsBIOSBindingPZ70 = new DCSBIOSActionBindingPZ70(); dcsBIOSBindingPZ70.ImportSettings(setting); _dcsBiosBindings.Add(dcsBIOSBindingPZ70); } else if (setting.StartsWith("MultipanelBIPLink{")) { var bipLinkPZ70 = new BIPLinkPZ70(); bipLinkPZ70.ImportSettings(setting); _bipLinks.Add(bipLinkPZ70); } else if (setting.StartsWith("MultiPanelDCSBIOSControlLCD{")) { var dcsBIOSBindingLCDPZ70 = new DCSBIOSOutputBindingPZ70(); dcsBIOSBindingLCDPZ70.ImportSettings(setting); _dcsBiosLcdBindings.Add(dcsBIOSBindingLCDPZ70); } } } SettingsLoading = false; _knobBindings = KeyBindingPZ70.SetNegators(_knobBindings); SettingsApplied(); }
public void AddOrUpdateBIPLinkKnobBinding(MultiPanelPZ70Knobs multiPanelKnob, BIPLinkPZ70 bipLinkPZ70, bool whenTurnedOn) { if (bipLinkPZ70.BIPLights.Count == 0) { RemoveMultiPanelKnobFromList(ControlListPZ70.BIPS, multiPanelKnob, whenTurnedOn); SetIsDirty(); return; } //This must accept lists var found = false; foreach (var bipLink in _bipLinks) { if (bipLink.MultiPanelPZ70Knob == multiPanelKnob && bipLink.WhenTurnedOn == whenTurnedOn) { bipLink.BIPLights = bipLinkPZ70.BIPLights; bipLink.Description = bipLinkPZ70.Description; bipLink.MultiPanelPZ70Knob = multiPanelKnob; found = true; break; } } if (!found && bipLinkPZ70.BIPLights.Count > 0) { bipLinkPZ70.MultiPanelPZ70Knob = multiPanelKnob; bipLinkPZ70.WhenTurnedOn = whenTurnedOn; _bipLinks.Add(bipLinkPZ70); } SetIsDirty(); }