Fax Machine (#11704)
This commit is contained in:
58
Content.Client/Fax/UI/FaxBoundUi.cs
Normal file
58
Content.Client/Fax/UI/FaxBoundUi.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using Content.Shared.Fax;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.Fax.UI;
|
||||
|
||||
public sealed class FaxBoundUi : BoundUserInterface
|
||||
{
|
||||
private FaxWindow? _window;
|
||||
|
||||
public FaxBoundUi(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new FaxWindow();
|
||||
_window.OpenCentered();
|
||||
|
||||
_window.OnClose += Close;
|
||||
_window.SendButtonPressed += OnSendButtonPressed;
|
||||
_window.RefreshButtonPressed += OnRefreshButtonPressed;
|
||||
_window.PeerSelected += OnPeerSelected;
|
||||
}
|
||||
|
||||
private void OnSendButtonPressed()
|
||||
{
|
||||
SendMessage(new FaxSendMessage());
|
||||
}
|
||||
|
||||
private void OnRefreshButtonPressed()
|
||||
{
|
||||
SendMessage(new FaxRefreshMessage());
|
||||
}
|
||||
|
||||
private void OnPeerSelected(string address)
|
||||
{
|
||||
SendMessage(new FaxDestinationMessage(address));
|
||||
}
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
|
||||
if (_window == null || state is not FaxUiState cast)
|
||||
return;
|
||||
|
||||
_window.UpdateState(cast);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if (disposing)
|
||||
_window?.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user