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