I want to be able to save and restore 2 instrumentselectors that I keep in an addons that I am developing, but when I open the addons, only the value of one of them is restored in both instrumentselectors. Could you give me a nudge with the logic that I must follow in order to be able to save and restore both Selectors separately?
protected override void Restore(XElement element) { if (element == null) return; // Restore the Second selected instrument XElement instrumentElement = element.Element("Instrument"); if (instrumentElement != null && !string.IsNullOrEmpty(instrumentElement.Value)) Instrument = Cbi.Instrument.GetInstrument(instrumentElement.Value); [SIZE=14px][B]// Restore the Second selected instrument XElement instrumentElementMaster = element.Element("InstrumentMaster"); if (instrumentElementMaster != null && !string.IsNullOrEmpty(instrumentElementMaster.Value)) InstrumentMaster = Cbi.Instrument.GetInstrument(instrumentElementMast er.Value);[/B][/SIZE] }
protected override void Save(XElement element) { if (element == null) return; // Save the First selected instrument if (Instrument != null) element.Add(new XElement("Instrument") { Value = Instrument.FullName }); [SIZE=14px][B]// Save the Second selected instrument if (InstrumentMaster != null) element.Add(new XElement("InstrumentMaster") { Value = InstrumentMaster.FullName.ToString() });[/B][/SIZE]
Comment