public void AddOrUpdateDCSBIOSBinding(FIPPanelButtons fipPanelButton, List <DCSBIOSInput> dcsbiosInputs, string description, bool whenTurnedOn = true) { //!!!!!!! //If all DCS-BIOS commands has been deleted then provide a empty list, not null object!!! //This must accept lists var found = false; RemoveFIPPanelSwitchFromList(1, fipPanelButton, whenTurnedOn); foreach (var dcsBiosBinding in _dcsBiosBindings) { if (dcsBiosBinding.FIPButton == fipPanelButton && dcsBiosBinding.WhenTurnedOn == whenTurnedOn) { dcsBiosBinding.DCSBIOSInputs = dcsbiosInputs; dcsBiosBinding.WhenTurnedOn = whenTurnedOn; dcsBiosBinding.Description = description; found = true; break; } } if (!found) { var dcsBiosBinding = new DCSBIOSBindingFIP(); dcsBiosBinding.FIPButton = fipPanelButton; dcsBiosBinding.DCSBIOSInputs = dcsbiosInputs; dcsBiosBinding.WhenTurnedOn = whenTurnedOn; dcsBiosBinding.Description = description; _dcsBiosBindings.Add(dcsBiosBinding); } IsDirtyMethod(); }
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) { if (setting.StartsWith("FIPPanelButton{")) { var keyBinding = new KeyBindingFIP(); keyBinding.ImportSettings(setting); _keyBindings.Add(keyBinding); } else if (setting.StartsWith("FIPPanelDCSBIOSControl{")) { var dcsBIOSBindingFIP = new DCSBIOSBindingFIP(); dcsBIOSBindingFIP.ImportSettings(setting); _dcsBiosBindings.Add(dcsBIOSBindingFIP); } } } OnSettingsApplied(); }