From b3cfb693acbfdecce7340fd6621596fbae625edb Mon Sep 17 00:00:00 2001 From: Peter Kurhajec <61538034+PTKu@users.noreply.github.com> Date: Wed, 28 Jan 2026 11:33:02 +0100 Subject: [PATCH 1/2] Support culture-aware Onliner values and labels Updated value retrieval to use culture-specific methods for OnlinerBase types, ensuring string values respect the current UI culture and other types use the invariant culture. The label generation now also uses the current UI culture for attribute names. Added System.Globalization import to enable these changes. --- .../Templates/TemplateBase.razor.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/AXSharp.blazor/src/AXSharp.Presentation.Blazor.Controls/Templates/TemplateBase.razor.cs b/src/AXSharp.blazor/src/AXSharp.Presentation.Blazor.Controls/Templates/TemplateBase.razor.cs index 14271eb8..62770d11 100644 --- a/src/AXSharp.blazor/src/AXSharp.Presentation.Blazor.Controls/Templates/TemplateBase.razor.cs +++ b/src/AXSharp.blazor/src/AXSharp.Presentation.Blazor.Controls/Templates/TemplateBase.razor.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading.Tasks; using AXSharp.Connector; +using System.Globalization; namespace AXSharp.Presentation.Blazor.Controls.Templates @@ -15,7 +16,7 @@ namespace AXSharp.Presentation.Blazor.Controls.Templates public abstract class TemplateBase : RenderableComponentBase { protected string ToolTipOrHumanReadable => string.IsNullOrEmpty(Onliner.AttributeToolTip) - ? Onliner.HumanReadable + ? Onliner.GetHumanReadable(CultureInfo.CurrentUICulture) : Onliner.AttributeToolTip; protected string Symbol => Onliner.Symbol; @@ -52,8 +53,16 @@ protected T Value { if (!HasFocus) { - LastValue = Onliner.Cyclic; // if is only readed, update LastValue for "HasFocus" case - return Onliner.Cyclic; + switch(Onliner) + { + case OnlinerBase onlinerString: + LastValue = (T)(object)onlinerString.GetCyclic(CultureInfo.CurrentUICulture); + break; + case OnlinerBase onliner: + LastValue = onliner.Cyclic; + break; + } + return LastValue; } else { @@ -78,9 +87,13 @@ protected override Task OnInitializedAsync() return base.OnInitializedAsync(); } + /// + /// Gets the label for the control based on the Onliner's attribute name and units. + /// + /// protected string GetLabel() { - return Onliner.AttributeName + (string.IsNullOrWhiteSpace(Onliner.AttributeUnits) ? null : $" [{Onliner.AttributeUnits}]"); + return Onliner.GetAttributeName(CultureInfo.CurrentUICulture) + (string.IsNullOrWhiteSpace(Onliner.AttributeUnits) ? null : $" [{Onliner.AttributeUnits}]"); } } } From 08d461628a577016d8d3c76bb6efeff11e985762 Mon Sep 17 00:00:00 2001 From: Peter Kurhajec <61538034+PTKu@users.noreply.github.com> Date: Wed, 28 Jan 2026 11:35:07 +0100 Subject: [PATCH 2/2] Enhance TemplateBase with new props and documentation Added properties for tooltip, symbol, and various [Parameter] options (Onliner, IsReadOnly, HideLabel, Unit, Format) to TemplateBase. Introduced or documented protected properties LastValue and Value. Included XML documentation and System.Globalization usage for culture-aware formatting. These changes improve configurability and code clarity. --- .../Templates/TemplateBase.razor.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/AXSharp.blazor/src/AXSharp.Presentation.Blazor.Controls/Templates/TemplateBase.razor.cs b/src/AXSharp.blazor/src/AXSharp.Presentation.Blazor.Controls/Templates/TemplateBase.razor.cs index 62770d11..804e7b8b 100644 --- a/src/AXSharp.blazor/src/AXSharp.Presentation.Blazor.Controls/Templates/TemplateBase.razor.cs +++ b/src/AXSharp.blazor/src/AXSharp.Presentation.Blazor.Controls/Templates/TemplateBase.razor.cs @@ -15,10 +15,16 @@ namespace AXSharp.Presentation.Blazor.Controls.Templates { public abstract class TemplateBase : RenderableComponentBase { + /// + /// Gets the tooltip or human readable name of the Onliner. + /// protected string ToolTipOrHumanReadable => string.IsNullOrEmpty(Onliner.AttributeToolTip) ? Onliner.GetHumanReadable(CultureInfo.CurrentUICulture) : Onliner.AttributeToolTip; + /// + /// Gets the symbol of the Onliner. + /// protected string Symbol => Onliner.Symbol; private IJSObjectReference? module; @@ -30,23 +36,44 @@ public IJSRuntime JSRuntime set; } + /// + /// The Onliner associated with this template. + /// [Parameter] public virtual OnlinerBase Onliner { get; set; } + /// + /// Indicates whether the control is read-only. + /// [Parameter] public bool IsReadOnly { get; set; } + /// + /// Indicates whether the label should be hidden. + /// [Parameter] public bool HideLabel { get; set; } = false; + /// + /// The unit of measurement for the value. + /// [Parameter] public string? Unit { get; set; } + /// + /// The format string for displaying the value. + /// [Parameter] public string? Format { get; set; } + /// + /// The last known value of the Onliner. + /// protected T LastValue { get; set; } + /// + /// Gets or sets the current value of the Onliner. + /// protected T Value { get