Fix salvage magnet UI opening again when activating the console twice (#28010)
This commit is contained in:
@@ -20,10 +20,14 @@ public sealed class SalvageMagnetBoundUserInterface : BoundUserInterface
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
_window = new OfferingWindow();
|
||||
_window.Title = Loc.GetString("salvage-magnet-window-title");
|
||||
_window.OnClose += Close;
|
||||
_window.OpenCenteredLeft();
|
||||
|
||||
if (_window is null)
|
||||
{
|
||||
_window = new OfferingWindow();
|
||||
_window.Title = Loc.GetString("salvage-magnet-window-title");
|
||||
_window.OnClose += Close;
|
||||
_window.OpenCenteredLeft();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
@@ -108,4 +112,15 @@ public sealed class SalvageMagnetBoundUserInterface : BoundUserInterface
|
||||
_window.AddOption(option);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
_window?.Close();
|
||||
_window?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user