Exemple #1
0
            public static PromptGroup Parse(Object aParent, XmlElement anXmlElement)
            {
                if (!(aParent is Template))
                {
                    throw new IllegalParentException("Illegal type! Expected instance of type: Template");
                }

                Template tParent = aParent as Template;

                String tName       = getRequiredAttribute(anXmlElement, "name");
                String tRepeatable = getRequiredAttribute(anXmlElement, "repeatable");
                String tMaxRepeats = getOptionalAttribute(anXmlElement, "maxRepeats", "");

                PromptGroup tPromptGroup = new PromptGroup();

                tPromptGroup.Name = tName;
                tPromptGroup.SetRepeatableFromString(tRepeatable);
                tPromptGroup.SetMaxRepeatsFromString(tMaxRepeats);

                //Process prompts
                foreach (XmlNode tNode in anXmlElement.ChildNodes)
                {
                    if (tNode is XmlElement)
                    {
                        XmlElement     tElement = tNode as XmlElement;
                        AbstractPrompt tPrompt  = AbstractPrompt.Factory.Parse(tPromptGroup, tElement);
                        tPromptGroup.AddPrompt(tPrompt);
                    }
                }

                return(tPromptGroup);
            }
Exemple #2
0
        private void produceAndAddPrompt(PromptGroup aPromptGroup, Type aType, AbstractPrompt aReferencePrompt)
        {
            AbstractPrompt newPrompt = AbstractPrompt.Factory.CreateInstance(aType);

            if (aReferencePrompt != null)
            {
                aPromptGroup.AddPromptAfter(newPrompt, aReferencePrompt);
            }
            else
            {
                aPromptGroup.AddPrompt(newPrompt);
            }
            refreshTreeView();
        }