ReadyToGoPanel.xaml.cs 2.0 KB

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