using System; using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; using Comal.Classes; using InABox.Core; namespace PRSDesktop { public partial class CustomerPanel : UserControl, IPanel { private readonly CustomerGrid Customers; public CustomerPanel() { InitializeComponent(); Customers = new CustomerGrid { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Margin = new Thickness(0) }; AddChild(Customers); } public bool IsReady { get; set; } public event DataModelUpdateEvent OnUpdateDataModel; public Dictionary Selected() { return new Dictionary { { typeof(Customer).EntityName(), Customers.SelectedRows } }; } public void Setup() { } public void Shutdown() { } public void CreateToolbarButtons(IPanelHost host) { //host.CreateToolbarButton(new PanelAction() { Caption = "Select Columns", OnExecute = DoSelectColumns, Image = PRSDesktop.Resources.shared }); } public void Refresh() { Customers.Refresh(true, true); } public string SectionName => "Customers"; public DataModel DataModel(Selection selection) { var ids = Customers.ExtractValues(x => x.ID, selection).ToArray(); return new BaseDataModel(new Filter(x => x.ID).InList(ids)); } public void Heartbeat(TimeSpan time) { } public Type DataType() { return typeof(Customer); } } }