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 AddOrUpdateLCDBinding(DCSBIOSOutputFormula dcsbiosOutputFormula, PZ70LCDPosition pz70LCDPosition) { var found = false; foreach (var dcsBiosBindingLCD in _dcsBiosLcdBindings) { if (dcsBiosBindingLCD.DialPosition == _pz70DialPosition && dcsBiosBindingLCD.PZ70LCDPosition == pz70LCDPosition) { dcsBiosBindingLCD.DCSBIOSOutputFormulaObject = dcsbiosOutputFormula; found = true; break; } } if (!found) { var dcsBiosBindingLCD = new DCSBIOSOutputBindingPZ70(); dcsBiosBindingLCD.DialPosition = _pz70DialPosition; dcsBiosBindingLCD.DCSBIOSOutputFormulaObject = dcsbiosOutputFormula; dcsBiosBindingLCD.PZ70LCDPosition = pz70LCDPosition; _dcsBiosLcdBindings.Add(dcsBiosBindingLCD); } SetIsDirty(); }