From 73171835f1ee3e1d075615d99097539ecd093759 Mon Sep 17 00:00:00 2001
From: Visne <39844191+Visne@users.noreply.github.com>
Date: Sun, 19 Sep 2021 19:36:09 +0200
Subject: [PATCH] MedicalScannerWindow to XAML UI (#4641)
---
.../UI/MedicalScannerWindow.xaml | 9 ++++++
...Window.cs => MedicalScannerWindow.xaml.cs} | 31 +++++--------------
2 files changed, 17 insertions(+), 23 deletions(-)
create mode 100644 Content.Client/MedicalScanner/UI/MedicalScannerWindow.xaml
rename Content.Client/MedicalScanner/UI/{MedicalScannerWindow.cs => MedicalScannerWindow.xaml.cs} (78%)
diff --git a/Content.Client/MedicalScanner/UI/MedicalScannerWindow.xaml b/Content.Client/MedicalScanner/UI/MedicalScannerWindow.xaml
new file mode 100644
index 0000000000..c0284c1805
--- /dev/null
+++ b/Content.Client/MedicalScanner/UI/MedicalScannerWindow.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/Content.Client/MedicalScanner/UI/MedicalScannerWindow.cs b/Content.Client/MedicalScanner/UI/MedicalScannerWindow.xaml.cs
similarity index 78%
rename from Content.Client/MedicalScanner/UI/MedicalScannerWindow.cs
rename to Content.Client/MedicalScanner/UI/MedicalScannerWindow.xaml.cs
index 6580689045..1c5f0a62fd 100644
--- a/Content.Client/MedicalScanner/UI/MedicalScannerWindow.cs
+++ b/Content.Client/MedicalScanner/UI/MedicalScannerWindow.xaml.cs
@@ -8,35 +8,20 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent;
-using static Robust.Client.UserInterface.Controls.BoxContainer;
using Content.Shared.Damage.Prototypes;
+using Robust.Client.AutoGenerated;
+using Robust.Client.UserInterface.XAML;
namespace Content.Client.MedicalScanner.UI
{
- public class MedicalScannerWindow : SS14Window
+ [GenerateTypedNameReferences]
+ public partial class MedicalScannerWindow : SS14Window
{
- public readonly Button ScanButton;
- private readonly Label _diagnostics;
+ public Button ScanButton => ScanButtonProtected;
public MedicalScannerWindow()
{
- SetSize = (250, 100);
-
- Contents.AddChild(new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical,
- Children =
- {
- (ScanButton = new Button
- {
- Text = Loc.GetString("medical-scanner-window-save-button-text")
- }),
- (_diagnostics = new Label
- {
- Text = string.Empty
- })
- }
- });
+ RobustXamlLoader.Load(this);
}
public void Populate(MedicalScannerBoundUserInterfaceState state)
@@ -47,7 +32,7 @@ namespace Content.Client.MedicalScanner.UI
!state.HasDamage() ||
!IoCManager.Resolve().TryGetEntity(state.Entity.Value, out var entity))
{
- _diagnostics.Text = Loc.GetString("medical-scanner-window-no-patient-data-text");
+ Diagnostics.Text = Loc.GetString("medical-scanner-window-no-patient-data-text");
ScanButton.Disabled = true;
SetSize = (250, 100);
}
@@ -85,7 +70,7 @@ namespace Content.Client.MedicalScanner.UI
text.Append('\n');
}
- _diagnostics.Text = text.ToString();
+ Diagnostics.Text = text.ToString();
ScanButton.Disabled = state.IsScanned;
// TODO MEDICALSCANNER resize window based on the length of text / number of damage types?