From 1cdfb21bddb40f8e1ddc38a488e0f3b8b886e109 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sat, 21 Dec 2024 00:22:35 -0500 Subject: [PATCH] provide the title of the page in the resulting JSON --- .../lib/Mocha.Core.UI.Server/Commands/ElementCommand.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mocha-dotnet/src/lib/Mocha.Core.UI.Server/Commands/ElementCommand.cs b/mocha-dotnet/src/lib/Mocha.Core.UI.Server/Commands/ElementCommand.cs index 18e772a..9f89b65 100644 --- a/mocha-dotnet/src/lib/Mocha.Core.UI.Server/Commands/ElementCommand.cs +++ b/mocha-dotnet/src/lib/Mocha.Core.UI.Server/Commands/ElementCommand.cs @@ -75,6 +75,15 @@ public class ElementCommand : InstanceCommand obj2.Add("widget", JsonValue.Create("root")); obj2.Add("body", widget.ToJSONObject(ctx)); + JsonObject objTitle = new JsonObject(); + string label = oms.GetAttributeValue(widget.ParentInstance, oms.GetInstance(KnownAttributeGuids.Text.Label)); + if (label == null) + { + label = oms.GetInstanceText(widget.ParentInstance); + } + objTitle.Add("label", label); + obj2.Add("title", objTitle); + JsonObject obj = new JsonObject(); obj.Add("result", "success"); obj.Add("value", obj2);