149 lines
4.6 KiB
C#
149 lines
4.6 KiB
C#
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<cContainerData>
|
|
{
|
|
public int ColumnSpan { get; set; }
|
|
}
|
|
|
|
public class cContainerData : List<IContainerData>
|
|
{
|
|
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<IContainerData> 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<object> RawValues { get; set; } = new List<object>();
|
|
public List<object> RawMaximizeValues { get; set; } = new List<object>();
|
|
public bool IsValueRequired { get; set; }
|
|
}
|
|
|
|
public class cContainerIconHelper : IContainerHelperClass
|
|
{
|
|
public int MaxValueCount { get => Icons.Count; }
|
|
public List<cContainerIcon> Icons { get; set; } = new List<cContainerIcon>();
|
|
public bool IsValueRequired { get; set; }
|
|
}
|
|
|
|
public class cContainerStackPanelHelper : cContainerStackPanel, IContainerHelperClass
|
|
{
|
|
public int MaxValueCount { get => StackPanelHelperData.Max(value => value.MaxValueCount); }
|
|
public List<IContainerHelperClass> StackPanelHelperData { get; set; } = new List<IContainerHelperClass>();
|
|
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
|
|
}
|