using System; using System.Linq; using Xamarin.Forms; namespace comal.timesheets { public class EmployeeSelectionPage : SelectionPage { public EmployeeSelectionPage(Action action) : base( "SelectEmployee", SelectionPageMode.Immediate, (columns) => { columns .BeginUpdate() .Clear() .Add(new MobileGridTextColumn() { Column = x => x.Code, Width = GridLength.Auto }) .Add(new MobileGridTextColumn() { Column = x => x.Name, Width = GridLength.Star }) .EndUpdate(); }, (refresh) => App.Data.Employees.Refresh(refresh), (items) => action?.Invoke(items.FirstOrDefault() as EmployeeShell) ) { } } }