BanListLine.xaml.cs 973 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Content.Shared.Administration.BanList;
  2. using Robust.Client.AutoGenerated;
  3. using Robust.Client.UserInterface.Controls;
  4. using Robust.Client.UserInterface.XAML;
  5. using static Robust.Client.UserInterface.Controls.BaseButton;
  6. namespace Content.Client.Administration.UI.BanList.Bans;
  7. [GenerateTypedNameReferences]
  8. public sealed partial class BanListLine : BoxContainer, IBanListLine<SharedServerBan>
  9. {
  10. public SharedServerBan Ban { get; }
  11. public event Action<BanListLine>? IdsClicked;
  12. public BanListLine(SharedServerBan ban)
  13. {
  14. RobustXamlLoader.Load(this);
  15. Ban = ban;
  16. IdsHidden.OnPressed += IdsPressed;
  17. BanListEui.SetData(this, ban);
  18. }
  19. private void IdsPressed(ButtonEventArgs buttonEventArgs)
  20. {
  21. IdsClicked?.Invoke(this);
  22. }
  23. protected override void Dispose(bool disposing)
  24. {
  25. base.Dispose(disposing);
  26. IdsHidden.OnPressed -= IdsPressed;
  27. IdsClicked = null;
  28. }
  29. }