diff --git a/Content.Client/Administration/UI/Tabs/AdminbusTab/AdminbusTab.xaml.cs b/Content.Client/Administration/UI/Tabs/AdminbusTab/AdminbusTab.xaml.cs index 66de8a6417..698880b754 100644 --- a/Content.Client/Administration/UI/Tabs/AdminbusTab/AdminbusTab.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AdminbusTab/AdminbusTab.xaml.cs @@ -14,6 +14,9 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab [GenerateTypedNameReferences] public partial class AdminbusTab : Control { + private EntitySpawnWindow? _entitySpawnWindow; + private TileSpawnWindow? _tileSpawnWindow; + protected override void EnteredTree() { // For the SpawnEntitiesButton and SpawnTilesButton we need to do the press manually @@ -22,22 +25,22 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab SpawnTilesButton.OnPressed += SpawnTilesButtonOnOnPressed; } - private static void SpawnEntitiesButtonOnOnPressed(BaseButton.ButtonEventArgs obj) + private void SpawnEntitiesButtonOnOnPressed(BaseButton.ButtonEventArgs obj) { var manager = IoCManager.Resolve(); - var window = new EntitySpawnWindow(IoCManager.Resolve(), + _entitySpawnWindow ??= new EntitySpawnWindow(IoCManager.Resolve(), IoCManager.Resolve(), IoCManager.Resolve()); - manager.OpenCommand(window); + manager.OpenCommand(_entitySpawnWindow); } - private static void SpawnTilesButtonOnOnPressed(BaseButton.ButtonEventArgs obj) + private void SpawnTilesButtonOnOnPressed(BaseButton.ButtonEventArgs obj) { var manager = IoCManager.Resolve(); - var window = new TileSpawnWindow(IoCManager.Resolve(), + _tileSpawnWindow ??= new TileSpawnWindow(IoCManager.Resolve(), IoCManager.Resolve(), IoCManager.Resolve()); - manager.OpenCommand(window); + manager.OpenCommand(_tileSpawnWindow); } } }