123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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<Customer>
- {
- 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<string, object[]> Selected()
- {
- return new Dictionary<string, object[]> { { 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<Customer>(new Filter<Customer>(x => x.ID).InList(ids));
- }
- public void Heartbeat(TimeSpan time)
- {
- }
- public Type DataType()
- {
- return typeof(Customer);
- }
- }
- }
|