using System; using System.Collections.Generic; using InABox.Core; using System.Diagnostics.CodeAnalysis; using Xamarin.Forms; namespace InABox.Mobile { public abstract class LookupModel : ListModel, ILookupModel where TParent : LookupModel where TEntity : Entity, IRemotable, IPersistent, new() where TItem : Shell, ILookupShell, new() { protected LookupModel(IModelHost host, Func> filter, bool transient = false) : base( host, filter, transient) { } protected LookupModel(IModelHost host, Func> filter, [NotNull] string filename) : base( host, filter, filename) { } protected override void Initialize() { base.Initialize(); _selected.Clear(); } private List _selected = new List(); public void Select(ILookupShell shell) { foreach (var _item in Items) _item.Selected = _item == shell; } public Color Selected { get; set; } public Color Background { get; set; } } }