DeliveryModule.xaml.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Comal.Classes;
  6. using InABox.Configuration;
  7. using InABox.Core;
  8. using Syncfusion.OfficeChart.Implementation;
  9. using Xamarin.Forms;
  10. using Xamarin.Forms.Xaml;
  11. using XF.Material.Forms;
  12. using XF.Material.Forms.UI;
  13. using XF.Material.Forms.UI.Dialogs;
  14. namespace comal.timesheets
  15. {
  16. [XamlCompilation(XamlCompilationOptions.Compile)]
  17. public partial class DeliveryModule
  18. {
  19. public DeliveryModule()
  20. {
  21. InitializeComponent();
  22. }
  23. private void DeliveryScanner_OnTapped(ModuleMenuItem sender, ModuleMenuItemTappedArgs args)
  24. {
  25. var scannerPage = new ScannerPage();
  26. scannerPage.ItemScanned = async (e) =>
  27. {
  28. var model = new DeliveryItemDetailModel(App.Data,
  29. () => new Filter<DeliveryItem>(x => x.Barcode).IsEqualTo(e.Text));
  30. using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Checking Code"))
  31. model.Load();
  32. if (model.Item != null)
  33. Device.BeginInvokeOnMainThread(() => Navigation.PushAsync(new FrameDetailsPage(model)));
  34. else
  35. await MaterialDialog.Instance.AlertAsync("Code Not Found", "Error");
  36. };
  37. Navigation.PushAsync(scannerPage);
  38. }
  39. private void DeliveryList_OnTapped(ModuleMenuItem sender, ModuleMenuItemTappedArgs args)
  40. {
  41. Navigation.PushAsync(new DeliveryList());
  42. }
  43. }
  44. }