diff --git a/Content.Client/Botany/PlantAnalyzer/PlantAnalyzerBoundUserInterface.cs b/Content.Client/Botany/PlantAnalyzer/PlantAnalyzerBoundUserInterface.cs new file mode 100644 index 0000000000..2cda541c80 --- /dev/null +++ b/Content.Client/Botany/PlantAnalyzer/PlantAnalyzerBoundUserInterface.cs @@ -0,0 +1,42 @@ +using Content.Shared.Botany.PlantAnalyzer; +using JetBrains.Annotations; +using Robust.Client.UserInterface; + +namespace Content.Client.Botany.PlantAnalyzer; + +[UsedImplicitly] +public sealed class PlantAnalyzerBoundUserInterface : BoundUserInterface +{ + [ViewVariables] + private PlantAnalyzerWindow? _window; + + public PlantAnalyzerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + _window = this.CreateWindow(); + _window.Title = EntMan.GetComponent(Owner).EntityName; + _window.Print.OnPressed += _ => Print(); + } + + protected override void ReceiveMessage(BoundUserInterfaceMessage message) + { + if (_window is null + || message is not PlantAnalyzerScannedUserMessage cast) + return; + + _window.Populate(cast); + } + + private void Print() + { + SendMessage(new PlantAnalyzerPrintMessage()); + if (_window is null) + return; + + _window.Print.Disabled = true; + } +} diff --git a/Content.Client/Botany/PlantAnalyzer/PlantAnalyzerWindow.xaml b/Content.Client/Botany/PlantAnalyzer/PlantAnalyzerWindow.xaml new file mode 100644 index 0000000000..1cf01af521 --- /dev/null +++ b/Content.Client/Botany/PlantAnalyzer/PlantAnalyzerWindow.xaml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +