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 AddOrUpdateOSCommandBinding(MultiPanelPZ70Knobs multiPanelPZ70Knob, OSCommand osCommand, bool whenTurnedOn) { //This must accept lists var found = false; foreach (var osCommandBinding in _osCommandBindings) { if (osCommandBinding.DialPosition == _pz70DialPosition && osCommandBinding.MultiPanelPZ70Knob == multiPanelPZ70Knob && osCommandBinding.WhenTurnedOn == whenTurnedOn) { osCommandBinding.OSCommandObject = osCommand; found = true; break; } } if (!found) { var osCommandBindingPZ70 = new OSCommandBindingPZ70(); osCommandBindingPZ70.MultiPanelPZ70Knob = multiPanelPZ70Knob; osCommandBindingPZ70.OSCommandObject = osCommand; osCommandBindingPZ70.WhenTurnedOn = whenTurnedOn; _osCommandBindings.Add(osCommandBindingPZ70); } SetIsDirty(); }