diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index a601fb628..80e82e2a4 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -1,115 +1,51 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# This workflow will build, test, sign and package a WPF or Windows Forms desktop application -# built on .NET Core. -# To learn how to migrate your existing application to .NET Core, -# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework -# -# To configure this workflow: -# -# 1. Configure environment variables -# GitHub sets default environment variables for every workflow run. -# Replace the variables relative to your project in the "env" section below. -# -# 2. Signing -# Generate a signing certificate in the Windows Application -# Packaging Project or add an existing signing certificate to the project. -# Next, use PowerShell to encode the .pfx file using Base64 encoding -# by running the following Powershell script to generate the output string: -# -# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte -# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt' -# -# Open the output file, SigningCertificate_Encoded.txt, and copy the -# string inside. Then, add the string to the repo as a GitHub secret -# and name it "Base64_Encoded_Pfx." -# For more information on how to configure your signing certificate for -# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing -# -# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key". -# See "Build the Windows Application Packaging project" below to see how the secret is used. -# -# For more information on GitHub Actions, refer to https://github.com/features/actions -# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications, -# refer to https://github.com/microsoft/github-actions-for-desktop-apps - -name: .NET Core Desktop +name: CSharpBible CI3 on: push: - branches: [ "master" ] + paths: + - "CSharpBible/**" pull_request: - branches: [ "master" ] + paths: + - "CSharpBible/**" jobs: - - build: - - strategy: - matrix: - configuration: [Debug, Release] - - runs-on: windows-latest # For a list of available runner types, refer to - # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on - - env: - Solution_Name: CSharpBible.sln # Replace with your solution name, i.e. MyWpfApp.sln. - Test_Project_Path: Tests\Test.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. - Wap_Project_Directory: CSharpBible # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. - Wap_Project_Path: CSharpBible # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. - + build-test: + runs-on: windows-latest + defaults: + run: + working-directory: CSharpBible steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - # Install the .NET Core workload - - name: Install .NET Core - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x - - # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild - - name: Setup MSBuild.exe - uses: microsoft/setup-msbuild@v1.0.2 - - # Execute all unit tests in the solution - - name: Execute unit tests - run: dotnet test - - # Restore the application to populate the obj folder with RuntimeIdentifiers - - name: Restore the application - run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration - env: - Configuration: ${{ matrix.configuration }} - - # Decode the base 64 encoded pfx and save the Signing_Certificate - - name: Decode the pfx - run: | - $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") - $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx - [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) - - # Create the app package by building and packaging the Windows Application Packaging project - - name: Create the app package - run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} - env: - Appx_Bundle: Always - Appx_Bundle_Platforms: x86|x64 - Appx_Package_Build_Mode: StoreUpload - Configuration: ${{ matrix.configuration }} - - # Remove the pfx - - name: Remove the pfx - run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx - - # Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact - - name: Upload build artifacts - uses: actions/upload-artifact@v3 - with: - name: MSIX Package - path: ${{ env.Wap_Project_Directory }}\AppPackages + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" + + - name: Remove private projects + run: | + dotnet sln CSharpBible.sln remove "Mobile/MauiApp1/MauiApp1.csproj" + dotnet sln CSharpBible.sln remove "Simulation/AGVFktTests/AGVFktTests.csproj" + dotnet sln CSharpBible.sln remove "Simulation/AGVFkt/AGVFkt.csproj" + dotnet sln CSharpBible.sln remove "DB/ADO_Test/ADO_Test.csproj" + dotnet sln CSharpBible.sln remove "Libraries/CSFreeVision_/CSFreeVision.csproj" + dotnet sln CSharpBible.sln remove "Mobile/DXMauiApp1/DXMauiApp1.csproj" + dotnet sln CSharpBible.sln remove "Web/MyComponent/Client/MyComponent.Client.csproj" + dotnet sln CSharpBible.sln remove "Web/MyComponent/Server/MyComponent.Server.csproj" + dotnet sln CSharpBible.sln remove "Web/MyComponent/Shared/MyComponent.csproj" + dotnet sln CSharpBible.sln remove "WinUI/App1/App1/App1.csproj" + dotnet sln CSharpBible.sln remove "App2/App2.csproj" + dotnet sln CSharpBible.sln remove "../PackageDwnLd.csproj" + dotnet sln CSharpBible.sln remove "Web/BlazorApp1/BlazorApp1.csproj" + dotnet sln CSharpBible.sln remove "Web/WebApp1/BlazorApp2/BlazorApp2.csproj" + dotnet sln CSharpBible.sln remove "Web/WebApp1/WebApplication1/WebApplication1/WebApplication1.csproj" + + - name: Restore + run: dotnet restore CSharpBible.sln -p:TargetFramework=net8.0-windows + + - name: Build + run: dotnet build CSharpBible.sln --configuration Release --no-restore -p:TargetFramework=net8.0-windows + + - name: Test + run: dotnet test CSharpBible.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0-windows diff --git a/.github/workflows/Teststatements.yml b/.github/workflows/Teststatements.yml new file mode 100644 index 000000000..ec5a8018d --- /dev/null +++ b/.github/workflows/Teststatements.yml @@ -0,0 +1,35 @@ +name: TestStatemens CI0 + +on: + push: + paths: + - "TestStatements/**" + pull_request: + paths: + - "TestStatements/**" + +jobs: + build-test: + runs-on: windows-latest + defaults: + run: + working-directory: TestStatements + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" + + - name: Remove private projects + run: | + + - name: Restore + run: dotnet restore TestStatements.sln -p:TargetFramework=net8.0-windows + + - name: Build + run: dotnet build TestStatements.sln --configuration Release --no-restore -p:TargetFramework=net8.0-windows + - name: Test + run: dotnet test TestStatements.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0-windows diff --git a/.gitignore b/.gitignore index 3e5f6349f..0b4b38c24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,37 @@ .vs +.gitignore bin obj +*.db +*.cache +*.bin +*.dll *.bak *.user -/obj.net -/CSharpBible/Data/obj.net -/CSharpBible/obj.net *.log +*.suo +*.snk +**/vs +**/obj +**/obj.net +**/bin +**/Help +/CSharpBible/App2 +/CSharpBible/Mobile +/CSharpBible/Web +/CSharpBible/packages +/CSharpBible/Simulation +/CSharpBible/DB/ADO_Test +/CSharpBible/Libraries/CSFreeVision_ +/CSharpBible/Libraries/MathLibraryTests/TestResults +/CSharpBible/Graphics/PermutationTests/TestResults +/CSharpBible/MVVM_Tutorial +/CSharpBible/WinUI/App1 +/TestStatements/Help +/CSharpBible/Games/SharpHack.Wpf/tiles.png +/CSharpBible/Games/SharpHack.Wpf/tiles2.png +/CSharpBible/Resources/t10k-images.idx3-ubyte +/CSharpBible/Resources/t10k-labels.idx1-ubyte +/CSharpBible/Resources/train-images.idx3-ubyte +/CSharpBible/Resources/train-labels.idx1-ubyte +/CSharpBible/Games/Sokoban_Base/Version.svn diff --git a/Avalonia_Apps/AA14_ScreenX/AA14_ScreenX/AA14_ScreenX.csproj b/Avalonia_Apps/AA14_ScreenX/AA14_ScreenX/AA14_ScreenX.csproj index d246e0113..87fc8753a 100644 --- a/Avalonia_Apps/AA14_ScreenX/AA14_ScreenX/AA14_ScreenX.csproj +++ b/Avalonia_Apps/AA14_ScreenX/AA14_ScreenX/AA14_ScreenX.csproj @@ -23,11 +23,4 @@ - - - - - - - diff --git a/Avalonia_Apps/AA15_Labyrinth/AA15_Labyrinth/AA15_Labyrinth.csproj b/Avalonia_Apps/AA15_Labyrinth/AA15_Labyrinth/AA15_Labyrinth.csproj index 868598e9c..a3e52e864 100644 --- a/Avalonia_Apps/AA15_Labyrinth/AA15_Labyrinth/AA15_Labyrinth.csproj +++ b/Avalonia_Apps/AA15_Labyrinth/AA15_Labyrinth/AA15_Labyrinth.csproj @@ -24,10 +24,4 @@ - - - - - - diff --git a/Avalonia_Apps/AA15_Labyrinth/AA15_LabyrinthTests/AA15_LabyrinthTests.csproj b/Avalonia_Apps/AA15_Labyrinth/AA15_LabyrinthTests/AA15_LabyrinthTests.csproj index 5d0860a91..47341c74d 100644 --- a/Avalonia_Apps/AA15_Labyrinth/AA15_LabyrinthTests/AA15_LabyrinthTests.csproj +++ b/Avalonia_Apps/AA15_Labyrinth/AA15_LabyrinthTests/AA15_LabyrinthTests.csproj @@ -24,9 +24,4 @@ - - - - - diff --git a/Avalonia_Apps/AA15_Labyrinth/AA15a_Treppen/AA15a_Treppen.csproj b/Avalonia_Apps/AA15_Labyrinth/AA15a_Treppen/AA15a_Treppen.csproj index bc98e7507..c3558789b 100644 --- a/Avalonia_Apps/AA15_Labyrinth/AA15a_Treppen/AA15a_Treppen.csproj +++ b/Avalonia_Apps/AA15_Labyrinth/AA15a_Treppen/AA15a_Treppen.csproj @@ -37,12 +37,4 @@ - - - - - - - - diff --git a/Avalonia_Apps/AA16_UserControl/AA16_Usercontrol1/Directory.Packages.props b/Avalonia_Apps/AA16_UserControl/AA16_Usercontrol1/Directory.Packages.props index 921a6da2f..d9e976c52 100644 --- a/Avalonia_Apps/AA16_UserControl/AA16_Usercontrol1/Directory.Packages.props +++ b/Avalonia_Apps/AA16_UserControl/AA16_Usercontrol1/Directory.Packages.props @@ -3,13 +3,13 @@ true - - - - - - - + + + + + + + diff --git a/Avalonia_Apps/AA16_UserControl/AA16_Usercontrol2/AA16_UserControl2.csproj b/Avalonia_Apps/AA16_UserControl/AA16_Usercontrol2/AA16_UserControl2.csproj index ed77aa851..aeb7c33fb 100644 --- a/Avalonia_Apps/AA16_UserControl/AA16_Usercontrol2/AA16_UserControl2.csproj +++ b/Avalonia_Apps/AA16_UserControl/AA16_Usercontrol2/AA16_UserControl2.csproj @@ -25,11 +25,4 @@ - - - - - - - diff --git a/Avalonia_Apps/AA18_MultiConverter/AA18_MultiConverters/AA18_MultiConverters.csproj b/Avalonia_Apps/AA18_MultiConverter/AA18_MultiConverters/AA18_MultiConverters.csproj index 1c16896a3..0d373bb9a 100644 --- a/Avalonia_Apps/AA18_MultiConverter/AA18_MultiConverters/AA18_MultiConverters.csproj +++ b/Avalonia_Apps/AA18_MultiConverter/AA18_MultiConverters/AA18_MultiConverters.csproj @@ -25,11 +25,4 @@ - - - - - - - diff --git a/Avalonia_Apps/AA19_FilterLists/AA19_FilterLists/AA19_FilterLists.csproj b/Avalonia_Apps/AA19_FilterLists/AA19_FilterLists/AA19_FilterLists.csproj index daf30f25c..7a4043932 100644 --- a/Avalonia_Apps/AA19_FilterLists/AA19_FilterLists/AA19_FilterLists.csproj +++ b/Avalonia_Apps/AA19_FilterLists/AA19_FilterLists/AA19_FilterLists.csproj @@ -61,11 +61,4 @@ - - - - - - - diff --git a/Avalonia_Apps/AA20_SysDialogs/AA20a_CommonDialogs/AA20a_CommonDialogs.csproj b/Avalonia_Apps/AA20_SysDialogs/AA20a_CommonDialogs/AA20a_CommonDialogs.csproj new file mode 100644 index 000000000..b1b9f92ee --- /dev/null +++ b/Avalonia_Apps/AA20_SysDialogs/AA20a_CommonDialogs/AA20a_CommonDialogs.csproj @@ -0,0 +1,43 @@ + + + + + WinExe + net8.0 + enable + enable + true + AA20a_CommonDialogs + + + + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Avalonia_Apps/AA20_SysDialogs/AA20a_CommonDialogs/App.axaml b/Avalonia_Apps/AA20_SysDialogs/AA20a_CommonDialogs/App.axaml new file mode 100644 index 000000000..ab42778ea --- /dev/null +++ b/Avalonia_Apps/AA20_SysDialogs/AA20a_CommonDialogs/App.axaml @@ -0,0 +1,8 @@ + + + + + diff --git a/Avalonia_Apps/AA20_SysDialogs/AA20a_CommonDialogs/App.axaml.cs b/Avalonia_Apps/AA20_SysDialogs/AA20a_CommonDialogs/App.axaml.cs new file mode 100644 index 000000000..ed5c5ef0d --- /dev/null +++ b/Avalonia_Apps/AA20_SysDialogs/AA20a_CommonDialogs/App.axaml.cs @@ -0,0 +1,50 @@ +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using Avalonia.Controls; +using Avln_CommonDialogs.Avalonia; +using Microsoft.Extensions.DependencyInjection; + +namespace AA20a_CommonDialogs; + +public sealed partial class App : Application +{ + public IServiceProvider Services { get; private set; } = default!; + + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() + { + Services = ConfigureServices(); + + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + desktop.MainWindow = Services.GetRequiredService(); + } + + base.OnFrameworkInitializationCompleted(); + } + + private IServiceProvider ConfigureServices() + { + var services = new ServiceCollection(); + + var topLevelAccessor = new TopLevelAccessor(); + services.AddSingleton(topLevelAccessor); + + services.AddSingleton(); + services.AddSingleton(); + + services.AddAvaloniaCommonDialogs(() => topLevelAccessor.Current); + + return services.BuildServiceProvider(); + } +} + +public sealed class TopLevelAccessor +{ + public TopLevel? Current { get; set; } +} diff --git a/Avalonia_Apps/AA20_SysDialogs/AA20a_CommonDialogs/MainWindow.axaml b/Avalonia_Apps/AA20_SysDialogs/AA20a_CommonDialogs/MainWindow.axaml new file mode 100644 index 000000000..7d34efab3 --- /dev/null +++ b/Avalonia_Apps/AA20_SysDialogs/AA20a_CommonDialogs/MainWindow.axaml @@ -0,0 +1,19 @@ + + + + +