public static AccessibilityResource Create(XElement element) { var selections = element.Elements("Selection") .Select(x => AccessibilitySelection.Create(x)) .OrderBy(x => x.Order) .ToImmutableArray(); var defaultSelection = (string)element.Element("DefaultSelection"); defaultSelection = string.IsNullOrEmpty(defaultSelection) ? selections.FirstOrDefault()?.SelectionCode : defaultSelection; var resourceType = (string)element.Element("ResourceType") ?? string.Empty; var textElem = element.Element("Text"); return(new AccessibilityResource( resourceCode: (string)element.Element("Code"), currentSelectionCode: defaultSelection, order: (int)element.Element("Order"), defaultSelection: defaultSelection, label: (string)textElem.Element("Label"), description: (string)textElem.Element("Description"), disabled: false, selections: selections, resourceType: resourceType)); }
public AccessibilitySelection WithDisabled(bool disabled) { var newSelection = new AccessibilitySelection( code: SelectionCode, label: Label, order: Order, disabled: disabled, hidden: Hidden); return(newSelection); }
public static AccessibilitySelection Create(XElement xmlSelection) { var selection = new AccessibilitySelection( code: (string)xmlSelection.Element("Code"), label: (string)xmlSelection.Element("Text")?.Element("Label"), order: (int?)xmlSelection.Element("Order"), disabled: false, hidden: false); return(selection); }
public static AccessibilitySelection Create( string code = "", string label = "", int?order = null, bool disabled = false, bool hidden = false) { var sel = new AccessibilitySelection( code: code, order: order, disabled: disabled, label: label, hidden: hidden); return(sel); }