ReadyToGoPanel.xaml.cs 2.0 KB

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