ReadyToGoPanel.xaml.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows;
  5. using System.Windows.Controls;
  6. using System.Windows.Input;
  7. using Comal.Classes;
  8. using InABox.Core;
  9. namespace PRSDesktop
  10. {
  11. /// <summary>
  12. /// Interaction logic for ItemsPanel.xaml
  13. /// </summary>
  14. public partial class ReadyToGoPanel : UserControl, IPanel<DeliveryItem>
  15. {
  16. public ReadyToGoPanel()
  17. {
  18. InitializeComponent();
  19. }
  20. public bool IsReady { get; set; }
  21. public event DataModelUpdateEvent OnUpdateDataModel;
  22. public Dictionary<string, object[]> Selected()
  23. {
  24. return new Dictionary<string, object[]>(); // { { typeof(DeliveryItem).EntityName(), Items.SelectedRows } };
  25. }
  26. public void Setup()
  27. {
  28. Items.Refresh(true, false);
  29. }
  30. public void Shutdown()
  31. {
  32. }
  33. public void CreateToolbarButtons(IPanelHost host)
  34. {
  35. }
  36. public void Refresh()
  37. {
  38. Items.Refresh(false, true);
  39. }
  40. public string SectionName => "Ready To Go";
  41. public DataModel DataModel(Selection selection)
  42. {
  43. var ids = Items.ExtractValues(x => x.ID, selection).ToArray();
  44. return new DeliveryItemDataModel(new Filter<DeliveryItem>(x => x.ID).InList(ids));
  45. }
  46. public void Heartbeat(TimeSpan time)
  47. {
  48. }
  49. public Type DataType()
  50. {
  51. return typeof(DeliveryItem);
  52. }
  53. private void SearchBox_KeyUp(object sender, KeyEventArgs e)
  54. {
  55. if (e.Key == Key.Enter)
  56. {
  57. Items.Search = SearchBox.Text;
  58. Items.Refresh(false, true);
  59. }
  60. }
  61. private void ClearSearchButton_Click(object sender, RoutedEventArgs e)
  62. {
  63. Items.Search = "";
  64. Items.Refresh(false, true);
  65. }
  66. }
  67. }