PostCodePanel.xaml.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Windows.Controls;
  6. using InABox.Core;
  7. using InABox.DynamicGrid;
  8. using InABox.Wpf;
  9. namespace PRSDesktop;
  10. public partial class PostCodePanel : UserControl, IPanel<Country>
  11. {
  12. public PostCodePanel()
  13. {
  14. InitializeComponent();
  15. }
  16. private void CountryGrid_OnOnSelectItem(object sender, DynamicGridSelectionEventArgs e)
  17. {
  18. StateGrid.CountryId = CountryGrid.SelectedRows.FirstOrDefault()?.Get<Country, Guid>(x => x.ID) ?? Guid.Empty;
  19. StateGrid.Refresh(false,true);
  20. LocalityGrid.StateId = Guid.Empty;
  21. LocalityGrid.Refresh(false,true);
  22. }
  23. private void StateGrid_OnOnSelectItem(object sender, DynamicGridSelectionEventArgs e)
  24. {
  25. LocalityGrid.StateId = StateGrid.SelectedRows.FirstOrDefault()?.Get<State, Guid>(x => x.ID) ?? Guid.Empty;
  26. LocalityGrid.Refresh(false,true);
  27. }
  28. public void Setup()
  29. {
  30. LocalityTree.Refresh(true,false);
  31. CountryGrid.Refresh(true,false);
  32. StateGrid.Refresh(true,false);
  33. LocalityGrid.Refresh(true,false);
  34. }
  35. public void Shutdown(CancelEventArgs? cancel)
  36. {
  37. }
  38. public void Refresh()
  39. {
  40. LocalityTree.Refresh(false,true);
  41. CountryGrid.Refresh(false,true);
  42. StateGrid.Refresh(false,true);
  43. LocalityGrid.Refresh(false,true);
  44. }
  45. public string SectionName { get; }
  46. public DataModel DataModel(Selection selection)
  47. {
  48. return new AutoDataModel<Locality>(null);
  49. }
  50. public event DataModelUpdateEvent? OnUpdateDataModel;
  51. public bool IsReady { get; set; }
  52. public void CreateToolbarButtons(IPanelHost host)
  53. {
  54. }
  55. public Dictionary<string, object[]> Selected()
  56. {
  57. return new Dictionary<string, object[]>();
  58. }
  59. public void Heartbeat(TimeSpan time)
  60. {
  61. }
  62. }