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(PromptMultiline 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", ""); } } }
public static AbstractPrompt Parse(XmlElement anXmlElement) { PromptMultiline tPrompt = (PromptMultiline)AbstractPrompt.Factory.CreateInstance(typeof(PromptMultiline)); parsePromptChildren(tPrompt, anXmlElement); return(tPrompt); }
public override AbstractPrompt Clone() { PromptMultiline tNewMultiline = (PromptMultiline)AbstractPrompt.Factory.CreateInstance(this.GetType()); tNewMultiline.Name = "CopyOf" + this.Name; tNewMultiline.Description = this.Description; tNewMultiline.Label = this.Label; tNewMultiline.Hint = this.Hint; tNewMultiline.Length = this.Length; tNewMultiline.DefaultValue = this.DefaultValue; return(tNewMultiline); }