Exemplo n.º 1
0
        public static Conversation FromXML(XElement xml)
        {
            Conversation c = new Conversation();

            if (xml.Element("Name") != null)
            {
                c.Name = xml.Element("Name").Value;
            }
            if (xml.Element("GroupName") != null)
            {
                c.GroupName = xml.Element("GroupName").Value;
            }
            if (xml.Element("Id") != null)
            {
                c.Id = Guid.Parse(xml.Element("Id").Value);
            }
            if (xml.Element("StartStage") != null)
            {
                c.StartingStage = Convert.ToInt32(xml.Element("StartStage").Value);
            }
            if (xml.Element("Stages") != null)
            {
                c.Stages = new ObservableCollection <ConversationStage>(xml.Element("Stages").Elements().Select(a => ConversationStage.FromXML(a)));
            }
            return(c);
        }