using System; using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; using FasdDesktopUi.Basics.Enums; using C4IT.FASD.Base; using static C4IT.Logging.cLogManager; using MaterialIcons; using F4SD_AdaptableIcon.Enums; using C4IT.F4SD.DisplayFormatting; namespace FasdDesktopUi.Basics.Models { public interface IContainerData { bool HasValue { get; } } public interface IContainerHelperClass { int MaxValueCount { get; } bool IsValueRequired { get; } } public interface IContainerCollectionElementData { } public class cContainerCollectionData : List { public int ColumnSpan { get; set; } } public class cContainerData : List { public string ContainerName { get; set; } public bool IsMaximizable { get; set; } public bool IsAddable { get; set; } public bool IsDeletable { get; set; } } public class cContainerStackPanel : IContainerData { public Orientation Orientation { get; set; } public List StackPanelData { get; set; } public bool HasValue { get => StackPanelData?.Any(data => data.HasValue) ?? false; } } public class cContainerPrimaryContent : IContainerData { public IContainerData Value { get; set; } public bool HasValue { get => Value.HasValue; } } public class cContainerValue : IContainerData { public string DisplayValue { get; set; } public string Description { get; set; } public string MaximizeValue { get; set; } public double FontSize { get; set; } = 16; public FontWeight FontWeight { get; set; } = FontWeights.Normal; public bool IsEditOnly { get; set; } = false; public cEditableValueInformationBase EditableValueInformation { get; set; } public bool HasValue { get => !string.IsNullOrWhiteSpace(DisplayValue); } } public class cContainerIcon : IContainerData { public string IconName { get; set; } public enumIconType IconType { get; set; } public enumHighlightColor HighlightColor { get; set; } = enumHighlightColor.none; public string ToolTipText { get; set; } public cContainerIcon() { } public cContainerIcon(enumInternIcons internIcon, enumHighlightColor highlightColor = enumHighlightColor.none) { try { IconType = enumIconType.intern; IconName = internIcon.ToString(); HighlightColor = highlightColor; } catch (Exception E) { LogException(E); } } public cContainerIcon(MaterialIconType materialIcon, enumHighlightColor highlightColor = enumHighlightColor.none) { try { IconType = enumIconType.material; IconName = materialIcon.ToString(); HighlightColor = highlightColor; } catch (Exception E) { LogException(E); } } public bool HasValue { get => !string.IsNullOrWhiteSpace(IconName); } } #region Helpers public class cContainerValueHelper : cContainerValue, IContainerHelperClass { public int MaxValueCount { get => RawValues.Count; } public RawValueType DisplayType { get; set; } public List RawValues { get; set; } = new List(); public List RawMaximizeValues { get; set; } = new List(); public bool IsValueRequired { get; set; } } public class cContainerIconHelper : IContainerHelperClass { public int MaxValueCount { get => Icons.Count; } public List Icons { get; set; } = new List(); public bool IsValueRequired { get; set; } } public class cContainerStackPanelHelper : cContainerStackPanel, IContainerHelperClass { public int MaxValueCount { get => StackPanelHelperData.Max(value => value.MaxValueCount); } public List StackPanelHelperData { get; set; } = new List(); public bool IsValueRequired { get; set; } } public class cContainerContentHelper : cContainerPrimaryContent, IContainerHelperClass { public int MaxValueCount { get => Content?.MaxValueCount ?? 1; } public IContainerHelperClass Content { get; set; } public bool IsValueRequired { get; set; } } #endregion }