using System.Linq; using InABox.Core; using Xamarin.Forms; namespace PRS.Mobile { public class DocScannerEditViewModel : BindableObject { private DataEntryDocumentShell _document = new (); private readonly DocumentModel _imageModel; public DataEntryDocumentShell Document { get => _document; set { if (Equals(value, _document)) return; _document = value; _imageModel.Refresh(true); OnPropertyChanged(); OnPropertyChanged(nameof(Image)); } } public DocumentShell? Image => _imageModel.Items.FirstOrDefault(); public DocScannerEditViewModel() { _imageModel = new DocumentModel(App.Data, () => new Filter(x => x.ID).IsEqualTo(Document.DocumentID) ); } } }