From cb8ca635ec2cba0a03bf9d1560734cd657b4a727 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 27 Sep 2024 16:25:01 +0200 Subject: [PATCH] ACC: - CleanUp codice YAML: - continuo fix pipeline --- .gitlab-ci.yml | 62 ++++++++++++++----- EgwControlCenter.App/BlazorForm.cs | 42 ++++++++----- .../Components/Pages/Index.razor.cs | 6 -- .../EgwControlCenter.App.csproj | 2 +- .../PublishProfiles/ClickOnceProfile.pubxml | 4 +- 5 files changed, 74 insertions(+), 42 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b3f7e45..fbccf47 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -142,7 +142,7 @@ UI:build: APP_NAME: LiMan.UI before_script: - *nuget-fix - - dotnet restore $env:SOL_NAME.sln + - dotnet restore "$env:SOL_NAME.sln" script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -157,7 +157,7 @@ API:build: APP_NAME: LiMan.Api before_script: - *nuget-fix - - dotnet restore $env:SOL_NAME.sln + - dotnet restore "$env:SOL_NAME.sln" script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -172,7 +172,7 @@ Transfer:build: APP_NAME: LiMan.Transfer before_script: - *nuget-fix - - dotnet restore $env:SOL_NAME.sln + - dotnet restore "$env:SOL_NAME.sln" script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -187,7 +187,7 @@ EgwProxy.LiMan:build: APP_NAME: EgwProxy.LiMan before_script: - *nuget-fix - - dotnet restore $env:SOL_NAME.sln + - dotnet restore "$env:SOL_NAME.sln" # - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet' script: - echo $CI_COMMIT_BRANCH @@ -204,7 +204,6 @@ EgwControlCenter:build: APP_NAME: EgwControlCenter.App before_script: - *nuget-fix - - echo "$env:SOL_NAME.sln" - dotnet restore "$env:SOL_NAME.sln" script: - echo $CI_COMMIT_BRANCH @@ -217,13 +216,16 @@ UI:IIS01:deploy: stage: deploy tags: - win + variables: + SOL_NAME: LiMan + APP_NAME: LiMan.UI only: - develop needs: ["UI:build"] before_script: - *nuget-fix script: - - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true LiMan.UI/LiMan.UI.csproj + - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj - *zipper - *hashBuild - *nexusUpload @@ -233,14 +235,15 @@ API:IIS01:deploy: tags: - win variables: - APP_NAME: 'LiMan.Api' + SOL_NAME: LiMan + APP_NAME: LiMan.Api only: - develop needs: ["API:build"] before_script: - *nuget-fix script: - - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true LiMan.Api/LiMan.Api.csproj + - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj - *zipper - *hashBuild - *nexusUpload @@ -249,16 +252,20 @@ UI:IIS04:deploy: stage: deploy tags: - win + variables: + SOL_NAME: LiMan + APP_NAME: LiMan.UI only: - main needs: ["UI:build"] before_script: - *nuget-fix script: - - dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true LiMan.UI/LiMan.UI.csproj + - dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj - *zipper - *hashBuild - *nexusUpload + API:IIS04:deploy: stage: deploy tags: @@ -266,14 +273,15 @@ API:IIS04:deploy: except: - EgwAppControlCenter variables: - APP_NAME: 'LiMan.Api' + SOL_NAME: LiMan + APP_NAME: LiMan.Api only: - main needs: ["API:build"] before_script: - *nuget-fix script: - - dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true LiMan.Api/LiMan.Api.csproj + - dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj - *zipper - *hashBuild - *nexusUpload @@ -285,13 +293,14 @@ Transfer:deploy: except: - EgwAppControlCenter variables: + SOL_NAME: LiMan APP_NAME: LiMan.Transfer needs: ["Transfer:build"] before_script: - *nuget-fix script: - - dotnet build LiMan.Transfer/LiMan.Transfer.csproj - - dotnet publish -p:PublishProfile=SingleFileX86.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release LiMan.Transfer/LiMan.Transfer.csproj + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=SingleFileX86.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj - *zipper - *hashBuild - *nexusUpload @@ -312,17 +321,35 @@ EgwProxy.LiMan:deploy: - develop before_script: - *nuget-fix - - '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln" -verbosity quiet' + - dotnet restore "$env:SOL_NAME.sln" + # - '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln" -verbosity quiet' - *version-fix - *nuspec-fix - script: -# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m' + script: - dotnet build "$env:APP_NAME\$env:APP_NAME.csproj" - '& Remove-Item *.nupkg' - '& $env:NUGET_PATH pack "$env:APP_NAME.Debug.nuspec"' - '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted' - '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted' +EgwControlCenter:deploy: + stage: deploy + needs: ["EgwControlCenter:build"] + tags: + - win + only: + - EgwAppControlCenter + variables: + SOL_NAME: EgwControlCenter + APP_NAME: EgwControlCenter.App + before_script: + - *nuget-fix + - dotnet restore "$env:SOL_NAME.sln" + script: + - echo $CI_COMMIT_BRANCH + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=ClickOnceProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj + # -------------------------------- # RELEASE # -------------------------------- @@ -340,7 +367,8 @@ EgwProxy.LiMan:release: - SDK before_script: - *nuget-fix - - '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln" -verbosity quiet' + - dotnet restore "$env:SOL_NAME.sln" + # - '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln" -verbosity quiet' - *version-fix - *nuspec-fix script: diff --git a/EgwControlCenter.App/BlazorForm.cs b/EgwControlCenter.App/BlazorForm.cs index 7cb1437..6c2aa05 100644 --- a/EgwControlCenter.App/BlazorForm.cs +++ b/EgwControlCenter.App/BlazorForm.cs @@ -22,7 +22,7 @@ namespace EgwControlCenter.App CleanOldTrayIcons(); InitBlazorView(); StartTimer(); - ForceReload(); + StartLastAsync(); } #endregion Public Constructors @@ -37,7 +37,6 @@ namespace EgwControlCenter.App private bool forceClose = false; private Size minSize = new Size(676, 409); - private bool showReduced = false; /// /// Periodo di blocco invio nuove notifiche se ci sono + update... @@ -112,20 +111,18 @@ namespace EgwControlCenter.App private void CleanOldTrayIcons() { - string registryPath = @"HKEY_CURRENT_USER\Control Panel\NotifyIconSettings"; Assembly assembly = Assembly.GetExecutingAssembly(); string startDir = Path.GetDirectoryName(assembly.Location)!; string appPath = assembly.ManifestModule.FullyQualifiedName.Replace("dll", "exe"); - RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\NotifyIconSettings", true); - + RegistryKey? key = Registry.CurrentUser.OpenSubKey(@"Control Panel\NotifyIconSettings", true); if (key != null) { foreach (string subKeyName in key.GetSubKeyNames()) { - RegistryKey subKey = key.OpenSubKey(subKeyName); + RegistryKey? subKey = key.OpenSubKey(subKeyName); if (subKey != null) { - string executablePath = subKey.GetValue("ExecutablePath") as string; + string executablePath = subKey.GetValue("ExecutablePath") as string ?? ""; // cerco solo le chaivi di EgwControlCenter.App.exe if (!string.IsNullOrEmpty(executablePath)) { @@ -190,6 +187,16 @@ namespace EgwControlCenter.App blazorWebView1.RootComponents.Add("#app"); } + /// + /// Riavvio il timer... + /// + /// + private void MainAppControlService_EA_ConfigUpdated() + { + timerCheck.Stop(); + StartTimer(); + } + /// /// Verifica se ci siano update da mostrare come notifica in tray /// @@ -274,15 +281,6 @@ namespace EgwControlCenter.App MainAppControlService.EA_StatusUpdated += MainAppControlService_EA_StatusUpdated; MainAppControlService.EA_ConfigUpdated += MainAppControlService_EA_ConfigUpdated; } - /// - /// Riavvio il timer... - /// - /// - private void MainAppControlService_EA_ConfigUpdated() - { - timerCheck.Stop(); - StartTimer(); - } private void SetPosition() { @@ -297,6 +295,18 @@ namespace EgwControlCenter.App notifyIcon1.Text = $"EgalWare's AppControlCenter | {CurrAssembly.Version}"; } + /// + /// init ultime attivitą async + /// + private void StartLastAsync() + { + var pUpd = Task.Run(async () => + { + await ForceReload(); + }); + pUpd.Wait(); + } + private void StartTimer() { timerCheck.Interval = (MainAppControlService.RefreshPeriod * 1000); diff --git a/EgwControlCenter.App/Components/Pages/Index.razor.cs b/EgwControlCenter.App/Components/Pages/Index.razor.cs index 172635c..4c5cc65 100644 --- a/EgwControlCenter.App/Components/Pages/Index.razor.cs +++ b/EgwControlCenter.App/Components/Pages/Index.razor.cs @@ -36,12 +36,6 @@ namespace EgwControlCenter.App.Components.Pages #endregion Protected Methods - #region Private Fields - - private bool isLoading = false; - - #endregion Private Fields - #region Private Properties private bool ReqSetup { get; set; } = false; diff --git a/EgwControlCenter.App/EgwControlCenter.App.csproj b/EgwControlCenter.App/EgwControlCenter.App.csproj index 08503e1..04ff0e6 100644 --- a/EgwControlCenter.App/EgwControlCenter.App.csproj +++ b/EgwControlCenter.App/EgwControlCenter.App.csproj @@ -5,7 +5,7 @@ enable true enable - 1.1.2409.2712 + 1.1.2409.2716 Debug;Release;DEBUG_Local diff --git a/EgwControlCenter.App/Properties/PublishProfiles/ClickOnceProfile.pubxml b/EgwControlCenter.App/Properties/PublishProfiles/ClickOnceProfile.pubxml index e6fc788..7408285 100644 --- a/EgwControlCenter.App/Properties/PublishProfiles/ClickOnceProfile.pubxml +++ b/EgwControlCenter.App/Properties/PublishProfiles/ClickOnceProfile.pubxml @@ -4,8 +4,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - 2712 - 1.1.2409.2712 + 2716 + 1.1.2409.2716 True Release True