Compression
This commit is contained in:
@@ -5,19 +5,30 @@ namespace FileTime.Core.Interactions;
|
||||
|
||||
public partial class OptionsInputElement<T> : InputElementBase, IOptionsInputElement, INotifyPropertyChanged
|
||||
{
|
||||
public IEnumerable<OptionElement<T>> Options { get; }
|
||||
public IReadOnlyCollection<OptionElement<T>> Options { get; }
|
||||
|
||||
[Notify] private T? _value;
|
||||
|
||||
IEnumerable<IOptionElement> IOptionsInputElement.Options => Options;
|
||||
IReadOnlyCollection<IOptionElement> IOptionsInputElement.Options => Options;
|
||||
|
||||
object? IOptionsInputElement.Value
|
||||
{
|
||||
get => Value;
|
||||
set => Value = (T?)value;
|
||||
get => Options.FirstOrDefault(o => o.Value?.Equals(_value) ?? false);
|
||||
set
|
||||
{
|
||||
if (value is T newValue)
|
||||
{
|
||||
Value = newValue;
|
||||
}
|
||||
else if (value is OptionElement<T> optionElement)
|
||||
{
|
||||
Value = optionElement.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OptionsInputElement(string label, IEnumerable<OptionElement<T>> options) : base(label, InputType.Options)
|
||||
{
|
||||
Options = options;
|
||||
Options = options.ToList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user