RoleBanListLine.xaml.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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.RoleBans;
  7. [GenerateTypedNameReferences]
  8. public sealed partial class RoleBanListLine : BoxContainer, IBanListLine<SharedServerRoleBan>
  9. {
  10. public SharedServerRoleBan Ban { get; }
  11. public event Action<RoleBanListLine>? IdsClicked;
  12. public RoleBanListLine(SharedServerRoleBan ban)
  13. {
  14. RobustXamlLoader.Load(this);
  15. Ban = ban;
  16. IdsHidden.OnPressed += IdsPressed;
  17. BanListEui.SetData(this, ban);
  18. Role.Text = ban.Role;
  19. }
  20. private void IdsPressed(ButtonEventArgs buttonEventArgs)
  21. {
  22. IdsClicked?.Invoke(this);
  23. }
  24. protected override void Dispose(bool disposing)
  25. {
  26. base.Dispose(disposing);
  27. IdsHidden.OnPressed -= IdsPressed;
  28. IdsClicked = null;
  29. }
  30. }