public void DeserializeMonitors(MonitorCollection destination, XmlReader xmlReader) { int i = 1; if (xmlReader.Name.Equals("Monitors")) { if (!xmlReader.IsEmptyElement) { xmlReader.ReadStartElement("Monitors"); while (xmlReader.NodeType != XmlNodeType.EndElement) { Monitor display = DeserializeMonitor(xmlReader); if (display != null) { display.Name = "Monitor " + i++; if (display != null) { destination.Add(display); } } } xmlReader.ReadEndElement(); } else { xmlReader.Read(); } } }
public HeliosProfile(bool autoAddInterfaces) { _monitors.CollectionChanged += new NotifyCollectionChangedEventHandler(Monitors_CollectionChanged); _interfaces.CollectionChanged += new NotifyCollectionChangedEventHandler(Interfaces_CollectionChanged); int i = 1; foreach (Monitor display in ConfigManager.DisplayManager.Displays) { Monitor monitor = new Monitor(display); monitor.Name = "Monitor " + i++; _monitors.Add(monitor); } if (autoAddInterfaces) { foreach (HeliosInterfaceDescriptor descriptor in ConfigManager.ModuleManager.InterfaceDescriptors) { foreach (HeliosInterface newInterface in descriptor.GetAutoAddInstances(this)) { Interfaces.Add(newInterface); } } } LoadTime = DateTime.MinValue; }
public IEnumerable <string> DeserializeMonitor(MonitorCollection destination, XmlReader xmlReader, int monitorNumber) { xmlReader.ReadStartElement("Monitor"); Monitor display = (Monitor)CreateNewObject("Monitor", ""); display.ReadXml(xmlReader); foreach (string progress in DeserializeControls(display.Children, xmlReader)) { yield return(progress); } xmlReader.ReadEndElement(); display.Name = "Monitor " + monitorNumber; destination.Add(display); yield return($"loaded {display.Name}"); }