JobSelectionPage.cs 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Linq;
  3. using Xamarin.Forms;
  4. namespace comal.timesheets
  5. {
  6. public class JobSelectionPage : SelectionPage
  7. {
  8. public JobSelectionPage(Action<JobShell> action)
  9. : base(
  10. "Select Job",
  11. SelectionPageMode.Immediate,
  12. (columns) =>
  13. {
  14. columns
  15. .BeginUpdate()
  16. .Clear()
  17. .Add(new MobileGridTextColumn<JobShell>()
  18. { Column = x => x.JobNumber, Width = 100, Alignment = TextAlignment.Center })
  19. .Add(new MobileGridTextColumn<JobShell>()
  20. { Column = x => x.Name, Width = GridLength.Star, Alignment = TextAlignment.Start })
  21. .EndUpdate();
  22. },
  23. (refresh) => App.Data.Jobs.Refresh(refresh),
  24. (items) => action?.Invoke(items.FirstOrDefault() as JobShell)
  25. )
  26. {
  27. }
  28. }
  29. }