public void LoadXmlElements(XElement doc) { XElement feedback = doc.Descendants("Feedback").FirstOrDefault(); if (feedback != null) { foreach (XElement xmlFeedback in feedback.Elements()) { string[] targetIds = (xmlFeedback.Attribute("target").Value as string).Split(", ".ToCharArray()); object targets; if (workSpaceReference.GetobjectFromId(targetIds[0]) is ChemProV.PFD.Streams.StreamControl) { List <ChemProV.PFD.Streams.StreamControl> list = new List <ChemProV.PFD.Streams.StreamControl>(); foreach (string targetID in targetIds) { list.Add(workSpaceReference.GetobjectFromId(targetID) as ChemProV.PFD.Streams.StreamControl); } targets = list; } else if (workSpaceReference.GetobjectFromId(targetIds[0]) is IPropertiesWindow) { List <IPropertiesWindow> list = new List <IPropertiesWindow>(); foreach (string targetID in targetIds) { list.Add(workSpaceReference.GetobjectFromId(targetID) as IPropertiesWindow); } targets = list; } else { //must only be one thing so set it to tgars targets = workSpaceReference.GetobjectFromId(targetIds[0]); } Feedback fb = new Feedback(targets, xmlFeedback.Attribute("message").Value); fb.Id = xmlFeedback.Attribute("id").Value; } } }