public void AddChoice()
        {
            var choice = new ConversationChoice()
            {
                ChoiceText = "Choice Text", Target = 10
            };

            this.Choices.Add(choice);
            this.SelectedChoice = choice;
        }
Ejemplo n.º 2
0
        public static ConversationChoice FromXML(XElement xml)
        {
            ConversationChoice choice = new ConversationChoice();

            if (xml.Element("Target") != null)
            {
                choice.Target = Convert.ToInt32(xml.Element("Target").Value);
            }
            if (xml.Element("Text") != null)
            {
                choice.ChoiceText = xml.Element("Text").Value;
            }
            if (xml.Element("Visibility") != null)
            {
                choice.ChoiceVisibility = Scripter.Script.FromXML(xml.Element("Visibility").Element("Script"), choice.ChoiceVisibility);
            }
            return(choice);
        }
        public static ConversationStage FromXML(XElement xml)
        {
            ConversationStage stage = new ConversationStage();

            if (xml.Element("Id") != null)
            {
                stage.StageId = Convert.ToInt32(xml.Element("Id").Value);
            }
            if (xml.Element("Name") != null)
            {
                stage.StageName = xml.Element("Name").Value;
            }
            if (xml.Element("Action") != null)
            {
                stage.StageAction = Scripter.Script.FromXML(xml.Element("Action").Element("Script"), stage.StageAction);
            }
            if (xml.Element("Choices") != null)
            {
                stage.Choices = new ObservableCollection <ConversationChoice>(from a in xml.Element("Choices").Elements() select ConversationChoice.FromXML(a));
            }

            return(stage);
        }