ServerTab.xaml.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Content.Shared.CCVar;
  2. using Robust.Client.AutoGenerated;
  3. using Robust.Client.UserInterface;
  4. using Robust.Client.UserInterface.XAML;
  5. using Robust.Shared.Configuration;
  6. namespace Content.Client.Administration.UI.Tabs
  7. {
  8. [GenerateTypedNameReferences]
  9. public sealed partial class ServerTab : Control
  10. {
  11. [Dependency] private readonly IConfigurationManager _config = default!;
  12. public ServerTab()
  13. {
  14. RobustXamlLoader.Load(this);
  15. IoCManager.InjectDependencies(this);
  16. _config.OnValueChanged(CCVars.OocEnabled, OocEnabledChanged, true);
  17. _config.OnValueChanged(CCVars.LoocEnabled, LoocEnabledChanged, true);
  18. }
  19. private void OocEnabledChanged(bool value)
  20. {
  21. SetOocButton.Pressed = value;
  22. }
  23. private void LoocEnabledChanged(bool value)
  24. {
  25. SetLoocButton.Pressed = value;
  26. }
  27. protected override void Dispose(bool disposing)
  28. {
  29. base.Dispose(disposing);
  30. if (disposing)
  31. {
  32. _config.UnsubValueChanged(CCVars.OocEnabled, OocEnabledChanged);
  33. _config.UnsubValueChanged(CCVars.LoocEnabled, LoocEnabledChanged);
  34. }
  35. }
  36. }
  37. }