/// <summary> /// Create an x:data form from the given XML form description /// </summary> /// <param name="x">x:data form to render</param> public XDataForm(Jabber.Protocol.X.Data x) : this() { if (x == null) { throw new ArgumentException("x:data form must not be null", "x"); } m_type = x.Type; this.SuspendLayout(); if (x.Title != null) { this.Text = x.Title; } if (m_type == XDataType.cancel) { lblInstructions.Text = "Form canceled."; // TODO: Localize! lblInstructions.Resize += new EventHandler(lblInstructions_Resize); lblInstructions_Resize(lblInstructions, null); } else if (x.Instructions == null) { lblInstructions.Visible = false; } else { lblInstructions.Text = DeWhitespace(x.Instructions); lblInstructions.Resize += new EventHandler(lblInstructions_Resize); lblInstructions_Resize(lblInstructions, null); } pnlFields.SuspendLayout(); Field[] fields = x.GetFields(); m_fields = new FormField[fields.Length]; for (int i = fields.Length - 1; i >= 0; i--) { m_fields[i] = new FormField(fields[i], this, i); } panel1.TabIndex = fields.Length; if (m_type != XDataType.form) { btnOK.Location = btnCancel.Location; btnCancel.Visible = false; } pnlFields.ResumeLayout(true); this.ResumeLayout(true); for (int i = 0; i < fields.Length; i++) { if ((fields[i].Type != FieldType.hidden) && (fields[i].Type != FieldType.Fixed)) { m_fields[i].Focus(); } } }
/// <summary> /// Create an x:data form from the given XML form description /// </summary> /// <param name="x">x:data form to render</param> public XDataForm(Jabber.Protocol.X.Data x) : this() { if (x == null) throw new ArgumentException("x:data form must not be null", "x"); m_type = x.Type; this.SuspendLayout(); if (x.Title != null) this.Text = x.Title; if (m_type == XDataType.cancel) { lblInstructions.Text = "Form canceled."; // TODO: Localize! lblInstructions.Resize += new EventHandler(lblInstructions_Resize); lblInstructions_Resize(lblInstructions, null); } else if (x.Instructions == null) lblInstructions.Visible = false; else { lblInstructions.Text = DeWhitespace(x.Instructions); lblInstructions.Resize += new EventHandler(lblInstructions_Resize); lblInstructions_Resize(lblInstructions, null); } pnlFields.SuspendLayout(); Field[] fields = x.GetFields(); m_fields = new FormField[fields.Length]; for (int i = fields.Length - 1; i >= 0; i--) { m_fields[i] = new FormField(fields[i], this, i); } panel1.TabIndex = fields.Length; if (m_type != XDataType.form) { btnOK.Location = btnCancel.Location; btnCancel.Visible = false; } pnlFields.ResumeLayout(true); this.ResumeLayout(true); for (int i = 0; i < fields.Length; i++) { if ((fields[i].Type != FieldType.hidden) && (fields[i].Type != FieldType.Fixed)) m_fields[i].Focus(); } }
public void setDataType(XDataType value) { xDataType = value; }