From ea440929191df8edf4a9d19f0630211155ddb7a4 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 10 Nov 2025 16:21:38 +0100 Subject: [PATCH] nizio test sub components x update a cascata --- Test.UI/Components/Compo/ChildNoLoad.razor | 13 +++++ Test.UI/Components/Compo/ChildNoLoad.razor.cs | 38 ++++++++++++++ Test.UI/Components/Compo/ChildObj.razor | 16 ++++++ Test.UI/Components/Compo/ChildObj.razor.cs | 46 +++++++++++++++++ Test.UI/Components/Layout/NavMenu.razor | 5 ++ Test.UI/Components/Pages/UiTest.razor | 50 +++++++++++++++++++ Test.UI/Components/Pages/UiTest.razor.cs | 50 +++++++++++++++++++ .../WebWindowConfigurator.csproj | 16 +++++- 8 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 Test.UI/Components/Compo/ChildNoLoad.razor create mode 100644 Test.UI/Components/Compo/ChildNoLoad.razor.cs create mode 100644 Test.UI/Components/Compo/ChildObj.razor create mode 100644 Test.UI/Components/Compo/ChildObj.razor.cs create mode 100644 Test.UI/Components/Pages/UiTest.razor create mode 100644 Test.UI/Components/Pages/UiTest.razor.cs diff --git a/Test.UI/Components/Compo/ChildNoLoad.razor b/Test.UI/Components/Compo/ChildNoLoad.razor new file mode 100644 index 0000000..2898fec --- /dev/null +++ b/Test.UI/Components/Compo/ChildNoLoad.razor @@ -0,0 +1,13 @@ + +
+
+

@Name

+
+
+
@Message
+ @LocalInfo + + + +
+
\ No newline at end of file diff --git a/Test.UI/Components/Compo/ChildNoLoad.razor.cs b/Test.UI/Components/Compo/ChildNoLoad.razor.cs new file mode 100644 index 0000000..3d8a8c6 --- /dev/null +++ b/Test.UI/Components/Compo/ChildNoLoad.razor.cs @@ -0,0 +1,38 @@ +using Microsoft.AspNetCore.Components; + +namespace Test.UI.Components.Compo +{ + public partial class ChildNoLoad + { + #region Public Properties + + [Parameter] + public string CssClass { get; set; } = ""; + + [Parameter] + public string Message { get; set; } = ""; + + [Parameter] + public string Name { get; set; } = "NONE"; + + + #endregion Public Properties + + #region Protected Fields + + protected string LocalInfo = ""; + protected string SubName = ""; + + #endregion Protected Fields + + #region Protected Methods + + protected override void OnParametersSet() + { + LocalInfo = $"Updated on {DateTime.Now:HH:ss.fff}"; + SubName = $"Child of {Name}"; + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/Test.UI/Components/Compo/ChildObj.razor b/Test.UI/Components/Compo/ChildObj.razor new file mode 100644 index 0000000..d6ede5e --- /dev/null +++ b/Test.UI/Components/Compo/ChildObj.razor @@ -0,0 +1,16 @@ +@if (IsLoading) +{ + +} +else +{ +
+
+

@Name

+
+
+
@Message
+ @LocalInfo +
+
+} \ No newline at end of file diff --git a/Test.UI/Components/Compo/ChildObj.razor.cs b/Test.UI/Components/Compo/ChildObj.razor.cs new file mode 100644 index 0000000..6693058 --- /dev/null +++ b/Test.UI/Components/Compo/ChildObj.razor.cs @@ -0,0 +1,46 @@ +using Microsoft.AspNetCore.Components; + +namespace Test.UI.Components.Compo +{ + public partial class ChildObj + { + #region Public Properties + + [Parameter] + public string CssClass { get; set; } = ""; + + [Parameter] + public string Message { get; set; } = ""; + + [Parameter] + public string Name { get; set; } = "NONE"; + + [Parameter] + public string LoadPar { get; set; } = ""; + + [CascadingParameter(Name = "CurrLoading")] + public List CurrLoading { get; set; } + + #endregion Public Properties + + #region Protected Fields + + protected string LocalInfo = ""; + + #endregion Protected Fields + + #region Protected Methods + + protected override void OnParametersSet() + { + LocalInfo = $"Updated on {DateTime.Now:HH:ss.fff}"; + } + + private bool IsLoading + { + get => CurrLoading != null && CurrLoading.Count > 0 && CurrLoading.Contains(LoadPar); + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/Test.UI/Components/Layout/NavMenu.razor b/Test.UI/Components/Layout/NavMenu.razor index 0e43fd4..44e7876 100644 --- a/Test.UI/Components/Layout/NavMenu.razor +++ b/Test.UI/Components/Layout/NavMenu.razor @@ -47,6 +47,11 @@ Aedifica + diff --git a/Test.UI/Components/Pages/UiTest.razor b/Test.UI/Components/Pages/UiTest.razor new file mode 100644 index 0000000..a266bbb --- /dev/null +++ b/Test.UI/Components/Pages/UiTest.razor @@ -0,0 +1,50 @@ +@page "/uitest" +@* @attribute [StreamRendering] *@ +@rendermode InteractiveServer + +UI test + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ @if (isLoading.Count > 0) + { + + } +
+
\ No newline at end of file diff --git a/Test.UI/Components/Pages/UiTest.razor.cs b/Test.UI/Components/Pages/UiTest.razor.cs new file mode 100644 index 0000000..bd19f53 --- /dev/null +++ b/Test.UI/Components/Pages/UiTest.razor.cs @@ -0,0 +1,50 @@ +namespace Test.UI.Components.Pages +{ + public partial class UiTest + { + #region Protected Fields + + protected List isLoading = new List(); + + #endregion Protected Fields + + #region Protected Methods + + protected async Task DoReload() + { + isLoading = new List(); + if (loadHwOpt) + isLoading.Add("loadHwOpt"); + if (loadPng) + isLoading.Add("loadPng"); + if (loadShape) + isLoading.Add("loadShape"); + if (loadSvg) + isLoading.Add("loadSvg"); + + while (isLoading.Count > 0) + { + delay = rnd.Next(600, 1000); + await Task.Delay(delay); + int i2rem = rnd.Next(isLoading.Count); + isLoading.RemoveAt(i2rem); + } + isLoading = new List(); + } + + #endregion Protected Methods + + #region Private Fields + + private int delay = 0; + + private Random rnd = new Random(); + + private bool loadSvg = false; + private bool loadPng = false; + private bool loadShape = false; + private bool loadHwOpt = false; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index dffea52..4e7b3ea 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.1015 + 2.7.11.1016 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -50,6 +50,20 @@ + + + + + + + + + + + + + +