1
0

GeneralStationRecordConsoleBoundUserInterface.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using Content.Shared.StationRecords;
  2. using Robust.Client.UserInterface;
  3. namespace Content.Client.StationRecords;
  4. public sealed class GeneralStationRecordConsoleBoundUserInterface : BoundUserInterface
  5. {
  6. [ViewVariables]
  7. private GeneralStationRecordConsoleWindow? _window = default!;
  8. public GeneralStationRecordConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
  9. {
  10. }
  11. protected override void Open()
  12. {
  13. base.Open();
  14. _window = this.CreateWindow<GeneralStationRecordConsoleWindow>();
  15. _window.OnKeySelected += key =>
  16. SendMessage(new SelectStationRecord(key));
  17. _window.OnFiltersChanged += (type, filterValue) =>
  18. SendMessage(new SetStationRecordFilter(type, filterValue));
  19. _window.OnDeleted += id => SendMessage(new DeleteStationRecord(id));
  20. }
  21. protected override void UpdateState(BoundUserInterfaceState state)
  22. {
  23. base.UpdateState(state);
  24. if (state is not GeneralStationRecordConsoleState cast)
  25. return;
  26. _window?.UpdateState(cast);
  27. }
  28. }