diff --git a/.forgejo/workflows/build-windows-avalonia.yml b/.forgejo/workflows/build-windows-avalonia.yml index 3d3c18e..4666242 100644 --- a/.forgejo/workflows/build-windows-avalonia.yml +++ b/.forgejo/workflows/build-windows-avalonia.yml @@ -14,15 +14,15 @@ env: PROJECT_PATH: imagecatalog/ImageCatalog 2.csproj PUBLISH_DIR: artifacts/publish/win-x64 ARTIFACT_NAME: imagecatalog-windows-avalonia - NUGET_SOURCE_NAME: Nuget-GitLab-AIFotoONLUS - NUGET_SOURCE_URL: https://gitlab.com/api/v4/projects/79509532/packages/nuget/index.json + NUGET_SOURCE_NAME: Nuget-Forgejo-AIFotoONLUS + NUGET_SOURCE_URL: ${{ vars.AIFOTOONLUS_NUGET_SOURCE_URL || format('{0}/api/packages/{1}/nuget/index.json', github.server_url, vars.AIFOTOONLUS_PACKAGE_OWNER || github.repository_owner) }} jobs: build: runs-on: docker env: - NUGET_USERNAME: ${{ secrets.NUGET_USERNAME }} - NUGET_PASSWORD: ${{ secrets.NUGET_PASSWORD }} + FORGEJO_PACKAGE_USERNAME: ${{ secrets.FORGEJO_PACKAGE_USERNAME }} + FORGEJO_PACKAGE_TOKEN: ${{ secrets.FORGEJO_PACKAGE_TOKEN }} steps: - name: Checkout @@ -36,12 +36,12 @@ jobs: - name: Validate NuGet secrets run: | set -eu - if [ -z "${NUGET_USERNAME}" ]; then - echo "secrets.NUGET_USERNAME is required" + if [ -z "${FORGEJO_PACKAGE_USERNAME}" ]; then + echo "secrets.FORGEJO_PACKAGE_USERNAME is required" exit 1 fi - if [ -z "${NUGET_PASSWORD}" ]; then - echo "secrets.NUGET_PASSWORD is required" + if [ -z "${FORGEJO_PACKAGE_TOKEN}" ]; then + echo "secrets.FORGEJO_PACKAGE_TOKEN is required" exit 1 fi @@ -53,8 +53,8 @@ jobs: dotnet nuget update source "${{ env.NUGET_SOURCE_NAME }}" \ --source "${{ env.NUGET_SOURCE_URL }}" \ - --username "${NUGET_USERNAME}" \ - --password "${NUGET_PASSWORD}" \ + --username "${FORGEJO_PACKAGE_USERNAME}" \ + --password "${FORGEJO_PACKAGE_TOKEN}" \ --store-password-in-clear-text \ --configfile "${temp_config}" diff --git a/Catalog.code-workspace b/Catalog.code-workspace new file mode 100644 index 0000000..36ebf33 --- /dev/null +++ b/Catalog.code-workspace @@ -0,0 +1,13 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../AIFotoONLUS" + } + ], + "settings": { + "commentTranslate.hover.enabled": false + } +} \ No newline at end of file diff --git a/NuGet.Config b/NuGet.Config index 79cf275..e0e2d2b 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -1,25 +1,25 @@ - + - + - - + + diff --git a/imagecatalog/AvaloniaMainWindow.axaml.cs b/imagecatalog/AvaloniaMainWindow.axaml.cs index 2de8d3f..8ebe952 100644 --- a/imagecatalog/AvaloniaMainWindow.axaml.cs +++ b/imagecatalog/AvaloniaMainWindow.axaml.cs @@ -3,6 +3,7 @@ using Avalonia.Interactivity; using Avalonia.Platform.Storage; using Avalonia.Styling; using Avalonia.Threading; +using System.ComponentModel; using System.IO; namespace ImageCatalog_2; @@ -20,6 +21,7 @@ public partial class AvaloniaMainWindow : Window DataContext = _model; Opened += (_, _) => SyncThemeStateFromCurrentTheme(); + Closing += AvaloniaMainWindow_Closing; // Let DataModel marshal callbacks onto Avalonia UI thread. _model.UiInvoker = action => Dispatcher.UIThread.Invoke(action); @@ -135,6 +137,29 @@ public partial class AvaloniaMainWindow : Window }; } + private bool _isStoppingFaceEncoderForClose; + + private async void AvaloniaMainWindow_Closing(object? sender, CancelEventArgs e) + { + if (_isStoppingFaceEncoderForClose || !_model.IsFaceEncoderRunning) + { + return; + } + + e.Cancel = true; + _isStoppingFaceEncoderForClose = true; + + try + { + await _model.StopFaceEncoderAsync("Arresto face encoder in chiusura...", waitForExit: true); + } + finally + { + _isStoppingFaceEncoderForClose = false; + Close(); + } + } + private void ToggleTheme_Click(object? sender, RoutedEventArgs e) { _isDarkTheme = !_isDarkTheme; diff --git a/imagecatalog/AvaloniaViews/FaceAiTabView.axaml b/imagecatalog/AvaloniaViews/FaceAiTabView.axaml index 7f7f3ae..2beb773 100644 --- a/imagecatalog/AvaloniaViews/FaceAiTabView.axaml +++ b/imagecatalog/AvaloniaViews/FaceAiTabView.axaml @@ -5,13 +5,13 @@ - - + + + + + + + @@ -56,12 +66,14 @@ -