diff --git a/MP.Land/Components/CmpTop.razor b/MP.Land/Components/CmpTop.razor index 4c81ffd1..534995a0 100644 --- a/MP.Land/Components/CmpTop.razor +++ b/MP.Land/Components/CmpTop.razor @@ -22,62 +22,7 @@ -@code { - //[CascadingParameter] - //private Task AuthenticationStateTask { get; set; } - - [CascadingParameter(Name = "ShowSearch")] - private bool ShowSearch { get; set; } - - private string userName = ""; - - private string PageName { get; set; } - private string PageIcon { get; set; } - - protected override async Task OnInitializedAsync() - { - await forceReload(); - } - - protected override void OnInitialized() - { - AppMessages.EA_PageUpdated += OnPageUpdate; - } - public void OnPageUpdate() - { - PageName = AppMessages.PageName; - PageIcon = AppMessages.PageIcon; - InvokeAsync(() => - { - StateHasChanged(); - }); - } - - public void Dispose() - { - AppMessages.EA_PageUpdated -= OnPageUpdate; - } - - private async Task forceReload() - { - userName = "N.A."; - await Task.Delay(1); -#if false -var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); -var user = authState.User; - -if (user.Identity.IsAuthenticated) -{ -userName = $"{user.Identity.Name}"; -} -else -{ -userName = "N.A."; -} -#endif - } -} @* // Vedere anche: // https://docs.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-5.0#:~:text=Blazor%20uses%20the%20existing%20ASP.NET%20Core%20authentication%20mechanisms,all%20client-side%20code%20can%20be%20modified%20by%20users diff --git a/MP.Land/Components/CmpTop.razor.cs b/MP.Land/Components/CmpTop.razor.cs new file mode 100644 index 00000000..1706938e --- /dev/null +++ b/MP.Land/Components/CmpTop.razor.cs @@ -0,0 +1,83 @@ +using Microsoft.AspNetCore.Components; +using System; +using System.Threading.Tasks; + +namespace MP.Land.Components +{ + public partial class CmpTop + { + #region Public Methods + + 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 Methods + + protected override void OnInitialized() + { + AppMessages.EA_PageUpdated += OnPageUpdate; + } + + protected override async Task OnInitializedAsync() + { + await forceReload(); + } + + #endregion Protected Methods + + #region Private Fields + + private string userName = ""; + + #endregion Private Fields + + #region Private Properties + + private string PageIcon { get; set; } + + private string PageName { get; set; } + + [CascadingParameter(Name = "ShowSearch")] + private bool ShowSearch { get; set; } + + #endregion Private Properties + + #region Private Methods + + private async Task forceReload() + { + userName = "N.A."; + await Task.Delay(1); +#if false +var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); +var user = authState.User; + +if (user.Identity.IsAuthenticated) +{ +userName = $"{user.Identity.Name}"; +} +else +{ +userName = "N.A."; +} +#endif + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.Land/Components/HomeLink.razor b/MP.Land/Components/HomeLink.razor index e7eaef7e..c95301c7 100644 --- a/MP.Land/Components/HomeLink.razor +++ b/MP.Land/Components/HomeLink.razor @@ -53,79 +53,3 @@ else // disegno box non cliccabile e licenza mancante } -@code { - - [Parameter] - public UpdMan CurrItem { get; set; } - - protected List AKVList - { - get - { - return LicServ.AKVList; - } - set - { - LicServ.AKVList = value; - } - } - - - protected override async Task OnInitializedAsync() - { - // check init AKV - if (AKVList == null || AKVList.Count == 0) - { - AKVList = await DataService.AnagKeyValList(); - LicServ.InitAkv(); - } - } - - - protected string getAKVString(string nomeVar) - { - string answ = ""; - if (AKVList != null) - { - var currRec = AKVList.FirstOrDefault(x => x.NomeVar == nomeVar); - if (currRec != null) - { - answ = currRec.ValString; - } - } - return answ; - } - - protected AnagKeyValueModel getAKVRec(string nomeVar) - { - AnagKeyValueModel answ = new AnagKeyValueModel(); - if (AKVList != null) - { - answ = AKVList.FirstOrDefault(x => x.NomeVar == nomeVar); - } - return answ; - } - - protected bool authOk() - { - bool allOk = !string.IsNullOrEmpty(CurrItem.LicenseKey); - if (allOk) - { - allOk = LicServ.checkLicenseActive(CurrItem.LicenseKey); - } - return allOk; - } - - protected string fullUrl(string relUrl) - { - return $"{Configuration["ServerConf:BaseUrl"]}{relUrl}"; - } - - protected MarkupString traduci(string lemma) - { - MarkupString answ; - string rawHtml = DataService.Traduci(lemma, "IT"); - answ = new MarkupString(rawHtml); - return answ; - } -} \ No newline at end of file diff --git a/MP.Land/Components/HomeLink.razor.cs b/MP.Land/Components/HomeLink.razor.cs new file mode 100644 index 00000000..fee7c062 --- /dev/null +++ b/MP.Land/Components/HomeLink.razor.cs @@ -0,0 +1,109 @@ +using Microsoft.AspNetCore.Components; +using MP.AppAuth.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Land.Components +{ + public partial class HomeLink : IDisposable + { + #region Public Properties + + [Parameter] + public UpdMan CurrItem { get; set; } + + #endregion Public Properties + + #region Public Methods + + public void Dispose() + { + GC.Collect(); + } + + #endregion Public Methods + + #region Protected Properties + + protected List AKVList + { + get + { + return LicServ.AKVList; + } + + set + { + LicServ.AKVList = value; + } + } + + #endregion Protected Properties + + #region Protected Methods + + protected bool authOk() + { + bool allOk = !string.IsNullOrEmpty(CurrItem.LicenseKey); + if (allOk) + { + allOk = LicServ.checkLicenseActive(CurrItem.LicenseKey); + } + + return allOk; + } + + protected string fullUrl(string relUrl) + { + return $"{Configuration["ServerConf:BaseUrl"]}{relUrl}"; + } + + protected AnagKeyValueModel getAKVRec(string nomeVar) + { + AnagKeyValueModel answ = new AnagKeyValueModel(); + if (AKVList != null) + { + answ = AKVList.FirstOrDefault(x => x.NomeVar == nomeVar); + } + + return answ; + } + + protected string getAKVString(string nomeVar) + { + string answ = ""; + if (AKVList != null) + { + var currRec = AKVList.FirstOrDefault(x => x.NomeVar == nomeVar); + if (currRec != null) + { + answ = currRec.ValString; + } + } + + return answ; + } + + protected override async Task OnInitializedAsync() + { + // check init AKV + if (AKVList == null || AKVList.Count == 0) + { + AKVList = await DataService.AnagKeyValList(); + LicServ.InitAkv(); + } + } + + protected MarkupString traduci(string lemma) + { + MarkupString answ; + string rawHtml = DataService.Traduci(lemma, "IT"); + answ = new MarkupString(rawHtml); + return answ; + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index 46488966..f3047c6d 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net6.0 MP.Land - 6.16.2210.2110 + 6.16.2211.0415 diff --git a/MP.Land/Pages/About.razor.cs b/MP.Land/Pages/About.razor.cs index d07f8e45..a423fa16 100644 --- a/MP.Land/Pages/About.razor.cs +++ b/MP.Land/Pages/About.razor.cs @@ -1,40 +1,16 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using System.Net.Http; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Components.Routing; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Components.Web.Virtualization; -using Microsoft.JSInterop; -using MP.Land; -using MP.Land.Shared; -using MP.Land.Data; using NLog; +using System; +using System.Threading.Tasks; namespace MP.Land.Pages { - public partial class About + public partial class About { - private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); - private string Titolo = ""; - private string Messaggio = ""; + #region Public Methods - private string ServerStatus = "SrvState"; - private string Installazione = "Inst"; - private string Applicazione = "App"; - private string Licenze = "#"; - private DateTime Scadenza = DateTime.Today; - private string MastKey = "########################"; + #endregion Public Methods - private string mainCss = "alert alert-info"; - private string remSrvCss = "bg-warning text-secondary"; - private string expDateCss = "bg-warning text-secondary"; - private string licenseCss = "bg-warning text-secondary"; + #region Protected Methods protected override async Task OnInitializedAsync() { @@ -43,6 +19,28 @@ namespace MP.Land.Pages await reloadLicenseData(); } + #endregion Protected Methods + + #region Private Fields + + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + private string Applicazione = "App"; + private string expDateCss = "bg-warning text-secondary"; + private string Installazione = "Inst"; + private string licenseCss = "bg-warning text-secondary"; + private string Licenze = "#"; + private string mainCss = "alert alert-info"; + private string MastKey = "########################"; + private string Messaggio = ""; + private string remSrvCss = "bg-warning text-secondary"; + private DateTime Scadenza = DateTime.Today; + private string ServerStatus = "SrvState"; + private string Titolo = ""; + + #endregion Private Fields + + #region Private Methods + private async Task reloadLicenseData() { int cDelay = 5; @@ -62,7 +60,7 @@ namespace MP.Land.Pages Licenze = $"{LicServ.NumLicDb}/{LicServ.NumLicRemote}"; licenseCss = ""; } - catch(Exception exc) + catch (Exception exc) { licenseCss = "bg-dark text-warning"; Log.Error($"Eccezione in reloadLicenseData:{Environment.NewLine}{exc}"); @@ -86,5 +84,7 @@ namespace MP.Land.Pages AppMService.PageName = "About"; AppMService.PageIcon = "fas fa-info-circle pr-2"; } + + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.Land/Pages/Contacts.razor b/MP.Land/Pages/Contacts.razor index 22c72416..d621d0db 100644 --- a/MP.Land/Pages/Contacts.razor +++ b/MP.Land/Pages/Contacts.razor @@ -69,17 +69,3 @@ -@code { - - protected string Titolo = ""; - protected string Messaggio = ""; - - protected override void OnInitialized() - { - Titolo = "Mapo MES"; - Messaggio = "I nostri contattatti e siti di supporto"; - AppMService.ShowSearch = false; - AppMService.PageName = "Contacts"; - AppMService.PageIcon = "fas fa-envelope pr-2"; - } -} \ No newline at end of file diff --git a/MP.Land/Pages/Contacts.razor.cs b/MP.Land/Pages/Contacts.razor.cs new file mode 100644 index 00000000..7820bac8 --- /dev/null +++ b/MP.Land/Pages/Contacts.razor.cs @@ -0,0 +1,36 @@ +using System; + +namespace MP.Land.Pages +{ + public partial class Contacts : IDisposable + { + #region Public Methods + + public void Dispose() + { + GC.Collect(); + } + + #endregion Public Methods + + #region Protected Fields + + protected string Messaggio = ""; + protected string Titolo = ""; + + #endregion Protected Fields + + #region Protected Methods + + protected override void OnInitialized() + { + Titolo = "Mapo MES"; + Messaggio = "I nostri contattatti e siti di supporto"; + AppMService.ShowSearch = false; + AppMService.PageName = "Contacts"; + AppMService.PageIcon = "fas fa-envelope pr-2"; + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.Land/Pages/Index.razor.cs b/MP.Land/Pages/Index.razor.cs index 89eb18b1..a11764f3 100644 --- a/MP.Land/Pages/Index.razor.cs +++ b/MP.Land/Pages/Index.razor.cs @@ -1,22 +1,23 @@ -using System; +using Microsoft.AspNetCore.Components; +using MP.Land.Data; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using MP.Land.Data; -using MP.Land.Components; -using Microsoft.AspNetCore.Components; -using Microsoft.Extensions.Configuration; -using MP.AppAuth.Models; namespace MP.Land.Pages { - public partial class Index + public partial class Index : IDisposable { - #region Private Fields + #region Public Methods - private List ListRecords; + public void Dispose() + { + ListRecords = null; + GC.Collect(); + } - #endregion Private Fields + #endregion Public Methods #region Protected Fields @@ -63,5 +64,11 @@ namespace MP.Land.Pages } #endregion Protected Methods + + #region Private Fields + + private List ListRecords; + + #endregion Private Fields } } \ No newline at end of file diff --git a/MP.Land/Pages/SysInfo.razor b/MP.Land/Pages/SysInfo.razor index d5cfbb5c..f4e8ffe2 100644 --- a/MP.Land/Pages/SysInfo.razor +++ b/MP.Land/Pages/SysInfo.razor @@ -42,25 +42,25 @@
-
Environment
+ Environment

@Environment

-
Main DB Conf
+ Main DB Conf

@DbNameExample

-
.net framework
+ .net framework

@currHwSwInfo.runtimeImg

-
Main Assembly
+ Main Assembly

@currHwSwInfo.mainAssembly

@@ -81,7 +81,7 @@
-
Server Stats
+ Server Stats

@currHwSwInfo.ServerStats
@@ -89,7 +89,7 @@
-
IIS Stats
+ IIS Stats

@currHwSwInfo.IISStats
@@ -112,7 +112,7 @@
-
Elenco librerie
+ Elenco librerie @currHwSwInfo.numLibraries

@@ -133,51 +133,3 @@

-@code { - - // imposto i vari dati da mostrare a video senza indicare come bypassare... - protected string Titolo = "MAPO System Info"; - protected string Messaggio = "HW & SW details"; - protected HwSwInfo currHwSwInfo = HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()); - - protected string masterLic = ""; - - protected override async Task OnInitializedAsync() - { - await ReloadData(); - } - - protected async Task ReloadData() - { - var akvList = await DataService.AnagKeyValList(); - var licRecord = akvList - .Where(x => x.NomeVar == "MAPO") - .FirstOrDefault(); - if (licRecord != null) - { - masterLic = licRecord.ValString; - } - } - - protected string DbNameExample - { - get - { - string answ = Configuration["ConnectionStrings:DefaultConnection"]; - if (answ.IndexOf(";User ID=") > 0) - { - answ = answ.Substring(0, answ.IndexOf(";User ID=")); - } - return answ; - } - } - protected string Environment - { - get - { - string answ = Configuration["Environment"]; - return answ; - } - } - -} \ No newline at end of file diff --git a/MP.Land/Pages/SysInfo.razor.cs b/MP.Land/Pages/SysInfo.razor.cs new file mode 100644 index 00000000..a899e4f4 --- /dev/null +++ b/MP.Land/Pages/SysInfo.razor.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.Land; +using MP.Land.Shared; +using MP.AppAuth; +using MP.Land.Data; +using Microsoft.Extensions.Configuration; + +namespace MP.Land.Pages +{ + public partial class SysInfo : IDisposable + { + public void Dispose() + { + GC.Collect(); + } + + // imposto i vari dati da mostrare a video senza indicare come bypassare... + protected string Titolo = "MAPO System Info"; + protected string Messaggio = "HW & SW details"; + protected HwSwInfo currHwSwInfo = HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()); + protected string masterLic = ""; + protected override async Task OnInitializedAsync() + { + await ReloadData(); + } + + protected async Task ReloadData() + { + var akvList = await DataService.AnagKeyValList(); + var licRecord = akvList.Where(x => x.NomeVar == "MAPO").FirstOrDefault(); + if (licRecord != null) + { + masterLic = licRecord.ValString; + } + } + + protected string DbNameExample + { + get + { + string answ = Configuration["ConnectionStrings:DefaultConnection"]; + if (answ.IndexOf(";User ID=") > 0) + { + answ = answ.Substring(0, answ.IndexOf(";User ID=")); + } + + return answ; + } + } + + protected string Environment + { + get + { + string answ = Configuration["Environment"]; + return answ; + } + } + } +} \ No newline at end of file diff --git a/MP.Land/Pages/UpdateManager.razor.cs b/MP.Land/Pages/UpdateManager.razor.cs index 5833a384..83737913 100644 --- a/MP.Land/Pages/UpdateManager.razor.cs +++ b/MP.Land/Pages/UpdateManager.razor.cs @@ -10,22 +10,24 @@ using System.Threading.Tasks; namespace MP.Land.Pages { - public partial class UpdateManager + public partial class UpdateManager : IDisposable { - #region Private Fields + #region Public Methods - private List ListRecords; + public void Dispose() + { + ListRecords = null; + GC.Collect(); + } - #endregion Private Fields + #endregion Public Methods #region Protected Fields protected int numDone = 0; protected int numTot = 0; protected int totalCount = 0; - protected double TotalMb = 0; - protected UpdateMan updateManAuth = new UpdateMan("SWDownloader", "viaD@nte16"); #endregion Protected Fields @@ -42,34 +44,12 @@ namespace MP.Land.Pages protected AppAuthService DataService { get; set; } protected string outMessages { get; set; } = ""; - protected int percLoading { get; set; } = 0; - protected bool showProgress { get; set; } = false; protected bool showUpdate { get; set; } = false; #endregion Protected Properties - #region Private Methods - - private async Task scaricaSingolo(AppAuth.Models.UpdMan item) - { - long size = 0; - if (item.IsAuth) - { - size = updateManAuth.downloadLatest(item.ManifestUrl, localPath(item.LocalRepo), item.PackName); - } - else - { - size = UpdateMan.obj.downloadLatest(item.ManifestUrl, localPath(item.LocalRepo), item.PackName); - } - numDone++; - percLoading = 100 * numDone / numTot; - return await Task.FromResult(size); - } - - #endregion Private Methods - #region Protected Methods /// @@ -151,5 +131,31 @@ namespace MP.Land.Pages } #endregion Protected Methods + + #region Private Fields + + private List ListRecords; + + #endregion Private Fields + + #region Private Methods + + private async Task scaricaSingolo(AppAuth.Models.UpdMan item) + { + long size = 0; + if (item.IsAuth) + { + size = updateManAuth.downloadLatest(item.ManifestUrl, localPath(item.LocalRepo), item.PackName); + } + else + { + size = UpdateMan.obj.downloadLatest(item.ManifestUrl, localPath(item.LocalRepo), item.PackName); + } + numDone++; + percLoading = 100 * numDone / numTot; + return await Task.FromResult(size); + } + + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.Land/Pages/UserQr.razor.cs b/MP.Land/Pages/UserQr.razor.cs index fc85f926..61b68363 100644 --- a/MP.Land/Pages/UserQr.razor.cs +++ b/MP.Land/Pages/UserQr.razor.cs @@ -16,6 +16,9 @@ namespace MP.Land.Pages public void Dispose() { AppMService.EA_SearchUpdated -= OnSeachUpdated; + AppMService.EA_FilterUpdated -= OnFilterUpdated; + ListRecords = null; + GC.Collect(); } #endregion Public Methods diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index 16b19149..36121c06 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO -

Versione: 6.16.2210.2110

+

Versione: 6.16.2211.0415


Note di rilascio:
    diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index 148d3a17..dd77557b 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2210.2110 +6.16.2211.0415 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index 06b6c830..e664437e 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2210.2110 + 6.16.2211.0415 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false diff --git a/MP.Land/Shared/MainLayout.razor b/MP.Land/Shared/MainLayout.razor index 8af3c918..e316dc69 100644 --- a/MP.Land/Shared/MainLayout.razor +++ b/MP.Land/Shared/MainLayout.razor @@ -26,35 +26,3 @@
-@code { - bool ShowSearch { get; set; } = false; - - protected override void OnInitialized() - { - AppMService.EA_ShowSearch += OnShowSearch; - AppMService.EA_HideSearch += OnHideSearch; - } - public void OnShowSearch() - { - ShowSearch = true; - InvokeAsync(() => - { - StateHasChanged(); - }); - } - public void OnHideSearch() - { - ShowSearch = false; - InvokeAsync(() => - { - StateHasChanged(); - }); - } - - public void Dispose() - { - AppMService.EA_ShowSearch -= OnShowSearch; - AppMService.EA_ShowSearch -= OnHideSearch; - } - -} \ No newline at end of file diff --git a/MP.Land/Shared/MainLayout.razor.cs b/MP.Land/Shared/MainLayout.razor.cs new file mode 100644 index 00000000..ca9bc211 --- /dev/null +++ b/MP.Land/Shared/MainLayout.razor.cs @@ -0,0 +1,52 @@ +using System; + +namespace MP.Land.Shared +{ + public partial class MainLayout + { + #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 + + #region Protected Methods + + protected override void OnInitialized() + { + AppMService.EA_ShowSearch += OnShowSearch; + AppMService.EA_HideSearch += OnHideSearch; + } + + #endregion Protected Methods + + #region Private Properties + + private bool ShowSearch { get; set; } = false; + + #endregion Private Properties + } +} \ No newline at end of file