using System; using System.Linq; using Xamarin.Forms; namespace comal.timesheets { public class ProductSelectionPage : SelectionPage { public ProductSelectionPage(Action action) : base( (string)"Select Product", (SelectionPageMode)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.Products.Refresh(refresh), (items) => action?.Invoke(items.FirstOrDefault() as ProductShell) ) { } } }