diff --git a/MP.AppAuth/Services/AppAuthService.cs b/MP.AppAuth/Services/AppAuthService.cs index 7a05fa57..cef52a0a 100644 --- a/MP.AppAuth/Services/AppAuthService.cs +++ b/MP.AppAuth/Services/AppAuthService.cs @@ -431,8 +431,14 @@ namespace MP.AppAuth.Services public void Dispose() { // Clear database controller - dbController.Dispose(); - MpDbController.Dispose(); + if (dbController != null) + { + dbController.Dispose(); + } + if (MpDbController != null) + { + MpDbController.Dispose(); + } } public async Task FlushRedisCache() diff --git a/MP.Data/Services/MessageService.cs b/MP.Data/Services/MessageService.cs index 54d5b5e1..38d4db11 100644 --- a/MP.Data/Services/MessageService.cs +++ b/MP.Data/Services/MessageService.cs @@ -1,8 +1,4 @@ -#if false -using Blazored.LocalStorage; -using Blazored.SessionStorage; -#endif -using EgwCoreLib.Utils; +using EgwCoreLib.Utils; using Microsoft.Extensions.Configuration; using MP.Data.DbModels; using MP.Data.DTO; @@ -186,6 +182,9 @@ namespace MP.Data.Services } } + public string PageName; + public string PageIcon; + /// /// Diritti utente (solo Funzione/Ruolo) /// diff --git a/MP.IOC/Components/Compo/CmpFooter.razor b/MP.IOC/Components/Compo/CmpFooter.razor index b8b9c64f..d7358660 100644 --- a/MP.IOC/Components/Compo/CmpFooter.razor +++ b/MP.IOC/Components/Compo/CmpFooter.razor @@ -1,10 +1,10 @@ 
- MP.Land v.@version + MP-IOC v.@version
@adesso - Egalware   + Egalware  
diff --git a/MP.IOC/Components/Compo/CmpTop.razor b/MP.IOC/Components/Compo/CmpTop.razor index 8a818717..8bbc8aa2 100644 --- a/MP.IOC/Components/Compo/CmpTop.razor +++ b/MP.IOC/Components/Compo/CmpTop.razor @@ -1,10 +1,7 @@ -@using MP.Land.Components -@using System.Security.Claims - +
- @**@ @userName
@@ -13,7 +10,7 @@
@if (ShowSearch) { - + @* *@ }
diff --git a/MP.IOC/Components/Compo/CmpTop.razor.cs b/MP.IOC/Components/Compo/CmpTop.razor.cs index 7522187d..11f6f5ca 100644 --- a/MP.IOC/Components/Compo/CmpTop.razor.cs +++ b/MP.IOC/Components/Compo/CmpTop.razor.cs @@ -1,10 +1,7 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Authorization; -using MP.Land.Data; -using System; -using System.Threading.Tasks; -namespace MP.Land.Components +namespace MP.IOC.Components.Compo { public partial class CmpTop : IDisposable { @@ -12,36 +9,20 @@ namespace MP.Land.Components public void Dispose() { - AppMessages.EA_PageUpdated -= OnPageUpdate; GC.Collect(); } - public void OnPageUpdate() - { - PageName = AppMessages.PageName; - PageIcon = AppMessages.PageIcon; - InvokeAsync(() => - { - StateHasChanged(); - }); - } - #endregion Public Methods #region Protected Properties [Inject] - protected LMessageService AppMessages { get; set; } = null!; + protected AuthenticationStateProvider AuthenticationStateProvider { get; set; } = null!; #endregion Protected Properties #region Protected Methods - protected override void OnInitialized() - { - AppMessages.EA_PageUpdated += OnPageUpdate; - } - protected override async Task OnInitializedAsync() { await forceReload(); diff --git a/MP.IOC/Components/Layout/MainLayout.razor b/MP.IOC/Components/Layout/MainLayout.razor index d3002fcb..2f7e6743 100644 --- a/MP.IOC/Components/Layout/MainLayout.razor +++ b/MP.IOC/Components/Layout/MainLayout.razor @@ -1,20 +1,12 @@ @inherits LayoutComponentBase -@using MP.Land.Data -@using MP.Land.Components - -@inject LMessageService AppMService -@inject LicenseService LicServ -@implements IDisposable - -MP-LAND +MP-IOC
- +
-
@@ -22,10 +14,9 @@
@Body
-
+
-
diff --git a/MP.IOC/Components/Layout/MainLayout.razor.cs b/MP.IOC/Components/Layout/MainLayout.razor.cs index 9b4f8844..7c5a26c2 100644 --- a/MP.IOC/Components/Layout/MainLayout.razor.cs +++ b/MP.IOC/Components/Layout/MainLayout.razor.cs @@ -1,39 +1,22 @@ -using Microsoft.AspNetCore.Components; -using MP.AppAuth.Services; -using MP.Land.Data; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace MP.Land.Shared +namespace MP.IOC.Components.Layout { - public partial class MainLayout + public partial class MainLayout : IDisposable { #region Public Methods public void Dispose() { - AppMService.EA_ShowSearch -= OnShowSearch; - AppMService.EA_ShowSearch -= OnHideSearch; GC.Collect(); } public void OnHideSearch() { ShowSearch = false; - InvokeAsync(() => - { - StateHasChanged(); - }); } public void OnShowSearch() { ShowSearch = true; - InvokeAsync(() => - { - StateHasChanged(); - }); } #endregion Public Methods @@ -44,9 +27,6 @@ namespace MP.Land.Shared protected string cssRow { get; set; } = "bottom-row bg-primary"; - [Inject] - protected AppAuthService DataService { get; set; } - protected bool navLarge { get; set; } = true; protected string sideClass { get; set; } = "sidebar"; @@ -55,24 +35,6 @@ namespace MP.Land.Shared #region Protected Methods - protected override async Task OnInitializedAsync() - { - AppMService.EA_ShowSearch += OnShowSearch; - AppMService.EA_HideSearch += OnHideSearch; - AppMService.EA_UpdateLic += SetYrAuth; - await Task.Delay(1); - } - - protected void SetYrAuth() - { - annualAuthOk = AppMService.YearAuth; - cssRow = annualAuthOk ? "bottom-row" : "bottom-row bg-danger"; - InvokeAsync(() => - { - StateHasChanged(); - }); - } - protected void UpdateNavDisplay() { navLarge = !navLarge; diff --git a/MP.IOC/Components/Layout/NavMenu.razor b/MP.IOC/Components/Layout/NavMenu.razor index 519ba0ba..955270ba 100644 --- a/MP.IOC/Components/Layout/NavMenu.razor +++ b/MP.IOC/Components/Layout/NavMenu.razor @@ -2,11 +2,11 @@
@if (!showText) { - MP.L + MP } else { - MP.Land + MP.IOC }