12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- 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<Scan>(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<MobileDocumentCameraSource,ScanShell>(
- true, (shell) => shell.EmployeeID = App.Data.Me.ID);
- }
- private async void BrowseLibrary_Clicked(object sender, EventArgs e)
- {
- await _documents.AddImage<MobileDocumentLibrarySource,ScanShell>(
- true, (shell) => shell.EmployeeID = App.Data.Me.ID);
- }
- }
- }
|