Beispiel #1
0
 public static void Prompt_Click(object data)
 {
     if (data is PromptText)
     {
         PromptText castedObject = data as PromptText;
         editor_pg.SelectedObject = castedObject;
     }
     else if (data is PromptMultiline)
     {
         PromptMultiline castedObject = data as PromptMultiline;
         editor_pg.SelectedObject = castedObject;
     }
     else if (data is PromptDate)
     {
         PromptDate castedObject = data as PromptDate;
         editor_pg.SelectedObject = castedObject;
     }
     else if (data is PromptCheckbox)
     {
         PromptCheckbox castedObject = data as PromptCheckbox;
         editor_pg.SelectedObject = castedObject;
     }
     else if (data is PromptUserDefined)
     {
         PromptUserDefined castedObject = data as PromptUserDefined;
         editor_pg.SelectedObject = castedObject;
     }
     else
     {
         AbstractPrompt castedObject = data as AbstractPrompt;
         editor_pg.SelectedObject = castedObject;
     }
 }
            private static void parsePromptChildren(PromptText aPrompt, XmlNode aPromptNode)
            {
                foreach (XmlNode tPromptNode in aPromptNode.ChildNodes)
                {
                    if (tPromptNode.Name == "label")
                    {
                        aPrompt.Label = tPromptNode.InnerText;
                    }
                    else if (tPromptNode.Name == "hint")
                    {
                        aPrompt.Hint = tPromptNode.InnerText;
                    }
                    else if (tPromptNode.Name == "type")
                    {
                        int tMaxLength = -1;
                        if (Int32.TryParse(getOptionalAttribute(tPromptNode, "maxLength", tMaxLength.ToString()), out tMaxLength))
                        {
                            if (tMaxLength == -1)
                            {
                                aPrompt.Length = "";
                            }
                            else
                            {
                                aPrompt.Length = tMaxLength.ToString();
                            }
                        }
                        ;

                        aPrompt.DefaultValue = getOptionalAttribute(tPromptNode, "defaultValue", "");
                        aPrompt.UpperCase    = Boolean.Parse(getOptionalAttribute(tPromptNode, "uppercase", "false"));
                    }
                }
            }
            public static AbstractPrompt Parse(PromptGroup aParent, XmlElement anXmlElement)
            {
                PromptText tPrompt = (PromptText)AbstractPrompt.Factory.CreateInstance(typeof(PromptText));

                parsePromptChildren(tPrompt, anXmlElement);

                return(tPrompt);
            }
        public override AbstractPrompt Clone()
        {
            PromptText tNewPromptText = (PromptText)AbstractPrompt.Factory.CreateInstance(this.GetType());

            tNewPromptText.Name         = "CopyOf" + this.Name;
            tNewPromptText.Description  = this.Description;
            tNewPromptText.Label        = this.Label;
            tNewPromptText.Hint         = this.Hint;
            tNewPromptText.UpperCase    = this.UpperCase;
            tNewPromptText.Length       = this.Length;
            tNewPromptText.DefaultValue = this.DefaultValue;
            return(tNewPromptText);
        }