/// <summary> /// Obtiene el control asociado a un elemento de formulario /// </summary> private string GetXamlControlFormItem(string controlID, JabberFormItem formItem, int row) { switch (formItem.Type) { case JabberFormItem.FormItemType.Boolean: return(GetXamlCheckBox(controlID, row, formItem.FirstValue.GetBool())); case JabberFormItem.FormItemType.TextMultiple: case JabberFormItem.FormItemType.TextPrivate: case JabberFormItem.FormItemType.TextSingle: return(GetXamlTextBox(controlID, row, formItem.FirstValue)); default: return(GetXamlTextBox(controlID, row, formItem.FirstValue + " Esto no está controlado")); } }
/// <summary> /// Obtiene el XAML de un control /// </summary> private string GetXamlControl(string controlID, JabberFormItem formItem, int row) { bool hasInputControl = CheckHasInputControl(formItem); string xaml; if (formItem.Type == JabberFormItem.FormItemType.Fixed) { xaml = GetXamlLabel(formItem.FirstValue, false, row, 2); } else { xaml = GetXamlLabel(formItem.Title, formItem.IsRequired, row, hasInputControl ? 1 : 2); } // Si tiene un control de entrada de datos, obtiene el valor if (hasInputControl) { xaml += GetXamlControlFormItem(controlID, formItem, row); } // Devuelve el Xaml return(xaml); }
/// <summary> /// Indica si se debe mostrar una línea de control /// </summary> private bool MustShow(JabberFormItem formItem) { return(formItem.Type != JabberFormItem.FormItemType.Hidden); }
/// <summary> /// Obtiene el Xaml de una imagen /// </summary> private string GetXamlImage(JabberFormItem formItem, int row) { return($"<Image Grid.Row='{row}' Grid.Column='1' Source='{formItem.FirstValue}' />"); }
/// <summary> /// Comprueba si tiene un control de entrada de datos /// </summary> private bool CheckHasInputControl(JabberFormItem formItem) { return(formItem.Type != JabberFormItem.FormItemType.Hidden && formItem.Type != JabberFormItem.FormItemType.Fixed); }