ShipmentSelectionPage.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Linq;
  3. using Comal.Classes;
  4. using InABox.Core;
  5. using InABox.Mobile;
  6. using Xamarin.Forms;
  7. namespace PRS.Mobile
  8. {
  9. public class ShipmentSelectionPage : SelectionPage
  10. {
  11. public ShipmentSelectionPage(Action<ShipmentShell> action)
  12. : base(
  13. (string)"Select Rack",
  14. (SelectionPageMode)SelectionPageMode.Immediate,
  15. (columns, filters) =>
  16. {
  17. columns
  18. .BeginUpdate()
  19. .Clear()
  20. .Add(new MobileGridTextColumn<ShipmentShell>() { Column = x => x.Code, Width = GridLength.Auto })
  21. .Add(new MobileGridTextColumn<ShipmentShell>() { Column = x => x.Description, Width = GridLength.Star })
  22. .Add(new MobileGridIntegerColumn<ShipmentShell>() { Column = x => x.ItemCount, Width = GridLength.Auto, Caption = "#"})
  23. .EndUpdate();
  24. },
  25. (args) =>
  26. {
  27. return new ShipmentModel(App.Data, () => new Filter<Shipment>(x => x.Delivery.ID).IsEqualTo(Guid.Empty)
  28. .And(x => x.ItemCount).IsNotEqualTo(0)).Refresh(true);
  29. },
  30. (items) =>
  31. action?.Invoke(items.FirstOrDefault() as ShipmentShell)
  32. ) { }
  33. }
  34. }