using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Comal.Classes; using InABox.Core; using InABox.Mobile; using Xamarin.Forms; using Xamarin.Forms.Xaml; namespace PRS.Mobile.Modules.Scans { [XamlCompilation(XamlCompilationOptions.Compile)] public partial class ScanModule { private ScanModel _scans; public ScanModule() { _scans = new ScanModel(App.Data, () => new Filter(x => x.Employee.ID).IsEqualTo(App.Data.Me.ID) .And(x => x.Processed).IsEqualTo(false) ) { FileName = "scans.data" }; InitializeComponent(); RefreshData(false, true); } private void RefreshData(bool force, bool async) { if (async) _scans.Refresh(force, () => Device.BeginInvokeOnMainThread(RefreshScreen)); else { _scans.Refresh(force); RefreshScreen(); } } private void RefreshScreen() { _documents.ItemsSource = null; _documents.ItemsSource = _scans; } private async void TakePhoto_Clicked(object sender, EventArgs e) { await _documents.AddImage( true, (shell) => shell.EmployeeID = App.Data.Me.ID); } private async void BrowseLibrary_Clicked(object sender, EventArgs e) { await _documents.AddImage( true, (shell) => shell.EmployeeID = App.Data.Me.ID); } } }