12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.Linq;
- using InABox.Mobile;
- using Xamarin.Forms;
- namespace PRS.Mobile
- {
-
- public class JobSelectionPage : SelectionPage
- {
- public JobSelectionPage(Action<JobShell> action)
- : base(
- "Select Job",
- SelectionPageMode.Immediate,
- (columns, filters) =>
- {
- columns
- .BeginUpdate()
- .Clear()
- .Add(new MobileGridTextColumn<JobShell>()
- { Column = x => x.JobNumber, Width = 100, Alignment = TextAlignment.Center })
- .Add(new MobileGridTextColumn<JobShell>()
- { Column = x => x.Name, Width = GridLength.Star, Alignment = TextAlignment.Start })
- .EndUpdate();
- filters.AddRange(App.Data.Jobs.AvailableFilters().Select(x=>x.Name));
- },
- (args) =>
- {
- App.Data.Jobs.SelectFilter(args.Filter);
- var result = App.Data.Jobs.Refresh(args.Force);
- args.LastUpdated = App.Data.Jobs.LastUpdated;
- return result;
- },
- (items) => action?.Invoke(items.FirstOrDefault() as JobShell)
- )
- {
- }
- }
- }
|