diff --git a/.github/actions/comment-progress/action.yml b/.github/actions/comment-progress/action.yml new file mode 100644 index 000000000..aaca64b1f --- /dev/null +++ b/.github/actions/comment-progress/action.yml @@ -0,0 +1,57 @@ +name: "Comment" +description: "Creates or updates a comment on the PR with the progress of the tests" +inputs: + comment_id: + description: 'The ID of the comment to append to' + required: false + content: + description: 'The content to add to the comment' + required: true +outputs: + comment_id: + description: "ID of the comment" + value: ${{ steps.update-comment.outputs.comment_id }} +runs: + using: "composite" + steps: + - id: update-comment + uses: actions/github-script@v8 + with: + script: | + const commentId = "${{ inputs.comment_id }}"; + let content = `${{ inputs.content }}`; + + if (!commentId) { + const newComment = await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: content + }); + + core.setOutput("comment_id", newComment.data.id); + + return; + } + + const comment = await github.rest.issues.getComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: commentId + }); + + content = content + .replace(new RegExp('#success', 'g'), '✅ passed') + .replace(new RegExp('#failure', 'g'), '❌ failed'); + + let body = comment.data.body; + + body += `\n${content}`; + + await github.rest.issues.updateComment({ + comment_id: commentId, + owner: context.repo.owner, + repo: context.repo.repo, + body + }); \ No newline at end of file diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml new file mode 100644 index 000000000..3ec9d2ae4 --- /dev/null +++ b/.github/actions/run-tests/action.yml @@ -0,0 +1,95 @@ +name: "Run tests" +description: "Runs the specified tests using factos or core tests" +inputs: + use-factos: + description: 'Whether to use factos for test selection' + required: true + id: + description: "Identifier for the test target" + required: true + test-id: + description: 'The test id to select for factos' + required: false + default: "" + target-framework: + description: 'The target framework to use' + required: false + default: "" + workloads: + description: 'The workloads array to install' + required: false + default: "" + xcode-path: + description: 'The Xcode path to select' + required: false + use-android-emulator: + description: 'Whether to use android emulator' + required: false + comment_id: + description: 'The ID of the comment to append to' + required: false +runs: + using: "composite" + steps: + - name: Select Xcode version + shell: pwsh + if: ${{ inputs.xcode-path }} + run: sudo xcode-select -s ${{ inputs.xcode-path }} + + - name: Setup .NET and Workloads + uses: ./.github/actions/setup-dotnet-and-workloads + with: + workloads: ${{ inputs.workloads }} + + - name: Download local packages + uses: actions/download-artifact@v7.0.0 + with: + path: ./artifacts + + - name: Configure NuGet sources + shell: pwsh + run: + dotnet nuget add source ${{ github.workspace }}/artifacts --name local + + # run tests using the factos selection and the console when no emulator is needed + - name: Run UI tests + if : ${{ inputs.use-factos == 'true' && inputs.use-android-emulator != 'true' }} + shell: pwsh + run: dotnet run --project tests/UITests -c Release --report-trx --no-progress --select ${{ inputs.test-id }} --test-env tf=${{ inputs.target-framework }} lvcversionsuffix=-${{ github.sha }} + + # run tests using the factos selection inside the android emulator + - name: Enable KVM + if : ${{ inputs.use-factos == 'true' && inputs.use-android-emulator == 'true' }} + shell: pwsh + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + - name: Start Android emulator and run tests + if : ${{ inputs.use-factos == 'true' && inputs.use-android-emulator == 'true' }} + uses: reactivecircus/android-emulator-runner@v2.35.0 + with: + api-level: 35 + target: google_apis + arch: x86_64 + script: + dotnet run --project tests/UITests -c Release --report-trx --no-progress --select ${{ inputs.test-id }} --test-env tf=${{ inputs.target-framework }} lvcversionsuffix=-${{ github.sha }} + + # run core tests when factos is not used + # the Debug config is required even we are testing the nuget packages in Release. + # this is because some optimizations in Release make the tests fail, but the code + # that fails is not related to the nuget packages but to the test code itself + # there is a function that mocks the ui drawing that fails in Release optimizations. + # ToDo: fix that, or now that we have ui tests, maybe just run the tests in the ui?. + - name: Run tests + if : ${{ inputs.use-factos != 'true' }} + shell: pwsh + run: dotnet run --project tests/CoreTests/CoreTests.csproj -c Debug -f ${{ inputs.target-framework }} --report-trx -p:UseNuGetPackages=true -p:LiveChartsVersionSuffix=-${{ github.sha }} + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v6.0.0 + with: + name: test-results-${{ inputs.test-id }} + retention-days: 30 + path: "**/*.trx" diff --git a/.github/actions/setup-dotnet-and-workloads/action.yml b/.github/actions/setup-dotnet-and-workloads/action.yml new file mode 100644 index 000000000..a02b4db9b --- /dev/null +++ b/.github/actions/setup-dotnet-and-workloads/action.yml @@ -0,0 +1,23 @@ +name: "Setup .Net and Workloads" +description: "Sets up .NET SDK 10 and installs the specified workloads" +inputs: + workloads: + description: 'The workloads array to install' + required: false + default: "" +runs: + using: "composite" + steps: + - name: Setup .NET + uses: actions/setup-dotnet@v5.0.1 + with: + dotnet-version: '10.0.100' + + - name: Install Workloads + if: ${{ inputs.workloads != '' }} + shell: pwsh + run: | + $workloads = "${{ inputs.workloads }}".Split(' ') + foreach ($workload in $workloads) { + dotnet workload install $workload + } \ No newline at end of file diff --git a/.github/workflows/compile-all-views.yml b/.github/workflows/compile-all-views.yml deleted file mode 100644 index aa883600b..000000000 --- a/.github/workflows/compile-all-views.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: "Compile all views" - -on: - push: - branches: [ master, dev ] - pull_request: - branches: [ master, dev ] - schedule: - - cron: '35 19 * * 4' - -jobs: - analyze: - name: Analyze - runs-on: windows-2022 - - strategy: - fail-fast: false - matrix: - language: [ 'csharp' ] - targetplatform: [ x86, x64 ] - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - - name: Install MAUI workload - run: dotnet workload install maui - - - name: Compile Debug - run: ./build/build-windows.ps1 -configuration "Debug" diff --git a/.github/workflows/livecharts.yml b/.github/workflows/livecharts.yml new file mode 100644 index 000000000..bfdae42e0 --- /dev/null +++ b/.github/workflows/livecharts.yml @@ -0,0 +1,378 @@ +name: LiveCharts +permissions: + contents: read + actions: read + checks: write + pull-requests: write + +on: + pull_request: + branches: [ master, dev ] + +jobs: + + report-progress-starting: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + - uses: ./.github/actions/comment-progress + id: create-comment + with: + content: | + Thanks for your contribution! + + We are starting the build and test process. This may take a while. + You can find more details below as the process continues or at the [actions tab](https://github.com/Live-Charts/LiveCharts2/actions/runs/${{ github.run_id }}). + outputs: + comment_id: ${{ steps.create-comment.outputs.comment_id }} + + pack: + runs-on: windows-2025 + needs: report-progress-starting + strategy: + matrix: + include: + - short-name: core + project: src/LiveChartsCore + - short-name: skiasharp + project: src/skiasharp/LiveChartsCore.SkiaSharp + - short-name: avalonia-skiasharp + project: src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia + workloads: wasm-tools, maui + - short-name: blazor-skiasharp + project: src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor + - short-name: eto-skiasharp + project: src/skiasharp/LiveChartsCore.SkiaSharpView.Eto + - short-name: maui-skiasharp + project: src/skiasharp/LiveChartsCore.SkiaSharpView.Maui + workloads: maui + - short-name: uno-skiasharp + project: src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI + workloads: wasm-tools, maui + - short-name: winui-skiasharp + project: src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI + - short-name: winforms-skiasharp + project: src/skiasharp/LiveChartsCore.SkiaSharp.WinForms + - short-name: wpf-skiasharp + project: src/skiasharp/LiveChartsCore.SkiaSharp.WPF + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + + - name: Setup .NET and Workloads + uses: ./.github/actions/setup-dotnet-and-workloads + with: + workloads: ${{ matrix.workloads }} + + - name: Pack + run: + dotnet pack ${{ matrix.project }} -c Release -o artifacts /p:IsPacking=true /p:LiveChartsVersionSuffix=-${{ github.sha }} + + - name: Upload packages + id: upload + uses: actions/upload-artifact@v6.0.0 + with: + name: ${{ matrix.short-name }}-package + retention-days: 30 + path: | + artifacts/*.nupkg + artifacts/*.snupkg + + collect-packages: + runs-on: ubuntu-24.04 + needs: [pack, report-progress-starting] + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + + - name: Merge all package artifacts into one + uses: actions/upload-artifact/merge@v6 + id: merge + with: + name: nuget-packages + pattern: "*-package" + retention-days: 30 + delete-merged: true + + - name: Update Comment + uses: ./.github/actions/comment-progress + with: + comment_id: ${{ needs.report-progress-starting.outputs.comment_id }} + content: | + + --- + + All packages have been packed successfully! 📦✅ + You can download the NuGet packages for this build [here](${{ steps.merge.outputs.artifact-url }}). + + The packages will be available for 30 days, you can either [use them directly](https://stackoverflow.com/questions/43400069/add-a-package-with-a-local-package-file-in-dotnet), or wait for this PR to be merged to have them published to NuGet.org. + + --- + + Tests will start now, you can monitor their progress below or at the [actions tab](https://github.com/Live-Charts/LiveCharts2/actions/runs/${{ github.run_id }}). + + test-core: + runs-on: windows-2025 + needs: [pack, report-progress-starting] + strategy: + fail-fast: false + matrix: + framework: [ net8.0, net462 ] + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + + - name: Run tests + uses: ./.github/actions/run-tests + with: + id: core + test-id: core-${{ matrix.framework }} + use-factos: false + target-framework: ${{ matrix.framework }} + comment_id: ${{ needs.report-progress-starting.outputs.comment_id }} + + test-windows: + runs-on: windows-2025 + strategy: + fail-fast: false + matrix: + include: + - id: avalonia-desktop + - id: eto + - id: maui + tf: net10.0-windows10.0.19041.0 + workloads: maui + - id: uno + tf: net10.0-desktop + workloads: maui + - id: winui + - id: winforms-net10 + - id: winforms-net10w19041 + - id: winforms-net462 + - id: wpf-net10 + - id: wpf-net10w19041 + - id: wpf-net462 + + needs: [pack, report-progress-starting] + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + + - name: Run UI tests + uses: ./.github/actions/run-tests + with: + id: windows + use-factos: true + test-id: ${{ matrix.id }} + workloads: ${{ matrix.workloads }} + target-framework: ${{ matrix.tf }} + comment_id: ${{ needs.report-progress-starting.outputs.comment_id }} + + test-linux: + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + include: + - id: avalonia-desktop + # - id: eto, requires additional setup i think... + - id: uno + tf: net10.0-desktop + workloads: android + needs: [pack, report-progress-starting] + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + + - name: Setup headless display + uses: pyvista/setup-headless-display-action@v4.2 + + - name: Run UI tests + uses: ./.github/actions/run-tests + with: + id: linux + use-factos: true + test-id: ${{ matrix.id }} + workloads: ${{ matrix.workloads }} + target-framework: ${{ matrix.tf }} + comment_id: ${{ needs.report-progress-starting.outputs.comment_id }} + + test-mac: + runs-on: macos-26 + strategy: + fail-fast: false + matrix: + include: + - id: avalonia-desktop + - id: eto + - id: maui + tf: net10.0-maccatalyst + workloads: maui + - id: uno + tf: net10.0-desktop + workloads: maui + needs: [pack, report-progress-starting] + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + + - name: Run UI tests + uses: ./.github/actions/run-tests + with: + id: mac + use-factos: true + test-id: ${{ matrix.id }} + workloads: ${{ matrix.workloads }} + target-framework: ${{ matrix.tf }} + xcode-path: /Applications/Xcode_26.2.app + comment_id: ${{ needs.report-progress-starting.outputs.comment_id }} + + test-browser: + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + include: + - id: blazor + workloads: wasm-tools + - id: avalonia-browser + workloads: wasm-tools + # disabled for now, in this uno version, idk why on wasm no tests are detected. + # - id: uno + # tf: net10.0-browserwasm + # workloads: wasm-tools android + needs: [pack, report-progress-starting] + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + + - name: Run UI tests + uses: ./.github/actions/run-tests + with: + id: browser + use-factos: true + test-id: ${{ matrix.id }} + workloads: ${{ matrix.workloads }} + # target-framework: ${{ matrix.tf }} + comment_id: ${{ needs.report-progress-starting.outputs.comment_id }} + + # test-android: + # runs-on: ubuntu-24.04 + # strategy: + # fail-fast: false + # matrix: + # include: + # - id: avalonia-android + # workloads: android + # - id: maui + # tf: net10.0-android + # workloads: maui-android + # # disabled for now, in this uno version, idk why on android no tests are detected. + # # - id: uno + # # tf: net10.0-android + # # workloads: android + # needs: [pack, report-progress-starting] + # steps: + # - name: Checkout + # uses: actions/checkout@v6.0.1 + + # - name: Run UI tests + # uses: ./.github/actions/run-tests + # with: + # id: android + # use-factos: true + # test-id: ${{ matrix.id }} + # workloads: ${{ matrix.workloads }} + # target-framework: ${{ matrix.tf }} + # use-android-emulator: true + # comment_id: ${{ needs.report-progress-starting.outputs.comment_id }} + + # test-ios: + # runs-on: macos-26 + # strategy: + # fail-fast: false + # matrix: + # include: + # - id: avalonia-ios + # workloads: ios + # - id: maui + # tf: net10.0-ios + # workloads: maui + # # disabled for now, in this uno version, it takes 3 times longer than the others (about 40 mins) + # # - id: uno + # # tf: net10.0-ios + # # workloads: ios android + # needs: [pack, report-progress-starting] + # steps: + # - name: Checkout + # uses: actions/checkout@v6.0.1 + + # - name: Run UI tests + # uses: ./.github/actions/run-tests + # with: + # id: ios + # use-factos: true + # test-id: ${{ matrix.id }} + # workloads: ${{ matrix.workloads }} + # target-framework: ${{ matrix.tf }} + # xcode-path: /Applications/Xcode_26.2.app + # comment_id: ${{ needs.report-progress-starting.outputs.comment_id }} + + after-tests: + runs-on: ubuntu-24.04 + if: always() + needs: + - report-progress-starting + - test-core + - test-windows + - test-linux + - test-mac + - test-browser + # - test-android + # - test-ios + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + + - name: Download all test results + uses: actions/download-artifact@v7.0.0 + with: + pattern: test-results-* + path: ./test-results + + - name: Publish all test results + id: report + uses: dorny/test-reporter@v2.4.0 + with: + name: all-test-results + path: "./test-results/**/*.trx" + reporter: dotnet-trx + + - name: Report tests completion + if: ${{ always() && !contains(join(needs.*.result, ' '), 'failure') && !contains(join(needs.*.result, ' '), 'cancelled') }} + uses: ./.github/actions/comment-progress + with: + comment_id: ${{ needs.report-progress-starting.outputs.comment_id }} + content: | + ### Test Results Summary (Passed) ✅ :partying_face: + + ${{ steps.report.outputs.skipped }} skipped. + ${{ steps.report.outputs.failed }} failed. + ${{ steps.report.outputs.passed }} passed! ✅ + + - name: Report tests failure + if: ${{ always() && (contains(join(needs.*.result, ' '), 'failure') || contains(join(needs.*.result, ' '), 'cancelled')) }} + uses: ./.github/actions/comment-progress + with: + comment_id: ${{ needs.report-progress-starting.outputs.comment_id }} + content: | + ### Test Results Summary (Failure) ❌ :disappointed_relieved: + + | Core | Windows | Linux | Mac | Browser | Android | iOS | + |-------|---------|-------|-----|---------|---------|-----| + | #${{ needs.test-core.result }} | #${{ needs.test-windows.result }} | #${{ needs.test-linux.result }} | #${{ needs.test-mac.result }} | #${{ needs.test-browser.result }} | #${{ needs.test-android.result }} | #${{ needs.test-ios.result }} | + + ${{ steps.report.outputs.skipped }} skipped. + ${{ steps.report.outputs.passed }} passed. + ${{ steps.report.outputs.failed }} failed. ❌ \ No newline at end of file diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml deleted file mode 100644 index c374437a6..000000000 --- a/.github/workflows/run-unit-tests.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: "Unit tests" - -on: - push: - branches: [ master, dev ] - pull_request: - branches: [ master, dev ] - schedule: - - cron: '35 19 * * 4' - -jobs: - analyze: - name: Analyze - runs-on: windows-2022 - - strategy: - fail-fast: false - matrix: - language: [ 'csharp' ] - targetplatform: [ x86, x64 ] - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - - name: Run unit tests - run: dotnet test ./tests/LiveChartsCore.UnitTesting diff --git a/.gitignore b/.gitignore index 60c112fae..3b350716c 100644 --- a/.gitignore +++ b/.gitignore @@ -344,9 +344,3 @@ healthchecksdb samples/XamarinSample/XamarinSample/XamarinSample.Android/XamarinSample.Android.csproj samples/XamarinSample/XamarinSample/XamarinSample.Android/Resources/Resource.designer.cs nuget.exe - -# Yes it is recommended to share the *.snk, but there are few reasons -# other than the ones mentioned in the next link that makes me want to keep this private, also singed. -# https://learn.microsoft.com/en-us/dotnet/standard/library-guidance/strong-naming#create-strong-named-net-libraries -*LiveCharts.snk -build/pack.singed.ps1 diff --git a/Directory.Build.props b/Directory.Build.props index 524e55e3c..716be58e8 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,11 +1,14 @@ - 2.0.0-rc6.1 + -rc6.1 + 2.0.0$(LiveChartsVersionSuffix) 1.0.1 BetoRodriguez - preview + 14.0 + enable + enable 8.3.1.1 - + + false + + 0.8.0 + + false true diff --git a/LiveCharts.Tests.slnx b/LiveCharts.Tests.slnx new file mode 100644 index 000000000..99c3de6a9 --- /dev/null +++ b/LiveCharts.Tests.slnx @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LiveCharts.slnx b/LiveCharts.slnx index 13d141687..c8c22a61b 100644 --- a/LiveCharts.slnx +++ b/LiveCharts.slnx @@ -142,13 +142,23 @@ - + - + + + + + + - + + + + + + diff --git a/LiveCharts.snk b/LiveCharts.snk new file mode 100644 index 000000000..16a1ee945 Binary files /dev/null and b/LiveCharts.snk differ diff --git a/build/NativeSharedLinks.Build.props b/build/NativeSharedLinks.Build.props new file mode 100644 index 000000000..035b31743 --- /dev/null +++ b/build/NativeSharedLinks.Build.props @@ -0,0 +1,7 @@ + + + + Native\%(RecursiveDir)%(Filename).cs + + + diff --git a/build/SharedLinks.Build.props b/build/SharedLinks.Build.props new file mode 100644 index 000000000..562ae3669 --- /dev/null +++ b/build/SharedLinks.Build.props @@ -0,0 +1,40 @@ + + + + %(Filename).cs + SourceGenChart.cs + + + + %(Filename).cs + CartesianChart.cs + + + CartesianChart.cs + + + + %(Filename).cs + PieChart.cs + + + PieChart.cs + + + + %(Filename).cs + PolarChart.cs + + + PolarChart.cs + + + + %(Filename).cs + GeoMap.cs + + + GeoMap.cs + + + diff --git a/build/UITestsLinks.Build.props b/build/UITestsLinks.Build.props new file mode 100644 index 000000000..e46b397b5 --- /dev/null +++ b/build/UITestsLinks.Build.props @@ -0,0 +1,7 @@ + + + + UITests\%(RecursiveDir)%(Filename).cs + + + diff --git a/build/WinUISharedLinks.Build.props b/build/WinUISharedLinks.Build.props new file mode 100644 index 000000000..151f313bc --- /dev/null +++ b/build/WinUISharedLinks.Build.props @@ -0,0 +1,24 @@ + + + + %(RecursiveDir)%(Filename).cs + + + + CartesianChart.cs + + + + PieChart.cs + + + + PolarChart.cs + + + + GeoMap.cs + + + + diff --git a/build/XamlSharedLinks.Build.props b/build/XamlSharedLinks.Build.props new file mode 100644 index 000000000..9d0b23e57 --- /dev/null +++ b/build/XamlSharedLinks.Build.props @@ -0,0 +1,7 @@ + + + + XamlFriendlySourceGenerated\%(Filename).cs + + + diff --git a/build/build-windows.ps1 b/build/build-windows.ps1 deleted file mode 100644 index 3829a83f4..000000000 --- a/build/build-windows.ps1 +++ /dev/null @@ -1,30 +0,0 @@ -param([string]$configuration = "Release") - -dotnet workload install macos -dotnet workload install ios -dotnet workload install maccatalyst -dotnet workload install android - -dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj -c $configuration -dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj -c $configuration -dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharp.Wpf/LiveChartsCore.SkiaSharpView.Wpf.csproj -c $configuration -dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharp.Xamarin.Forms/LiveChartsCore.SkiaSharpView.Xamarin.Forms.csproj -c $configuration -dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveChartsCore.SkiaSharpView.Blazor.csproj -c $configuration -dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsCore.SkiaSharpView.Eto.csproj -c $configuration - -$msbuild = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe - -& $msbuild ` - ./src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj ` - /p:configuration=$configuration ` - /restore - -& $msbuild ` - ./src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj ` - /p:configuration=$configuration ` - /restore - -& $msbuild ` - ./src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/LiveChartsCore.SkiaSharpView.Uno.WinUI.csproj ` - /p:configuration=$configuration ` - /restore \ No newline at end of file diff --git a/generators/LiveChartsGenerators/LiveChartsGenerators.csproj b/generators/LiveChartsGenerators/LiveChartsGenerators.csproj index 4f3c3893b..803eb7679 100644 --- a/generators/LiveChartsGenerators/LiveChartsGenerators.csproj +++ b/generators/LiveChartsGenerators/LiveChartsGenerators.csproj @@ -2,9 +2,6 @@ netstandard2.0 - $(GlobalLangVersion) - enable - enable true true diff --git a/global.json b/global.json deleted file mode 100644 index 907a4317c..000000000 --- a/global.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "sdk": { - "version": "9.0.101", - "rollForward": "latestFeature" - }, - "msbuild-sdks": { - "Uno.Sdk": "6.2.36" - } -} diff --git a/src/LiveChartsCore/images/icon.png b/icon.png similarity index 100% rename from src/LiveChartsCore/images/icon.png rename to icon.png diff --git a/nuget.props b/nuget.props new file mode 100644 index 000000000..ed02460e6 --- /dev/null +++ b/nuget.props @@ -0,0 +1,29 @@ + + + $(LiveChartsVersion) + $(LiveChartsAuthors) + icon.png + https://github.com/beto-rodriguez/LiveCharts2 + true + + + true + true + + + true + snupkg + + + $(SolutionDir)nukpg + + + true + + true + MIT + true + + Simple, stunning, interactive and powerful data visualization for .Net. + + diff --git a/readme.txt b/readme.txt deleted file mode 100644 index 98e1f3ed1..000000000 --- a/readme.txt +++ /dev/null @@ -1 +0,0 @@ -For Uno, open ./samples/UnoPlatform/UnoPlatform.slnx diff --git a/samples/AvaloniaSample/App.axaml.cs b/samples/AvaloniaSample/App.axaml.cs index 2db5e6307..d17561480 100644 --- a/samples/AvaloniaSample/App.axaml.cs +++ b/samples/AvaloniaSample/App.axaml.cs @@ -4,6 +4,10 @@ using LiveChartsCore; // mark using ViewModelsSamples; +#if UI_TESTING +using Factos.Avalonia; +#endif + namespace AvaloniaSample; public partial class App : Application @@ -19,6 +23,9 @@ public override void Initialize() public override void OnFrameworkInitializationCompleted() { +#if UI_TESTING + this.UseFactosApp(); +#else if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { desktop.MainWindow = new MainWindow(); @@ -29,5 +36,6 @@ public override void OnFrameworkInitializationCompleted() } base.OnFrameworkInitializationCompleted(); +#endif } } diff --git a/samples/AvaloniaSample/AvaloniaSample.csproj b/samples/AvaloniaSample/AvaloniaSample.csproj index d706cf2a4..15b37dd2f 100644 --- a/samples/AvaloniaSample/AvaloniaSample.csproj +++ b/samples/AvaloniaSample/AvaloniaSample.csproj @@ -3,9 +3,7 @@ - net8.0 - enable - $(GlobalLangVersion) + net10.0 true @@ -39,5 +37,16 @@ + + + + + + + + + + $(DefineConstants);UI_TESTING;XAML_UI_TESTING;AVALONIA_UI_TESTING + diff --git a/samples/AvaloniaSample/Bars/AutoUpdate/View.axaml b/samples/AvaloniaSample/Bars/AutoUpdate/View.axaml index cf9182536..ce049aeba 100644 --- a/samples/AvaloniaSample/Bars/AutoUpdate/View.axaml +++ b/samples/AvaloniaSample/Bars/AutoUpdate/View.axaml @@ -22,7 +22,7 @@ - + this.Find("chart")!; +#endif } diff --git a/samples/AvaloniaSample/General/FirstChart/View.axaml b/samples/AvaloniaSample/General/FirstChart/View.axaml index 41059fe23..8b32d3b3e 100644 --- a/samples/AvaloniaSample/General/FirstChart/View.axaml +++ b/samples/AvaloniaSample/General/FirstChart/View.axaml @@ -7,8 +7,7 @@ xmlns:scg="clr-namespace:System.Collections.Generic;assembly=netstandard"> - + LegendPosition="Right"> (CartesianChart)Content!; +#endif } diff --git a/samples/AvaloniaSample/Pies/AutoUpdate/View.axaml b/samples/AvaloniaSample/Pies/AutoUpdate/View.axaml index 1d7ce3923..67462e995 100644 --- a/samples/AvaloniaSample/Pies/AutoUpdate/View.axaml +++ b/samples/AvaloniaSample/Pies/AutoUpdate/View.axaml @@ -17,7 +17,7 @@ - + public partial class View : UserControl { - private bool? _isStreaming = false; - public View() { InitializeComponent(); } - private async void Button_Click(object sender, System.Windows.RoutedEventArgs e) - { - var vm = (ViewModel)DataContext; - _isStreaming = _isStreaming is null ? true : !_isStreaming; - - while (_isStreaming.Value) - { - vm.RemoveItem(); - vm.AddItem(); - await Task.Delay(1000); - } - } +#if UI_TESTING + public CartesianChart Chart => chart; +#endif } diff --git a/samples/WPFSample/General/FirstChart/View.xaml.cs b/samples/WPFSample/General/FirstChart/View.xaml.cs index 66c66581d..644064128 100644 --- a/samples/WPFSample/General/FirstChart/View.xaml.cs +++ b/samples/WPFSample/General/FirstChart/View.xaml.cs @@ -1,4 +1,5 @@ using System.Windows.Controls; +using LiveChartsCore.SkiaSharpView.WPF; namespace WPFSample.General.FirstChart; @@ -11,4 +12,8 @@ public View() { InitializeComponent(); } + +#if UI_TESTING + public CartesianChart Chart => (CartesianChart)Content; +#endif } diff --git a/samples/WPFSample/Pies/AutoUpdate/View.xaml b/samples/WPFSample/Pies/AutoUpdate/View.xaml index cd5aa60f3..581b2b7d3 100644 --- a/samples/WPFSample/Pies/AutoUpdate/View.xaml +++ b/samples/WPFSample/Pies/AutoUpdate/View.xaml @@ -21,7 +21,7 @@ - + chart; +#endif } diff --git a/samples/WinUISample/WinUISample/Samples/General/FirstChart/View.xaml.cs b/samples/WinUISample/WinUISample/Samples/General/FirstChart/View.xaml.cs index 9dd3ef721..d03052066 100644 --- a/samples/WinUISample/WinUISample/Samples/General/FirstChart/View.xaml.cs +++ b/samples/WinUISample/WinUISample/Samples/General/FirstChart/View.xaml.cs @@ -1,4 +1,5 @@ -using Microsoft.UI.Xaml.Controls; +using LiveChartsCore.SkiaSharpView.WinUI; +using Microsoft.UI.Xaml.Controls; namespace WinUISample.General.FirstChart; @@ -8,4 +9,8 @@ public View() { InitializeComponent(); } + +#if UI_TESTING + public CartesianChart Chart => (CartesianChart)Content!; +#endif } diff --git a/samples/WinUISample/WinUISample/Samples/Pies/AutoUpdate/View.xaml b/samples/WinUISample/WinUISample/Samples/Pies/AutoUpdate/View.xaml index d67f0d479..ff986e543 100644 --- a/samples/WinUISample/WinUISample/Samples/Pies/AutoUpdate/View.xaml +++ b/samples/WinUISample/WinUISample/Samples/Pies/AutoUpdate/View.xaml @@ -19,7 +19,7 @@ - + chart; +#endif } diff --git a/samples/WinUISample/WinUISample/Samples/Pies/Basic/View.xaml.cs b/samples/WinUISample/WinUISample/Samples/Pies/Basic/View.xaml.cs index 7004bc974..8d5a9b921 100644 --- a/samples/WinUISample/WinUISample/Samples/Pies/Basic/View.xaml.cs +++ b/samples/WinUISample/WinUISample/Samples/Pies/Basic/View.xaml.cs @@ -1,4 +1,5 @@ -using Microsoft.UI.Xaml.Controls; +using LiveChartsCore.SkiaSharpView.WinUI; +using Microsoft.UI.Xaml.Controls; namespace WinUISample.Pies.Basic; @@ -8,4 +9,8 @@ public View() { InitializeComponent(); } + +#if UI_TESTING + public PieChart Chart => (PieChart)Content!; +#endif } diff --git a/samples/WinUISample/WinUISample/Samples/Polar/Basic/View.xaml.cs b/samples/WinUISample/WinUISample/Samples/Polar/Basic/View.xaml.cs index 8c299656d..5899132fc 100644 --- a/samples/WinUISample/WinUISample/Samples/Polar/Basic/View.xaml.cs +++ b/samples/WinUISample/WinUISample/Samples/Polar/Basic/View.xaml.cs @@ -1,4 +1,5 @@ -using Microsoft.UI.Xaml.Controls; +using LiveChartsCore.SkiaSharpView.WinUI; +using Microsoft.UI.Xaml.Controls; namespace WinUISample.Polar.Basic; @@ -8,4 +9,8 @@ public View() { InitializeComponent(); } + +#if UI_TESTING + public PolarChart Chart => (PolarChart)Content!; +#endif } diff --git a/samples/WinUISample/WinUISample/Samples/VisualTest/DataTemplate/View.xaml b/samples/WinUISample/WinUISample/Samples/VisualTest/DataTemplate/View.xaml index 2ffef9849..9dd1e6349 100644 --- a/samples/WinUISample/WinUISample/Samples/VisualTest/DataTemplate/View.xaml +++ b/samples/WinUISample/WinUISample/Samples/VisualTest/DataTemplate/View.xaml @@ -11,14 +11,34 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/WinUISample/WinUISample/Samples/VisualTest/DataTemplate/View.xaml.cs b/samples/WinUISample/WinUISample/Samples/VisualTest/DataTemplate/View.xaml.cs index c2719547f..827c6de68 100644 --- a/samples/WinUISample/WinUISample/Samples/VisualTest/DataTemplate/View.xaml.cs +++ b/samples/WinUISample/WinUISample/Samples/VisualTest/DataTemplate/View.xaml.cs @@ -1,4 +1,7 @@ -using Microsoft.UI.Xaml.Controls; +using LiveChartsCore.Kernel.Sketches; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media; namespace WinUISample.VisualTest.DataTemplate; @@ -8,4 +11,22 @@ public View() { InitializeComponent(); } + + public IEnumerable FindCharts(DependencyObject? parent = null) + { + parent ??= (DependencyObject)Content!; + + var count = VisualTreeHelper.GetChildrenCount(parent); + + for (var i = 0; i < count; i++) + { + var child = VisualTreeHelper.GetChild(parent, i); + + if (child is IChartView chart) + yield return chart; + + foreach (var descendant in FindCharts(child)) + yield return descendant; + } + } } diff --git a/samples/WinUISample/WinUISample/WinUISample.csproj b/samples/WinUISample/WinUISample/WinUISample.csproj index 0c0533138..e61833a5b 100644 --- a/samples/WinUISample/WinUISample/WinUISample.csproj +++ b/samples/WinUISample/WinUISample/WinUISample.csproj @@ -1,15 +1,15 @@  WinExe - net8.0-windows10.0.19041.0 + net10.0-windows10.0.19041.0 10.0.17763.0 WinUISample app.manifest x86;x64;ARM64 - win-x86;win-x64;win-arm64 - win10-x86;win10-x64;win10-arm64 + win-x86;win-x64;win-arm64 win-$(Platform).pubxml true + false true @@ -24,8 +24,8 @@ - - + + @@ -57,4 +57,21 @@ + + + + + + UITests\%(RecursiveDir)%(Filename).cs + + + + + + + + + $(DefineConstants);UI_TESTING;XAML_UI_TESTING;WINUI_UI_TESTING + + diff --git a/src/LiveChartsCore/AssemblyInfo.cs b/src/LiveChartsCore/AssemblyInfo.cs index 1d26b5243..3708e2484 100644 --- a/src/LiveChartsCore/AssemblyInfo.cs +++ b/src/LiveChartsCore/AssemblyInfo.cs @@ -22,16 +22,18 @@ using System.Runtime.CompilerServices; -#if !DEBUG && NET462 +#if STRONG_NAMED_ASSEMBLIES using System.Reflection; [assembly: AssemblyKeyFile("./../../LiveCharts.snk")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d53791eaa0d98b405ca858f39169be6af36ceb7a1bca3ca76c6905fd22fddf8c5e4ef2778a5d7a77ad12f08da711fecfc44795c7923739a2acac946b3f1719a6dfc238695bc69cf5d959b3fb6bc4d18d57a97ff8ed897e6b22a6b8155401ee368d77431e74178104b4adca73520b058b9be28d4ec129beb54871778167afa5ce")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.WinForms, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d53791eaa0d98b405ca858f39169be6af36ceb7a1bca3ca76c6905fd22fddf8c5e4ef2778a5d7a77ad12f08da711fecfc44795c7923739a2acac946b3f1719a6dfc238695bc69cf5d959b3fb6bc4d18d57a97ff8ed897e6b22a6b8155401ee368d77431e74178104b4adca73520b058b9be28d4ec129beb54871778167afa5ce")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.WPF, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d53791eaa0d98b405ca858f39169be6af36ceb7a1bca3ca76c6905fd22fddf8c5e4ef2778a5d7a77ad12f08da711fecfc44795c7923739a2acac946b3f1719a6dfc238695bc69cf5d959b3fb6bc4d18d57a97ff8ed897e6b22a6b8155401ee368d77431e74178104b4adca73520b058b9be28d4ec129beb54871778167afa5ce")] +[assembly: InternalsVisibleTo("CoreTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d53791eaa0d98b405ca858f39169be6af36ceb7a1bca3ca76c6905fd22fddf8c5e4ef2778a5d7a77ad12f08da711fecfc44795c7923739a2acac946b3f1719a6dfc238695bc69cf5d959b3fb6bc4d18d57a97ff8ed897e6b22a6b8155401ee368d77431e74178104b4adca73520b058b9be28d4ec129beb54871778167afa5ce")] #else +[assembly: InternalsVisibleTo("CoreTests")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView")] [assembly: InternalsVisibleTo("LiveChartsCore.Behaviours")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.WinForms")] @@ -44,8 +46,6 @@ [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.Eto")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.Blazor")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.Maui")] -[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage")] -[assembly: InternalsVisibleTo("LiveChartsCore.UnitTesting")] [assembly: InternalsVisibleTo("LiveChartsCore.Vortice")] #endif diff --git a/src/LiveChartsCore/Chart.cs b/src/LiveChartsCore/Chart.cs index 506b08957..6ee08a4d0 100644 --- a/src/LiveChartsCore/Chart.cs +++ b/src/LiveChartsCore/Chart.cs @@ -801,12 +801,9 @@ protected bool IsRendering() // rendered the last frame, if both timestamps are different it means the canvas is rendering // and we are safe to keep measuring, otherwise we skip measuring until the canvas renders a new frame. -#if DEBUG - // hack. - // a flag to to remove this check in unit tests. + // hack. a flag to remove this check in unit tests. if (CoreMotionCanvas.IsTesting) return true; -#endif var canMeasure = Canvas._lastFrameTimestamp != _lastMeasureTimeStamp; diff --git a/src/LiveChartsCore/CoreAxis.cs b/src/LiveChartsCore/CoreAxis.cs index bbe9c89f0..3a70daca8 100644 --- a/src/LiveChartsCore/CoreAxis.cs +++ b/src/LiveChartsCore/CoreAxis.cs @@ -1476,10 +1476,13 @@ private string TryGetLabelOrLogError(Func labeler, double value) { return labeler(value); } +#if DEBUG catch (Exception e) { -#if DEBUG Trace.WriteLine($"[Error] LiveCharts was not able to get a label from axis {_orientation} with value {value}. {e.Message}"); +#else + catch + { #endif return string.Empty; } diff --git a/src/LiveChartsCore/Drawing/BaseLabelGeometry.cs b/src/LiveChartsCore/Drawing/BaseLabelGeometry.cs index e784eb816..5859b1c31 100644 --- a/src/LiveChartsCore/Drawing/BaseLabelGeometry.cs +++ b/src/LiveChartsCore/Drawing/BaseLabelGeometry.cs @@ -194,12 +194,7 @@ bool IDrawnElement.HasSkew /// public string Text { get; set; } = string.Empty; -#if DEBUG - /// - /// This property is only available on debug mode, it indicates if the debug lines should be shown. - /// - public static bool ShowDebugLines { get; set; } -#endif + internal static bool ShowDebugLines { get; set; } Paint? IDrawnElement.Stroke { get; set; } diff --git a/src/LiveChartsCore/Kernel/ActionThrottler.cs b/src/LiveChartsCore/Kernel/ActionThrottler.cs index 5913c5e37..4a98b5eae 100644 --- a/src/LiveChartsCore/Kernel/ActionThrottler.cs +++ b/src/LiveChartsCore/Kernel/ActionThrottler.cs @@ -38,15 +38,13 @@ public class ActionThrottler(Func targetAction, TimeSpan time) private readonly object _sync = new(); private bool _isWaiting = false; -#if DEBUG /// /// Gets the calls. /// /// /// The calls. /// - public int Calls { get; private set; } = 0; -#endif + internal int Calls { get; private set; } = 0; /// /// Gets or sets the throttler time span. @@ -64,9 +62,7 @@ public async void Call() { lock (_sync) { -#if DEBUG Calls++; -#endif if (_isWaiting) return; _isWaiting = true; diff --git a/src/LiveChartsCore/Kernel/Sketches/IChartView.cs b/src/LiveChartsCore/Kernel/Sketches/IChartView.cs index 86185723c..bfe408258 100644 --- a/src/LiveChartsCore/Kernel/Sketches/IChartView.cs +++ b/src/LiveChartsCore/Kernel/Sketches/IChartView.cs @@ -59,13 +59,6 @@ public interface IChartView : IDrawnView /// bool IsDarkMode { get; } - /// - /// Gets or sets whether the chart should force GPU acceleration, this property will only work - /// while globaly is false, when is true, - /// all charts will use GPU acceleration. - /// - bool ForceGPU { get; set; } - /// /// Gets or sets the chart theme. /// diff --git a/src/LiveChartsCore/LiveChartsCore.csproj b/src/LiveChartsCore/LiveChartsCore.csproj index 44d4243fa..0bf90271a 100644 --- a/src/LiveChartsCore/LiveChartsCore.csproj +++ b/src/LiveChartsCore/LiveChartsCore.csproj @@ -1,33 +1,25 @@  - enable - $(GlobalLangVersion) - net462; netstandard2.0; - netstandard2.1; net8.0; LiveChartsCore LiveChartsCore - $(LiveChartsVersion) - icon.png - Simple, flexible, interactive and powerful data visualization for .Net, this is the core package probably you need another package also unless you are building your own backed. - MIT - $(LiveChartsAuthors) - true - snupkg - portable - true - https://github.com/beto-rodriguez/LiveCharts2 + - true - true - true - true + + + + + + + + $(Description) This package contains only the core of the library, you probably need another package that is compatible with you UI framework, unless you are building a custom package. + @@ -35,27 +27,24 @@ - bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - true + bin/$(Configuration)/$(TargetFramework)/$(AssemblyName).xml - - - - - PreserveNewest + + $(DefineConstants);STRONG_NAMED_ASSEMBLIES + + - - - - - + @@ -67,7 +56,7 @@ - + Analyzer false diff --git a/src/LiveChartsCore/Motion/CoreMotionCanvas.cs b/src/LiveChartsCore/Motion/CoreMotionCanvas.cs index 803316b65..f1a74177e 100644 --- a/src/LiveChartsCore/Motion/CoreMotionCanvas.cs +++ b/src/LiveChartsCore/Motion/CoreMotionCanvas.cs @@ -84,22 +84,13 @@ internal CanvasZone[] Zones /// /// Gets the clock elapsed time in milliseconds. /// - public static long ElapsedMilliseconds - { - get - { -#if DEBUG - if (DebugElapsedMilliseconds > -1) - return DebugElapsedMilliseconds; -#endif - return s_clock.ElapsedMilliseconds; - } - } + public static long ElapsedMilliseconds => + DebugElapsedMilliseconds > -1 + ? DebugElapsedMilliseconds + : s_clock.ElapsedMilliseconds; -#if DEBUG internal static long DebugElapsedMilliseconds { get; set; } = -1; internal static bool IsTesting { get; set; } -#endif internal bool DisableAnimations { get; set; } diff --git a/src/LiveChartsCore/Motion/MotionCanvasComposer.cs b/src/LiveChartsCore/Motion/MotionCanvasComposer.cs index 218ba0b24..362e012c9 100644 --- a/src/LiveChartsCore/Motion/MotionCanvasComposer.cs +++ b/src/LiveChartsCore/Motion/MotionCanvasComposer.cs @@ -33,9 +33,8 @@ public class MotionCanvasComposer(IRenderMode renderMode, IFrameTicker ticker) /// Defines the motion canvas rendering factory delegate. /// /// The global rendering settings. - /// Indicates whether GPU mode is forced. /// A MotionCanvasComposer instance. - public delegate MotionCanvasComposer MotionCanvasRenderingFactoryDelegate(RenderingSettings settings, bool forceGPU); + public delegate MotionCanvasComposer MotionCanvasRenderingFactoryDelegate(RenderingSettings settings); /// /// Gets the render mode. diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/AssemblyInfo.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/AssemblyInfo.cs deleted file mode 100644 index 74c554c92..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/AssemblyInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage")] diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/CartesianChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/CartesianChart.cs index 351cf23b3..8321de8d8 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/CartesianChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/CartesianChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.Avalonia; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenCartesianChart class to add avalonia specific -// code, this class is just to expose the CartesianChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/GeoMap.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/GeoMap.cs index 2fea3fb14..4e2d0125a 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/GeoMap.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/GeoMap.cs @@ -23,10 +23,11 @@ using LiveChartsCore.Geo; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenMapChart class to add avalonia specific -// code, this class is just to expose the GeoMap class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== namespace LiveChartsCore.SkiaSharpView.Avalonia; diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj index ef406bccd..646c2ff3b 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj @@ -1,10 +1,8 @@ - + Library - $(GlobalLangVersion) - enable - netstandard2.0;netstandard2.1;net6.0;net8.0; + netstandard2.0;net6.0;net8.0; LiveChartsCore.SkiaSharpView.Avalonia LiveChartsCore.SkiaSharpView.Avalonia @@ -28,8 +26,8 @@ embedded--> - - + + $(DefineConstants);AVALONIA_LVC;XAML_LVC diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PieChart.cs index 5b3af9483..baca22642 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PieChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.Avalonia; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenPieChart class to add avalonia specific -// code, this class is just to expose the PieChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PolarChart.cs index 31166ce91..3f4c981d8 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PolarChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.Avalonia; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenPolarChart class to add avalonia specific -// code, this class is just to expose the PolarChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenCartesianChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenCartesianChart.avalonia.cs similarity index 90% rename from src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenCartesianChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenCartesianChart.avalonia.cs index 4fceb4095..ca76e03cb 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenCartesianChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenCartesianChart.avalonia.cs @@ -29,12 +29,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the Avalonia specific code for the SourceGenCartesianChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Avalonia specific code +// =============================================== /// public partial class SourceGenCartesianChart : SourceGenChart, ICartesianChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenChart.cs similarity index 95% rename from src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenChart.cs index ac5324a04..8f824ca9b 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenChart.cs @@ -39,10 +39,11 @@ namespace LiveChartsGeneratedCode; // ============================================================================== -// -// this file contains the Avalonia specific code for the SourceGenChart class, -// the rest of the code can be found in the _Shared project. -// +// this file is the base class for this UI framework controls, in this file we +// define the UI framework specific code. +// expanding this file in the solution explorer will show 2 more files: +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// @@ -178,9 +179,6 @@ private ISeries InflateSeriesTemplate(object item) return series; } - private static object GetSeriesSource(ISeries series) => - ((Control)series).DataContext!; - bool ICustomHitTest.HitTest(Point point) => new Rect(Bounds.Size).Contains(point); } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenMapChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenMapChart.avalonia.cs similarity index 93% rename from src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenMapChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenMapChart.avalonia.cs index 1078bb850..6f222823c 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenMapChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenMapChart.avalonia.cs @@ -33,12 +33,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the Avalonia specific code for the SourceGenMapChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// ============================================================== +// this file contains the shared code between all UI frameworks +// ============================================================== /// public partial class SourceGenMapChart : UserControl, IGeoMapView, ICustomHitTest diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenPieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenPieChart.avalonia.cs similarity index 88% rename from src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenPieChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenPieChart.avalonia.cs index c2608c398..e66cb959c 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenPieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenPieChart.avalonia.cs @@ -24,12 +24,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the Avalonia specific code for the SourceGenPieChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// ============================================================== +// this file contains the shared code between all UI frameworks +// ============================================================== /// public partial class SourceGenPieChart : SourceGenChart, IPieChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenPolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenPolarChart.avalonia.cs similarity index 88% rename from src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenPolarChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenPolarChart.avalonia.cs index 18f918dec..ac4d85a8c 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsGeneratedCode/SourceGenPolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/SourceGenPolarChart.avalonia.cs @@ -24,12 +24,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the Avalonia specific code for the SourceGenPolarChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// ============================================================== +// this file contains the shared code between all UI frameworks +// ============================================================== /// public partial class SourceGenPolarChart : SourceGenChart, IPolarChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/AssemblyInfo.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/AssemblyInfo.cs index e88214948..bdc6c848c 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/AssemblyInfo.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/AssemblyInfo.cs @@ -22,12 +22,9 @@ using System.Windows; -#if !DEBUG && NET462 +#if STRONG_NAMED_ASSEMBLIES using System.Reflection; [assembly: AssemblyKeyFile("./../../../LiveCharts.snk")] -#else -using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage")] #endif [assembly: ThemeInfo( diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/CartesianChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/CartesianChart.cs index e9d269588..16afc76f7 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/CartesianChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/CartesianChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.WPF; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenCartesianChart class to add wpf specific -// code, this class is just to expose the CartesianChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/GeoMap.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/GeoMap.cs index be46f0159..10315292b 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/GeoMap.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/GeoMap.cs @@ -20,15 +20,16 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using LiveChartsCore.Kernel.Sketches; +using LiveChartsCore.Geo; namespace LiveChartsCore.SkiaSharpView.WPF; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenMapChart class to add wpf specific -// code, this class is just to expose the GeoMap class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsCore.SkiaSharpView.WPF.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsCore.SkiaSharpView.WPF.csproj index 9eebd689a..b2f54a067 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsCore.SkiaSharpView.WPF.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsCore.SkiaSharpView.WPF.csproj @@ -1,8 +1,6 @@ - enable - $(GlobalLangVersion) true @@ -29,8 +27,8 @@ true - - + + $(DefineConstants);WPF_LVC;XAML_LVC @@ -51,6 +49,10 @@ + + $(DefineConstants);STRONG_NAMED_ASSEMBLIES + + all diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/MotionCanvas.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/MotionCanvas.cs index 526234be2..2e5bf674c 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/MotionCanvas.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/MotionCanvas.cs @@ -39,10 +39,10 @@ static MotionCanvas() _ = LiveChartsSkiaSharp .EnsureInitialized() .HasRenderingFactory( - (settings, forceGPU) => + (settings) => { #if NET6_0_OR_GREATER - IRenderMode renderMode = forceGPU || settings.UseGPU + IRenderMode renderMode = settings.UseGPU ? new GPURenderMode() : new CPURenderMode(); @@ -52,7 +52,7 @@ static MotionCanvas() return new MotionCanvasComposer(renderMode, ticker); #else - IRenderMode renderMode = forceGPU || settings.UseGPU + IRenderMode renderMode = settings.UseGPU ? throw new System.Exception("LiveCharts does not support hardware acceleration in WPF .Net Framework.") : new CPURenderMode(); @@ -68,9 +68,9 @@ static MotionCanvas() /// /// Initializes a new instance of the class. /// - public MotionCanvas(bool forceGPU) + public MotionCanvas() { - _composer = LiveChartsSkiaSharp.MotionCanvasRenderingFactory(LiveCharts.RenderingSettings, forceGPU); + _composer = LiveChartsSkiaSharp.MotionCanvasRenderingFactory(LiveCharts.RenderingSettings); _ = Children.Add((UIElement)_composer.RenderMode); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PieChart.cs index 454278067..295449879 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PieChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.WPF; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenPieChart class to add wpf specific -// code, this class is just to expose the PieChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PolarChart.cs index ed3f2a2e2..0f79abd6f 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PolarChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.WPF; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenPolarChart class to add wpf specific -// code, this class is just to expose the PolarChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenCartesianChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenCartesianChart.wpf.cs similarity index 86% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenCartesianChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenCartesianChart.wpf.cs index c8c343fc2..02036aba3 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenCartesianChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenCartesianChart.wpf.cs @@ -28,12 +28,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the WPF specific code for the SourceGenCartesianChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the WPF specific code +// =============================================== /// public partial class SourceGenCartesianChart : SourceGenChart, ICartesianChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenChart.cs similarity index 93% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenChart.cs index 8418ff4e7..05e243e40 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenChart.cs @@ -36,10 +36,11 @@ namespace LiveChartsGeneratedCode; // ============================================================================== -// -// this file contains the WPF specific code for the SourceGenChart class, -// the rest of the code can be found in the _Shared project. -// +// this file is the base class for this UI framework controls, in this file we +// define the UI framework specific code. +// expanding this file in the solution explorer will show 2 more files: +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// @@ -51,7 +52,7 @@ public abstract partial class SourceGenChart : UserControl, IChartView /// Default colors are not valid protected SourceGenChart() { - Content = new MotionCanvas(ForceGPU); + Content = new MotionCanvas(); SizeChanged += (s, e) => CoreChart.Update(); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenMapChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenMapChart.wpf.cs similarity index 87% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenMapChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenMapChart.wpf.cs index 831a94900..94df686b1 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenMapChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenMapChart.wpf.cs @@ -24,7 +24,6 @@ using System.ComponentModel; using System.Windows; using System.Windows.Controls; -using LiveChartsCore; using LiveChartsCore.Drawing; using LiveChartsCore.Geo; using LiveChartsCore.Kernel.Sketches; @@ -33,12 +32,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the WPF specific code for the SourceGenMapChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the WPF specific code +// =============================================== /// public abstract partial class SourceGenMapChart : UserControl, IGeoMapView @@ -49,7 +45,7 @@ public abstract partial class SourceGenMapChart : UserControl, IGeoMapView /// Default colors are not valid protected SourceGenMapChart() { - Content = new MotionCanvas(false); + Content = new MotionCanvas(); SizeChanged += (s, e) => CoreChart.Update(); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenPieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenPieChart.wpf.cs similarity index 81% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenPieChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenPieChart.wpf.cs index 7b8757f54..57d3cb5e7 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenPieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenPieChart.wpf.cs @@ -24,12 +24,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the Eto specific code for the SourceGenPieChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the WPF specific code +// =============================================== /// public partial class SourceGenPieChart : SourceGenChart, IPieChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenPolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenPolarChart.wpf.cs similarity index 81% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenPolarChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenPolarChart.wpf.cs index c726e91f6..c63c737fa 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenPolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/SourceGenPolarChart.wpf.cs @@ -24,12 +24,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the Eto specific code for the SourceGenPolarChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the WPF specific code +// =============================================== /// public partial class SourceGenPolarChart : SourceGenChart, IPolarChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/AssemblyInfo.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/AssemblyInfo.cs index a21d8a792..b2478b6e7 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/AssemblyInfo.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/AssemblyInfo.cs @@ -1,4 +1,4 @@ -// The MIT License(MIT) +// The MIT License(MIT) // // Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors // @@ -20,11 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#if !DEBUG && NET462 +#if STRONG_NAMED_ASSEMBLIES using System.Reflection; [assembly: AssemblyKeyFile("./../../../LiveCharts.snk")] -#else -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage")] #endif diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/CartesianChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/CartesianChart.cs index 9c4d8460f..94a2e4c82 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/CartesianChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/CartesianChart.cs @@ -25,12 +25,14 @@ namespace LiveChartsCore.SkiaSharpView.WinForms; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenCartesianChart class to add winforms specific -// code, this class is just to expose the CartesianChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// +[System.ComponentModel.DesignerCategory("")] public partial class CartesianChart : LiveChartsGeneratedCode.SourceGenCartesianChart { } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/GeoMap.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/GeoMap.cs index 5bb28b447..59dd4e348 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/GeoMap.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/GeoMap.cs @@ -20,17 +20,19 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using LiveChartsCore.Kernel.Sketches; +using LiveChartsCore.Geo; namespace LiveChartsCore.SkiaSharpView.WinForms; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenMapChart class to add winui/uno specific -// code, this class is just to expose the GeoMap class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// +[System.ComponentModel.DesignerCategory("")] public sealed partial class GeoMap : LiveChartsGeneratedCode.SourceGenMapChart { } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj index 9f079c626..ab4496e53 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj @@ -1,9 +1,6 @@ - $(GlobalLangVersion) - enable - WinExe true Library @@ -32,7 +29,7 @@ true - + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml @@ -50,6 +47,10 @@ + + $(DefineConstants);STRONG_NAMED_ASSEMBLIES + + all diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/MotionCanvas.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/MotionCanvas.cs index aea3f6a20..3d8ac3d46 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/MotionCanvas.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/MotionCanvas.cs @@ -20,9 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using System; using System.ComponentModel; -using System.Windows.Forms; using LiveChartsCore.Kernel.Sketches; using LiveChartsCore.Motion; using LiveChartsCore.SkiaSharpView.Drawing; @@ -35,6 +33,7 @@ namespace LiveChartsCore.SkiaSharpView.WinForms; /// The motion canvas control for windows forms, . /// /// +[DesignerCategory("")] public partial class MotionCanvas : UserControl, IRenderMode { private IFrameTicker _ticker = null!; diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PieChart.cs index 1ab69a6e2..ef5bf317c 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PieChart.cs @@ -25,12 +25,14 @@ namespace LiveChartsCore.SkiaSharpView.WinForms; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenPieChart class to add winforms specific -// code, this class is just to expose the PieChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// +[System.ComponentModel.DesignerCategory("")] public partial class PieChart : LiveChartsGeneratedCode.SourceGenPieChart { } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PolarChart.cs index 6bc199098..063ebbd74 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PolarChart.cs @@ -25,12 +25,14 @@ namespace LiveChartsCore.SkiaSharpView.WinForms; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenPolarChart class to add winforms specific -// code, this class is just to expose the PolarChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// +[System.ComponentModel.DesignerCategory("")] public partial class PolarChart : LiveChartsGeneratedCode.SourceGenPolarChart { } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenCartesianChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenCartesianChart.winforms.cs similarity index 86% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenCartesianChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenCartesianChart.winforms.cs index 4b358c960..ee57bb8bb 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenCartesianChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenCartesianChart.winforms.cs @@ -28,12 +28,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the WinForms specific code for the SourceGenCartesianChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Winforms specific code +// =============================================== /// public partial class SourceGenCartesianChart : SourceGenChart, ICartesianChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenCartesianChart.resx b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenCartesianChart.winforms.resx similarity index 100% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenCartesianChart.resx rename to src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenCartesianChart.winforms.resx diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenChart.cs similarity index 93% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenChart.cs index edb034874..fed52ab1d 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenChart.cs @@ -32,13 +32,15 @@ namespace LiveChartsGeneratedCode; // ============================================================================== -// -// this file contains the WinForms specific code for the SourceGenChart class, -// the rest of the code can be found in the _Shared project. -// +// this file is the base class for this UI framework controls, in this file we +// define the UI framework specific code. +// expanding this file in the solution explorer will show 2 more files: +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// +[DesignerCategory("")] public abstract partial class SourceGenChart : UserControl, IChartView { /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenChart.resx b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenChart.resx similarity index 100% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenChart.resx rename to src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenChart.resx diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenMapChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenMapChart.winforms.cs similarity index 91% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenMapChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenMapChart.winforms.cs index 45a8cff9f..85f3cb92c 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenMapChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenMapChart.winforms.cs @@ -32,12 +32,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the WinForms specific code for the SourceGenMapChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Winforms specific code +// =============================================== /// public abstract partial class SourceGenMapChart : UserControl, IGeoMapView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenMapChart.resx b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenMapChart.winforms.resx similarity index 100% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenMapChart.resx rename to src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenMapChart.winforms.resx diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenPieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenPieChart.winforms.cs similarity index 81% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenPieChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenPieChart.winforms.cs index 56993e607..ce297f187 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenPieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenPieChart.winforms.cs @@ -24,12 +24,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the WPF specific code for the SourceGenPieChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Winforms specific code +// =============================================== /// public partial class SourceGenPieChart : SourceGenChart, IPieChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenPolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenPolarChart.winforms.cs similarity index 81% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenPolarChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenPolarChart.winforms.cs index 2fae6c184..5cce119aa 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsGeneratedCode/SourceGenPolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenPolarChart.winforms.cs @@ -24,12 +24,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the WPF specific code for the SourceGenPolarChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Winforms specific code +// =============================================== /// public partial class SourceGenPolarChart : SourceGenChart, IPolarChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenPolarChart.resx b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenPolarChart.winforms.resx similarity index 100% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenPolarChart.resx rename to src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/SourceGenPolarChart.winforms.resx diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/AssemblyInfo.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/AssemblyInfo.cs index c3798ddeb..2f8481f63 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/AssemblyInfo.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/AssemblyInfo.cs @@ -22,16 +22,18 @@ using System.Runtime.CompilerServices; -#if !DEBUG && NET462 +#if STRONG_NAMED_ASSEMBLIES using System.Reflection; [assembly: AssemblyKeyFile("./../../../LiveCharts.snk")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d53791eaa0d98b405ca858f39169be6af36ceb7a1bca3ca76c6905fd22fddf8c5e4ef2778a5d7a77ad12f08da711fecfc44795c7923739a2acac946b3f1719a6dfc238695bc69cf5d959b3fb6bc4d18d57a97ff8ed897e6b22a6b8155401ee368d77431e74178104b4adca73520b058b9be28d4ec129beb54871778167afa5ce")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.WinForms, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d53791eaa0d98b405ca858f39169be6af36ceb7a1bca3ca76c6905fd22fddf8c5e4ef2778a5d7a77ad12f08da711fecfc44795c7923739a2acac946b3f1719a6dfc238695bc69cf5d959b3fb6bc4d18d57a97ff8ed897e6b22a6b8155401ee368d77431e74178104b4adca73520b058b9be28d4ec129beb54871778167afa5ce")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.WPF, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d53791eaa0d98b405ca858f39169be6af36ceb7a1bca3ca76c6905fd22fddf8c5e4ef2778a5d7a77ad12f08da711fecfc44795c7923739a2acac946b3f1719a6dfc238695bc69cf5d959b3fb6bc4d18d57a97ff8ed897e6b22a6b8155401ee368d77431e74178104b4adca73520b058b9be28d4ec129beb54871778167afa5ce")] +[assembly: InternalsVisibleTo("CoreTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d53791eaa0d98b405ca858f39169be6af36ceb7a1bca3ca76c6905fd22fddf8c5e4ef2778a5d7a77ad12f08da711fecfc44795c7923739a2acac946b3f1719a6dfc238695bc69cf5d959b3fb6bc4d18d57a97ff8ed897e6b22a6b8155401ee368d77431e74178104b4adca73520b058b9be28d4ec129beb54871778167afa5ce")] #else +[assembly: InternalsVisibleTo("CoreTests")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView")] [assembly: InternalsVisibleTo("LiveChartsCore.Behaviours")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.WinForms")] @@ -44,8 +46,6 @@ [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.Eto")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.Blazor")] [assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.Maui")] -[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage")] -[assembly: InternalsVisibleTo("LiveChartsCore.UnitTesting")] #endif diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsCore.SkiaSharpView.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsCore.SkiaSharpView.csproj index e24957d2f..de9aad95c 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsCore.SkiaSharpView.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsCore.SkiaSharpView.csproj @@ -1,37 +1,28 @@  - enable - $(GlobalLangVersion) - net462; netstandard2.0; - netstandard2.1; net8.0; LiveChartsCore.SkiaSharpView LiveChartsCore.SkiaSharpView - $(LiveChartsVersion) - icon.png - Simple, flexible, interactive and powerful data visualization for .Net, this package contains the SkiaSharp backend. - MIT - $(LiveChartsAuthors) - true - snupkg - portable - true - https://github.com/beto-rodriguez/LiveCharts2 - - true - true - true - true - + + + + + + + + $(Description) This package renders charts using SkiaSharp, this is enough if you only need to render images otherwise you probably need another package that is compatible with your UI framework. + + + @@ -44,7 +35,6 @@ bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - true @@ -57,6 +47,10 @@ + + $(DefineConstants);STRONG_NAMED_ASSEMBLIES + + all @@ -71,8 +65,4 @@ - - - - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsSkiaSharp.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsSkiaSharp.cs index 476baabd5..476bf8b4c 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsSkiaSharp.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsSkiaSharp.cs @@ -20,7 +20,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using System; using LiveChartsCore.Drawing; using LiveChartsCore.Kernel; using LiveChartsCore.Kernel.Sketches; @@ -39,7 +38,7 @@ namespace LiveChartsCore.SkiaSharpView; public static class LiveChartsSkiaSharp { internal static MotionCanvasComposer.MotionCanvasRenderingFactoryDelegate MotionCanvasRenderingFactory { get; set; } = - (settings, chart) => throw new NotImplementedException( + (settings) => throw new NotImplementedException( "No motion canvas rendering factory has been set, please use the method 'HasMotionCanvasRenderingFactory' to set one."); internal static TextSettings DefaultTextSettings { get; set; } = new(); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/images/icon.png b/src/skiasharp/LiveChartsCore.SkiaSharp/images/icon.png deleted file mode 100644 index d0c1c5660..000000000 Binary files a/src/skiasharp/LiveChartsCore.SkiaSharp/images/icon.png and /dev/null differ diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/AssemblyInfo.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/AssemblyInfo.cs deleted file mode 100644 index 74c554c92..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/AssemblyInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage")] diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/CartesianChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/CartesianChart.cs new file mode 100644 index 000000000..e9f665a35 --- /dev/null +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/CartesianChart.cs @@ -0,0 +1,38 @@ +// The MIT License(MIT) +// +// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using LiveChartsCore.Kernel.Sketches; +using LiveChartsGeneratedCode; + +namespace LiveChartsCore.SkiaSharpView.Blazor; + +// ============================================================================== +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties +// ============================================================================== + +/// +public partial class CartesianChart : SourceGenCartesianChart, ICartesianChartView +{ } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/CartesianChart.razor b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/CartesianChart.razor deleted file mode 100644 index c118f7234..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/CartesianChart.razor +++ /dev/null @@ -1,38 +0,0 @@ -@* - The MIT License(MIT) - - Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*@ - -@inherits LiveChartsGeneratedCode.SourceGenCartesianChart - -@* -============================================================================== - -use the LiveChartsGeneratedCode.SourceGenCartesianChart class to add blazor specific -code, this class is just to expose the CartesianChart class in this namespace. - -============================================================================== -*@ - -@{ - base.BuildRenderTree(__builder); -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/GeoMap.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/GeoMap.cs new file mode 100644 index 000000000..d99c789c8 --- /dev/null +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/GeoMap.cs @@ -0,0 +1,38 @@ +// The MIT License(MIT) +// +// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using LiveChartsCore.Geo; +using LiveChartsGeneratedCode; + +namespace LiveChartsCore.SkiaSharpView.Blazor; + +// ============================================================================== +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties +// ============================================================================== + +/// +public partial class GeoMap : SourceGenMapChart +{ } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/GeoMap.razor b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/GeoMap.razor deleted file mode 100644 index 191f55845..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/GeoMap.razor +++ /dev/null @@ -1,39 +0,0 @@ -@* - The MIT License(MIT) - - Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*@ - -@inherits LiveChartsGeneratedCode.SourceGenMapChart - -@* -============================================================================== - -use the LiveChartsGeneratedCode.SourceGenMapChart class to add blazor specific -code, this class is just to expose the MapChart class in this namespace. - -============================================================================== -*@ - -@{ - base.BuildRenderTree(__builder); -} - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenCartesianChart.razor b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenCartesianChart.razor deleted file mode 100644 index 1df571998..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenCartesianChart.razor +++ /dev/null @@ -1,31 +0,0 @@ -@* - The MIT License(MIT) - - Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*@ - -@namespace LiveChartsGeneratedCode - -@inherits SourceGenChart - -@{ - base.BuildRenderTree(__builder); -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenChart.razor b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenChart.razor deleted file mode 100644 index fb1b821ba..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenChart.razor +++ /dev/null @@ -1,36 +0,0 @@ -@* - The MIT License(MIT) - - Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*@ - -@using LiveChartsCore.SkiaSharpView.Blazor - -@namespace LiveChartsGeneratedCode - - - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenMapChart.razor b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenMapChart.razor deleted file mode 100644 index 048195b9a..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenMapChart.razor +++ /dev/null @@ -1,31 +0,0 @@ -@* - The MIT License(MIT) - - Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*@ - -@using LiveChartsCore.SkiaSharpView.Blazor - -@namespace LiveChartsGeneratedCode - - - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenPieChart.razor b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenPieChart.razor deleted file mode 100644 index 1df571998..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenPieChart.razor +++ /dev/null @@ -1,31 +0,0 @@ -@* - The MIT License(MIT) - - Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*@ - -@namespace LiveChartsGeneratedCode - -@inherits SourceGenChart - -@{ - base.BuildRenderTree(__builder); -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenPolarChart.razor b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenPolarChart.razor deleted file mode 100644 index 1df571998..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenPolarChart.razor +++ /dev/null @@ -1,31 +0,0 @@ -@* - The MIT License(MIT) - - Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*@ - -@namespace LiveChartsGeneratedCode - -@inherits SourceGenChart - -@{ - base.BuildRenderTree(__builder); -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveChartsCore.SkiaSharpView.Blazor.csproj b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveChartsCore.SkiaSharpView.Blazor.csproj index 6f0374a35..cd9d9304a 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveChartsCore.SkiaSharpView.Blazor.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveChartsCore.SkiaSharpView.Blazor.csproj @@ -1,9 +1,6 @@  - $(GlobalLangVersion) - enable - net6.0;net8.0 enable @@ -27,7 +24,7 @@ true - + $(DefineConstants);BLAZOR_LVC @@ -74,4 +71,5 @@ + diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/PieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/PieChart.cs new file mode 100644 index 000000000..909cb09f0 --- /dev/null +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/PieChart.cs @@ -0,0 +1,39 @@ +// The MIT License(MIT) +// +// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using LiveChartsCore.Kernel.Sketches; +using LiveChartsGeneratedCode; + +namespace LiveChartsCore.SkiaSharpView.Blazor; + +// ============================================================================== +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties +// ============================================================================== + +/// +public partial class PieChart : SourceGenPieChart +{ } + diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/PieChart.razor b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/PieChart.razor deleted file mode 100644 index 7559fca9a..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/PieChart.razor +++ /dev/null @@ -1,38 +0,0 @@ -@* - The MIT License(MIT) - - Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*@ - -@inherits LiveChartsGeneratedCode.SourceGenPieChart - -@* -============================================================================== - -use the LiveChartsGeneratedCode.SourceGenPieChart class to add blazor specific -code, this class is just to expose the PieChart class in this namespace. - -============================================================================== -*@ - -@{ - base.BuildRenderTree(__builder); -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/PolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/PolarChart.cs new file mode 100644 index 000000000..213d873eb --- /dev/null +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/PolarChart.cs @@ -0,0 +1,39 @@ +// The MIT License(MIT) +// +// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using LiveChartsCore.Kernel.Sketches; +using LiveChartsGeneratedCode; + +namespace LiveChartsCore.SkiaSharpView.Blazor; + +// ============================================================================== +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties +// ============================================================================== + +/// +public partial class PolarChart : SourceGenPolarChart +{ } + diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/PolarChart.razor b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/PolarChart.razor deleted file mode 100644 index fca54952c..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/PolarChart.razor +++ /dev/null @@ -1,38 +0,0 @@ -@* - The MIT License(MIT) - - Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*@ - -@inherits LiveChartsGeneratedCode.SourceGenPolarChart - -@* -============================================================================== - -use the LiveChartsGeneratedCode.SourceGenPolarChart class to add blazor specific -code, this class is just to expose the PolarChart class in this namespace. - -============================================================================== -*@ - -@{ - base.BuildRenderTree(__builder); -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenCartesianChart.razor.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenCartesianChart.blazor.cs similarity index 82% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenCartesianChart.razor.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenCartesianChart.blazor.cs index c99785668..5b4c9768b 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenCartesianChart.razor.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenCartesianChart.blazor.cs @@ -24,20 +24,24 @@ using LiveChartsCore.Drawing; using LiveChartsCore.Kernel.Sketches; using LiveChartsCore.Measure; +using Microsoft.AspNetCore.Components.Rendering; using Microsoft.AspNetCore.Components.Web; namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the Blazor specific code for the CartesianChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Blazor specific code +// =============================================== /// public partial class SourceGenCartesianChart : SourceGenChart, ICartesianChartView { + /// + /// Builds the render tree. + /// + protected override void BuildRenderTree(RenderTreeBuilder builder) => + base.BuildRenderTree(builder); + /// protected override void OnWheel(WheelEventArgs e) { diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenChart.razor.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenChart.cs similarity index 77% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenChart.razor.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenChart.cs index bfddd1a50..f0d14ef96 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenChart.razor.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenChart.cs @@ -25,19 +25,21 @@ using LiveChartsCore.Motion; using LiveChartsCore.SkiaSharpView.Blazor; using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Rendering; using Microsoft.AspNetCore.Components.Web; namespace LiveChartsGeneratedCode; // ============================================================================== -// -// this file contains the Blazor specific code for the ChartControl class, -// the rest of the code can be found in the _Shared project. -// +// this file is the base class for this UI framework controls, in this file we +// define the UI framework specific code. +// expanding this file in the solution explorer will show 2 more files: +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// -public abstract partial class SourceGenChart : IDisposable, IChartView +public abstract partial class SourceGenChart : ComponentBase, IDisposable, IChartView { #pragma warning disable IDE0032 // Use auto property, blazor ref private MotionCanvas _motionCanvas = null!; @@ -58,6 +60,22 @@ protected SourceGenChart() /// public CoreMotionCanvas CoreCanvas => _motionCanvas.CanvasCore; + /// + /// Builds the render tree. + /// + protected override void BuildRenderTree(RenderTreeBuilder builder) + { + base.BuildRenderTree(builder); + builder.OpenComponent(0); + builder.AddAttribute(1, "OnPointerDownCallback", EventCallback.Factory.Create(this, OnPointerDown)); + builder.AddAttribute(2, "OnPointerMoveCallback", EventCallback.Factory.Create(this, OnPointerMove)); + builder.AddAttribute(3, "OnPointerUpCallback", EventCallback.Factory.Create(this, OnPointerUp)); + builder.AddAttribute(4, "OnPointerOutCallback", EventCallback.Factory.Create(this, OnPointerOut)); + builder.AddAttribute(5, "OnWheelCallback", EventCallback.Factory.Create(this, OnWheel)); + builder.AddComponentReferenceCapture(7, r => _motionCanvas = (MotionCanvas)r); + builder.CloseComponent(); + } + /// protected override void OnAfterRender(bool firstRender) { diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenMapChart.razor.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenMapChart.blazor.cs similarity index 79% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenMapChart.razor.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenMapChart.blazor.cs index 1e0160f1e..3dc3acc34 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenMapChart.razor.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenMapChart.blazor.cs @@ -25,18 +25,17 @@ using LiveChartsCore.Kernel.Sketches; using LiveChartsCore.Motion; using LiveChartsCore.SkiaSharpView.Blazor; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Rendering; namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the Blazor specific code for the SourceGenMapChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Blazor specific code +// =============================================== /// -public abstract partial class SourceGenMapChart : IDisposable, IGeoMapView +public abstract partial class SourceGenMapChart : ComponentBase, IDisposable, IGeoMapView { #pragma warning disable IDE0032 // Use auto property, blazor ref private MotionCanvas _motionCanvas = null!; @@ -61,6 +60,16 @@ protected SourceGenMapChart() Height = _motionCanvas.Height }; + /// + /// Builds the render tree. + /// + protected override void BuildRenderTree(RenderTreeBuilder builder) + { + builder.OpenComponent(0); + builder.AddComponentReferenceCapture(1, r => _motionCanvas = (MotionCanvas)r); + builder.CloseComponent(); + } + /// protected override void OnAfterRender(bool firstRender) { diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenPieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenPieChart.blazor.cs similarity index 78% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenPieChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenPieChart.blazor.cs index b50e1d0de..761366a51 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenPieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenPieChart.blazor.cs @@ -21,16 +21,20 @@ // SOFTWARE. using LiveChartsCore.Kernel.Sketches; +using Microsoft.AspNetCore.Components.Rendering; namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the MAUI specific code for the SourceGenPieChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Blazor specific code +// =============================================== /// public partial class SourceGenPieChart : SourceGenChart, IPieChartView -{ } +{ + /// + /// Builds the render tree. + /// + protected override void BuildRenderTree(RenderTreeBuilder builder) => + base.BuildRenderTree(builder); +} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenPolarChart.razor.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenPolarChart.blazor.cs similarity index 78% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenPolarChart.razor.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenPolarChart.blazor.cs index b55f99152..030832c4f 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenPolarChart.razor.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/SourceGenPolarChart.blazor.cs @@ -21,16 +21,20 @@ // SOFTWARE. using LiveChartsCore.Kernel.Sketches; +using Microsoft.AspNetCore.Components.Rendering; namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the Blazor specific code for the PolarChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Blazor specific code +// =============================================== /// public partial class SourceGenPolarChart : SourceGenChart, IPolarChartView -{ } +{ + /// + /// Builds the render tree. + /// + protected override void BuildRenderTree(RenderTreeBuilder builder) => + base.BuildRenderTree(builder); +} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/AssemblyInfo.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/AssemblyInfo.cs deleted file mode 100644 index 74c554c92..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/AssemblyInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage")] diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/CartesianChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/CartesianChart.cs index ce2815d32..91f7be668 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/CartesianChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/CartesianChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.Eto; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenCartesianChart class to add eto specific -// code, this class is just to expose the CartesianChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/GeoMap.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/GeoMap.cs index a75ac0a0f..a4909b644 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/GeoMap.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/GeoMap.cs @@ -23,10 +23,11 @@ using LiveChartsCore.Geo; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenMapChart class to add eto specific -// code, this class is just to expose the GeoMap class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== namespace LiveChartsCore.SkiaSharpView.Eto; diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsCore.SkiaSharpView.Eto.csproj b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsCore.SkiaSharpView.Eto.csproj index a5ff4f487..86aa81602 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsCore.SkiaSharpView.Eto.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsCore.SkiaSharpView.Eto.csproj @@ -2,9 +2,7 @@ Library - $(GlobalLangVersion) - enable - netstandard2.0;netstandard2.1; + netstandard2.0; LiveChartsCore.SkiaSharpView.Eto LiveChartsCore.SkiaSharpView.Eto $(LiveChartsVersion) @@ -24,7 +22,7 @@ true - + true diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PieChart.cs index 6f02682c9..15b60eb6c 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PieChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.Eto; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenPieChart class to add eto specific -// code, this class is just to expose the PieChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PolarChart.cs index 274d8d511..c27c3203d 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PolarChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.Eto; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenPolarChart class to add eto specific -// code, this class is just to expose the PolarChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenCartesianChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenCartesianChart.eto.cs similarity index 86% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenCartesianChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenCartesianChart.eto.cs index 406623b95..6e1a14f57 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenCartesianChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenCartesianChart.eto.cs @@ -28,12 +28,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the ETO specific code for the SourceGenCartesianChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Eto specific code +// =============================================== /// public partial class SourceGenCartesianChart : SourceGenChart, ICartesianChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenChart.cs similarity index 92% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenChart.cs index a0e6f1590..686a0c1f7 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenChart.cs @@ -31,10 +31,11 @@ namespace LiveChartsGeneratedCode; // ============================================================================== -// -// this file contains the Eto specific code for the SourceGenChart class, -// the rest of the code can be found in the _Shared project. -// +// this file is the base class for this UI framework controls, in this file we +// define the UI framework specific code. +// expanding this file in the solution explorer will show 2 more files: +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenMapChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenMapChart.eto.cs similarity index 88% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenMapChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenMapChart.eto.cs index e5bdce3c7..2b68f9c2b 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsGeneratedCode/SourceGenMapChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenMapChart.eto.cs @@ -31,12 +31,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the Eto specific code for the SourceGenMapChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Eto specific code +// =============================================== /// public abstract partial class SourceGenMapChart : Panel, IGeoMapView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenPieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenPieChart.eto.cs similarity index 81% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenPieChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenPieChart.eto.cs index dc864a362..a343c50a2 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenPieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenPieChart.eto.cs @@ -24,12 +24,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the WinForms specific code for the SourceGenPieChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Eto specific code +// =============================================== /// public partial class SourceGenPieChart : SourceGenChart, IPieChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenPolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenPolarChart.eto.cs similarity index 81% rename from src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenPolarChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenPolarChart.eto.cs index 9178c17ec..6574e7795 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsGeneratedCode/SourceGenPolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/SourceGenPolarChart.eto.cs @@ -24,12 +24,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the WinForms specific code for the SourceGenPolarChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the Eto specific code +// =============================================== /// public partial class SourceGenPolarChart : SourceGenChart, IPolarChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/AssemblyInfo.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/AssemblyInfo.cs deleted file mode 100644 index 74c554c92..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/AssemblyInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage")] diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/CartesianChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/CartesianChart.cs index c5af93463..98d3cd954 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/CartesianChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/CartesianChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.Maui; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenCartesianChart class to add maui specific -// code, this class is just to expose the CartesianChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/GeoMap.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/GeoMap.cs index 9c995968a..6d77a7206 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/GeoMap.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/GeoMap.cs @@ -23,10 +23,11 @@ using LiveChartsCore.Geo; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenMapChart class to add MAUI specific -// code, this class is just to expose the GeoMap class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== namespace LiveChartsCore.SkiaSharpView.Maui; diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj index 501e8d825..2473b124f 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj @@ -1,17 +1,17 @@ - enable - $(GlobalLangVersion) - + disable true - net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst; + net9.0;net9.0-android;net9.0-ios;net9.0-maccatalyst; + net10.0;net10.0-android;net10.0-ios;net10.0-maccatalyst; $(TargetFrameworks); - net8.0-windows10.0.19041.0 + net9.0-windows10.0.19041.0; + net10.0-windows10.0.19041.0; 11.0 @@ -21,8 +21,6 @@ 10.0.17763.0 6.5 - win-x86;win-x64;win-arm64 - $(LiveChartsVersion) icon.png Simple, flexible, interactive and powerful data visualization for Maui. @@ -42,19 +40,42 @@ true - - - + + + $(NoWarn);NETSDK1206 + + + + + $(DefineConstants);MAUI_LVC;XAML_LVC + + + + 9.0.120 + + + 10.0.0 + + + - + + + + + diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/MotionCanvas.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/MotionCanvas.cs index ad2a9d275..4451e4443 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/MotionCanvas.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/MotionCanvas.cs @@ -49,9 +49,9 @@ static MotionCanvas() _ = LiveChartsSkiaSharp .EnsureInitialized() .HasRenderingFactory( - (settings, forceGPU) => + (settings) => { - IRenderMode renderMode = forceGPU || settings.UseGPU + IRenderMode renderMode = settings.UseGPU ? new GPURenderMode() : new CPURenderMode(); @@ -66,9 +66,9 @@ static MotionCanvas() /// /// Initializes a new instance of the class. /// - public MotionCanvas(bool forceGPU) + public MotionCanvas() { - _composer = LiveChartsSkiaSharp.MotionCanvasRenderingFactory(LiveCharts.RenderingSettings, forceGPU); + _composer = LiveChartsSkiaSharp.MotionCanvasRenderingFactory(LiveCharts.RenderingSettings); var view = (View)_composer.RenderMode; AbsoluteLayout.SetLayoutBounds(view, new(0, 0, 1, 1)); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/PieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/PieChart.cs index 804fdd288..231fe703c 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/PieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/PieChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.Maui; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenPieChart class to add maui specific -// code, this class is just to expose the PieChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/PolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/PolarChart.cs index 2e6830e84..7e0c27bf8 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/PolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/PolarChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.Maui; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenPolarChart class to add maui specific -// code, this class is just to expose the PolarChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenCartesianChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenCartesianChart.maui.cs similarity index 87% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenCartesianChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenCartesianChart.maui.cs index dfd1d194c..f26ea94de 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenCartesianChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenCartesianChart.maui.cs @@ -27,12 +27,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the MAUI specific code for the SourceGenCartesianChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the MAUI specific code +// =============================================== /// public partial class SourceGenCartesianChart : SourceGenChart, ICartesianChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenChart.cs similarity index 93% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenChart.cs index fa6b87690..fa4df7243 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenChart.cs @@ -33,10 +33,11 @@ namespace LiveChartsGeneratedCode; // ============================================================================== -// -// this file contains the MAUI specific code for the SourceGenChart class, -// the rest of the code can be found in the _Shared project. -// +// this file is the base class for this UI framework controls, in this file we +// define the UI framework specific code. +// expanding this file in the solution explorer will show 2 more files: +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// @@ -47,7 +48,7 @@ public abstract partial class SourceGenChart : ChartView, IChartView /// protected SourceGenChart() { - Content = new MotionCanvas(ForceGPU); + Content = new MotionCanvas(); SizeChanged += (s, e) => CoreChart.Update(); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenMapChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenMapChart.maui.cs similarity index 86% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenMapChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenMapChart.maui.cs index 9353ecb5b..359ea3fda 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenMapChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenMapChart.maui.cs @@ -30,12 +30,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the MAUI specific code for the SourceGenMapChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the MAUI specific code +// =============================================== /// public abstract partial class SourceGenMapChart : ChartView, IGeoMapView @@ -45,7 +42,7 @@ public abstract partial class SourceGenMapChart : ChartView, IGeoMapView /// protected SourceGenMapChart() { - Content = new MotionCanvas(false); + Content = new MotionCanvas(); SizeChanged += (s, e) => CoreChart.Update(); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenPieChart.razor.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenPieChart.maui.cs similarity index 81% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenPieChart.razor.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenPieChart.maui.cs index 905002901..d3f561907 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveCharetsGeneratedCode/SourceGenPieChart.razor.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenPieChart.maui.cs @@ -24,12 +24,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the Blazor specific code for the PieChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the MAUI specific code +// =============================================== /// public partial class SourceGenPieChart : SourceGenChart, IPieChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenPolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenPolarChart.maui.cs similarity index 81% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenPolarChart.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenPolarChart.maui.cs index af26e16a6..b6f4adf65 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsGeneratedCode/SourceGenPolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/SourceGenPolarChart.maui.cs @@ -24,12 +24,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the MAUI specific code for the SourceGenPolarChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the MAUI specific code +// =============================================== /// public partial class SourceGenPolarChart : SourceGenChart, IPolarChartView diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/AssemblyInfo.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/AssemblyInfo.cs deleted file mode 100644 index 74c554c92..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/AssemblyInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage")] diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/LiveChartsCore.SkiaSharpView.Uno.WinUI.csproj b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/LiveChartsCore.SkiaSharpView.Uno.WinUI.csproj index 4422fc387..74edd9e12 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/LiveChartsCore.SkiaSharpView.Uno.WinUI.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/LiveChartsCore.SkiaSharpView.Uno.WinUI.csproj @@ -1,21 +1,18 @@ - + - enable - $(GlobalLangVersion) - true Library $(LatestSkiaSharpVersion) - net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst; - net9.0;net9.0-android;net9.0-ios;net9.0-browserwasm;net9.0-desktop + net9.0;net9.0-android;net9.0-ios;net9.0-browserwasm;net9.0-desktop; + net10.0;net10.0-android;net10.0-ios;net10.0-browserwasm;net10.0-desktop $(TargetFrameworks); - net8.0-windows10.0.19041.0; - net9.0-windows10.0.26100.0; + net9.0-windows10.0.19041.0; + net10.0-windows10.0.19041.0; true @@ -51,10 +48,10 @@ - - - - + + + + $(DefineConstants);UNO_LVC;WINUI_LVC;XAML_LVC diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/SkiaRenderer/SkiaRenderMode.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/Rendering/SkiaRenderMode.cs similarity index 98% rename from src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/SkiaRenderer/SkiaRenderMode.cs rename to src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/Rendering/SkiaRenderMode.cs index 01ee3c901..1c6d4712d 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/SkiaRenderer/SkiaRenderMode.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/Rendering/SkiaRenderMode.cs @@ -34,7 +34,7 @@ using Uno.WinUI.Graphics2DSK; using Windows.Foundation; -namespace LiveChartsCore.SkiaSharpView.WinUI.SkiaRenderer; +namespace LiveChartsCore.SkiaSharpView.WinUI.Rendering; internal partial class SkiaRenderMode : Grid, IRenderMode { diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/readme.txt b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/readme.txt deleted file mode 100644 index ff1a68d48..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ - -Most of the code is at the _Shared.WinUI project. -because the code is shared between WinUI and Uno diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/AssemblyInfo.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/AssemblyInfo.cs deleted file mode 100644 index 74c554c92..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/AssemblyInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage")] diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj b/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj index 0dcb13a6f..125255461 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj @@ -1,8 +1,5 @@  - $(GlobalLangVersion) - enable - net6.0-windows10.0.19041.0; net8.0-windows10.0.19041.0; @@ -34,10 +31,10 @@ true - - - - + + + + $(DefineConstants);WINUI_LVC;XAML_LVC @@ -60,7 +57,6 @@ - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/readme.txt b/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/readme.txt deleted file mode 100644 index ff1a68d48..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ - -Most of the code is at the _Shared.WinUI project. -because the code is shared between WinUI and Uno diff --git a/src/skiasharp/_Shared.WinUI/CartesianChart.cs b/src/skiasharp/_Shared.WinUI/CartesianChart.cs index 7e61bff9c..fc7380c08 100644 --- a/src/skiasharp/_Shared.WinUI/CartesianChart.cs +++ b/src/skiasharp/_Shared.WinUI/CartesianChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.WinUI; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenCartesianChart class to add winui/uno specific -// code, this class is just to expose the CartesianChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/_Shared.WinUI/GeoMap.cs b/src/skiasharp/_Shared.WinUI/GeoMap.cs index efb6e3486..c704cbd85 100644 --- a/src/skiasharp/_Shared.WinUI/GeoMap.cs +++ b/src/skiasharp/_Shared.WinUI/GeoMap.cs @@ -20,15 +20,16 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using LiveChartsCore.Kernel.Sketches; +using LiveChartsCore.Geo; namespace LiveChartsCore.SkiaSharpView.WinUI; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenMapChart class to add winui/uno specific -// code, this class is just to expose the GeoMap class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/_Shared.WinUI/MotionCanvas.cs b/src/skiasharp/_Shared.WinUI/MotionCanvas.cs index b65fbca8e..669b03ead 100644 --- a/src/skiasharp/_Shared.WinUI/MotionCanvas.cs +++ b/src/skiasharp/_Shared.WinUI/MotionCanvas.cs @@ -21,15 +21,10 @@ // SOFTWARE. using LiveChartsCore.Motion; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; using LiveChartsCore.Native; - -#if !HAS_OS_LVC -using LiveChartsCore.SkiaSharpView.WinUI.SkiaRenderer; -#else using LiveChartsCore.SkiaSharpView.WinUI.Rendering; -#endif +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; #pragma warning disable IDE0028 // Simplify collection initialization @@ -47,7 +42,7 @@ static MotionCanvas() _ = LiveChartsSkiaSharp .EnsureInitialized() .HasRenderingFactory( - (settings, forceGPU) => + (settings) => { IFrameTicker ticker; @@ -58,7 +53,7 @@ static MotionCanvas() ? new NativeFrameTicker() : new AsyncLoopTicker(); #else - IRenderMode renderMode = forceGPU || settings.UseGPU + IRenderMode renderMode = settings.UseGPU ? new GPURenderMode() : new CPURenderMode(); @@ -74,9 +69,9 @@ static MotionCanvas() /// /// Initializes a new instance of the class. /// - public MotionCanvas(bool forceGPU) + public MotionCanvas() { - _composer = LiveChartsSkiaSharp.MotionCanvasRenderingFactory(LiveCharts.RenderingSettings, forceGPU); + _composer = LiveChartsSkiaSharp.MotionCanvasRenderingFactory(LiveCharts.RenderingSettings); Children.Add((UIElement)_composer.RenderMode); diff --git a/src/skiasharp/_Shared.WinUI/PieChart.cs b/src/skiasharp/_Shared.WinUI/PieChart.cs index a61131a92..c59b76169 100644 --- a/src/skiasharp/_Shared.WinUI/PieChart.cs +++ b/src/skiasharp/_Shared.WinUI/PieChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.WinUI; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenPieChart class to add winui/uno specific -// code, this class is just to expose the PieChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/_Shared.WinUI/PolarChart.cs b/src/skiasharp/_Shared.WinUI/PolarChart.cs index b5ab3bbc2..b5ce8fb1f 100644 --- a/src/skiasharp/_Shared.WinUI/PolarChart.cs +++ b/src/skiasharp/_Shared.WinUI/PolarChart.cs @@ -25,10 +25,11 @@ namespace LiveChartsCore.SkiaSharpView.WinUI; // ============================================================================== -// -// use the LiveChartsGeneratedCode.SourceGenPolarChart class to add winui/uno specific -// code, this class is just to expose the PolarChart class in this namespace. -// +// this file exposes the control at this namespace. +// to see the code expand this file in the solution explorer, it will include 3 files: +// - *.uiFramework.cs: The UI framework specific code +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// diff --git a/src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenCartesianChart.cs b/src/skiasharp/_Shared.WinUI/SourceGenCartesianChart.winui.cs similarity index 87% rename from src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenCartesianChart.cs rename to src/skiasharp/_Shared.WinUI/SourceGenCartesianChart.winui.cs index a268709ec..6b63633ba 100644 --- a/src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenCartesianChart.cs +++ b/src/skiasharp/_Shared.WinUI/SourceGenCartesianChart.winui.cs @@ -28,12 +28,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the WinUI/UNO specific code for the SourceGenCartesianChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the WinUI/Uno specific code +// =============================================== /// public partial class SourceGenCartesianChart : SourceGenChart, ICartesianChartView diff --git a/src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenChart.cs b/src/skiasharp/_Shared.WinUI/SourceGenChart.cs similarity index 94% rename from src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenChart.cs rename to src/skiasharp/_Shared.WinUI/SourceGenChart.cs index 9f806f65a..2a564a1e5 100644 --- a/src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenChart.cs +++ b/src/skiasharp/_Shared.WinUI/SourceGenChart.cs @@ -36,10 +36,11 @@ namespace LiveChartsGeneratedCode; // ============================================================================== -// -// this file contains the WinUI/UNO specific code for the SourceGenChart class, -// the rest of the code can be found in the _Shared project. -// +// this file is the base class for this UI framework controls, in this file we +// define the UI framework specific code. +// expanding this file in the solution explorer will show 2 more files: +// - *.shared.cs: shared code between all UI frameworks +// - *.sgp.cs: the source generated properties // ============================================================================== /// @@ -55,7 +56,7 @@ public abstract partial class SourceGenChart : UserControl, IChartView /// public SourceGenChart() { - Content = new MotionCanvas(ForceGPU); + Content = new MotionCanvas(); SizeChanged += (s, e) => CoreChart.Update(); diff --git a/src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenMapChart.cs b/src/skiasharp/_Shared.WinUI/SourceGenMapChart.winui.cs similarity index 88% rename from src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenMapChart.cs rename to src/skiasharp/_Shared.WinUI/SourceGenMapChart.winui.cs index e51c5e7b7..686bd5a2b 100644 --- a/src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenMapChart.cs +++ b/src/skiasharp/_Shared.WinUI/SourceGenMapChart.winui.cs @@ -32,12 +32,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the WinUI/UNO specific code for the SourceGenMapChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the WinUI/Uno specific code +// =============================================== /// public abstract partial class SourceGenMapChart : UserControl, IGeoMapView @@ -49,7 +46,7 @@ public abstract partial class SourceGenMapChart : UserControl, IGeoMapView /// public SourceGenMapChart() { - Content = new MotionCanvas(false); + Content = new MotionCanvas(); InitializeChartControl(); diff --git a/src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenPieChart.cs b/src/skiasharp/_Shared.WinUI/SourceGenPieChart.winui.cs similarity index 81% rename from src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenPieChart.cs rename to src/skiasharp/_Shared.WinUI/SourceGenPieChart.winui.cs index dc0bf9e1b..e3e9212b5 100644 --- a/src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenPieChart.cs +++ b/src/skiasharp/_Shared.WinUI/SourceGenPieChart.winui.cs @@ -24,12 +24,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the WinUI/UNO specific code for the SourceGenPieChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the WinUI/Uno specific code +// =============================================== /// public partial class SourceGenPieChart : SourceGenChart, IPieChartView diff --git a/src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenPolarChart.cs b/src/skiasharp/_Shared.WinUI/SourceGenPolarChart.winui.cs similarity index 81% rename from src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenPolarChart.cs rename to src/skiasharp/_Shared.WinUI/SourceGenPolarChart.winui.cs index 9905999a5..bda351d7e 100644 --- a/src/skiasharp/_Shared.WinUI/LiveChartsGeneratedCode/SourceGenPolarChart.cs +++ b/src/skiasharp/_Shared.WinUI/SourceGenPolarChart.winui.cs @@ -24,12 +24,9 @@ namespace LiveChartsGeneratedCode; -// ============================================================================== -// -// this file contains the WinUI/UNO specific code for the SourceGenPolarChart class, -// the rest of the code can be found in the _Shared project. -// -// ============================================================================== +// =============================================== +// this file contains the WinUI/Uno specific code +// =============================================== /// public partial class SourceGenPolarChart : SourceGenChart, IPolarChartView diff --git a/src/skiasharp/_Shared.WinUI/_Shared.WinUI.projitems b/src/skiasharp/_Shared.WinUI/_Shared.WinUI.projitems index 8e7910781..4a225d1c5 100644 --- a/src/skiasharp/_Shared.WinUI/_Shared.WinUI.projitems +++ b/src/skiasharp/_Shared.WinUI/_Shared.WinUI.projitems @@ -11,16 +11,16 @@ - - - - - + + + + + diff --git a/src/skiasharp/_Shared/SourceGenCartesianChart.cs b/src/skiasharp/_Shared/SourceGenCartesianChart.shared.cs similarity index 95% rename from src/skiasharp/_Shared/SourceGenCartesianChart.cs rename to src/skiasharp/_Shared/SourceGenCartesianChart.shared.cs index e3d9bc5ee..11e7686b0 100644 --- a/src/skiasharp/_Shared/SourceGenCartesianChart.cs +++ b/src/skiasharp/_Shared/SourceGenCartesianChart.shared.cs @@ -35,6 +35,10 @@ namespace LiveChartsGeneratedCode; +// ============================================================== +// this file contains the shared code between all UI frameworks +// ============================================================== + /// #if SKIA_IMAGE_LVC public partial class SourceGenSKCartesianChart : SGChart, ICartesianChartView diff --git a/src/skiasharp/_Shared/SourceGenChartControl.sgp.cs b/src/skiasharp/_Shared/SourceGenChart.sgp.cs similarity index 100% rename from src/skiasharp/_Shared/SourceGenChartControl.sgp.cs rename to src/skiasharp/_Shared/SourceGenChart.sgp.cs diff --git a/src/skiasharp/_Shared/SourceGenChartControl.cs b/src/skiasharp/_Shared/SourceGenChart.shared.cs similarity index 97% rename from src/skiasharp/_Shared/SourceGenChartControl.cs rename to src/skiasharp/_Shared/SourceGenChart.shared.cs index 323b41eee..a36ef0674 100644 --- a/src/skiasharp/_Shared/SourceGenChartControl.cs +++ b/src/skiasharp/_Shared/SourceGenChart.shared.cs @@ -38,6 +38,10 @@ namespace LiveChartsGeneratedCode; +// ============================================================== +// this file contains the shared code between all UI frameworks +// ============================================================== + /// #if SKIA_IMAGE_LVC public partial class SourceGenSKChart : IChartView @@ -52,9 +56,6 @@ public partial class SourceGenChart : IChartView /// public Chart CoreChart { get; private set; } = null!; - /// - public bool ForceGPU { get; set; } - /// public IChartTooltip? Tooltip { get; set; } diff --git a/src/skiasharp/_Shared/SourceGenMapChart.sgp.cs b/src/skiasharp/_Shared/SourceGenMapChart.sgp.cs index 3550d73d9..33f915d60 100644 --- a/src/skiasharp/_Shared/SourceGenMapChart.sgp.cs +++ b/src/skiasharp/_Shared/SourceGenMapChart.sgp.cs @@ -30,7 +30,6 @@ using System; using LiveChartsCore.Painting; using System.Collections.Generic; -using SkiaSharp; using LiveChartsCore.Drawing; #if SKIA_IMAGE_LVC diff --git a/src/skiasharp/_Shared/SourceGenMapChart.cs b/src/skiasharp/_Shared/SourceGenMapChart.shared.cs similarity index 91% rename from src/skiasharp/_Shared/SourceGenMapChart.cs rename to src/skiasharp/_Shared/SourceGenMapChart.shared.cs index ec0454c4f..f1c902b41 100644 --- a/src/skiasharp/_Shared/SourceGenMapChart.cs +++ b/src/skiasharp/_Shared/SourceGenMapChart.shared.cs @@ -26,6 +26,10 @@ namespace LiveChartsGeneratedCode; +// ============================================================== +// this file contains the shared code between all UI frameworks +// ============================================================== + /// #if SKIA_IMAGE_LVC public partial class SourceGenSKMapChart : IGeoMapView diff --git a/src/skiasharp/_Shared/SourceGenPieChart.cs b/src/skiasharp/_Shared/SourceGenPieChart.shared.cs similarity index 91% rename from src/skiasharp/_Shared/SourceGenPieChart.cs rename to src/skiasharp/_Shared/SourceGenPieChart.shared.cs index e1424966c..646c18486 100644 --- a/src/skiasharp/_Shared/SourceGenPieChart.cs +++ b/src/skiasharp/_Shared/SourceGenPieChart.shared.cs @@ -33,6 +33,10 @@ namespace LiveChartsGeneratedCode; +// ============================================================== +// this file contains the shared code between all UI frameworks +// ============================================================== + /// #if SKIA_IMAGE_LVC public partial class SourceGenSKPieChart : SGChart, IPieChartView diff --git a/src/skiasharp/_Shared/SourceGenPolarChart.cs b/src/skiasharp/_Shared/SourceGenPolarChart.shared.cs similarity index 94% rename from src/skiasharp/_Shared/SourceGenPolarChart.cs rename to src/skiasharp/_Shared/SourceGenPolarChart.shared.cs index 1f83576e4..c07318745 100644 --- a/src/skiasharp/_Shared/SourceGenPolarChart.cs +++ b/src/skiasharp/_Shared/SourceGenPolarChart.shared.cs @@ -35,6 +35,10 @@ namespace LiveChartsGeneratedCode; +// ============================================================== +// this file contains the shared code between all UI frameworks +// ============================================================== + /// #if SKIA_IMAGE_LVC public partial class SourceGenSKPolarChart : SGChart, IPolarChartView diff --git a/src/skiasharp/_Shared/_Shared.projitems b/src/skiasharp/_Shared/_Shared.projitems index cb8ecdb34..e1f24ec65 100644 --- a/src/skiasharp/_Shared/_Shared.projitems +++ b/src/skiasharp/_Shared/_Shared.projitems @@ -6,15 +6,15 @@ 2ad18dd8-c567-4bcf-a4fa-42519466d6a3 - + - - - + + + - + - + \ No newline at end of file diff --git a/tests/CoreTests/AssemblyInfo.cs b/tests/CoreTests/AssemblyInfo.cs new file mode 100644 index 000000000..a7432a783 --- /dev/null +++ b/tests/CoreTests/AssemblyInfo.cs @@ -0,0 +1,6 @@ +#if STRONG_NAMED_ASSEMBLIES +using System.Reflection; + +[assembly: AssemblyKeyFile("./../../LiveCharts.snk")] + +#endif diff --git a/tests/LiveChartsCore.UnitTesting/ChartTests/ChartTests.cs b/tests/CoreTests/ChartTests/ChartTests.cs similarity index 97% rename from tests/LiveChartsCore.UnitTesting/ChartTests/ChartTests.cs rename to tests/CoreTests/ChartTests/ChartTests.cs index df42af977..7d13e3eeb 100644 --- a/tests/LiveChartsCore.UnitTesting/ChartTests/ChartTests.cs +++ b/tests/CoreTests/ChartTests/ChartTests.cs @@ -1,7 +1,7 @@ using LiveChartsCore.SkiaSharpView.SKCharts; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting.ChartTests; +namespace CoreTests.ChartTests; [TestClass] public class ChartTests diff --git a/tests/LiveChartsCore.UnitTesting/CoreObjectsTests/ActionThrottler.cs b/tests/CoreTests/CoreObjectsTests/ActionThrottler.cs similarity index 96% rename from tests/LiveChartsCore.UnitTesting/CoreObjectsTests/ActionThrottler.cs rename to tests/CoreTests/CoreObjectsTests/ActionThrottler.cs index a2881afc3..0fa99ad86 100644 --- a/tests/LiveChartsCore.UnitTesting/CoreObjectsTests/ActionThrottler.cs +++ b/tests/CoreTests/CoreObjectsTests/ActionThrottler.cs @@ -4,7 +4,7 @@ using LiveChartsCore.Kernel; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting.CoreObjectsTests; +namespace CoreTests.CoreObjectsTests; [TestClass] public class ActionThrottlerTester diff --git a/tests/LiveChartsCore.UnitTesting/CoreObjectsTests/ChangingPaintTasks.cs b/tests/CoreTests/CoreObjectsTests/ChangingPaintTasks.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/CoreObjectsTests/ChangingPaintTasks.cs rename to tests/CoreTests/CoreObjectsTests/ChangingPaintTasks.cs index be9f1d76b..62be44de0 100644 --- a/tests/LiveChartsCore.UnitTesting/CoreObjectsTests/ChangingPaintTasks.cs +++ b/tests/CoreTests/CoreObjectsTests/ChangingPaintTasks.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using LiveChartsCore; using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView.Drawing; using LiveChartsCore.SkiaSharpView.Painting; @@ -9,7 +10,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.CoreObjectsTests; +namespace CoreTests.CoreObjectsTests; [TestClass] public class ChangingPaintTasks diff --git a/tests/LiveChartsCore.UnitTesting/CoreObjectsTests/CollectionDeepObservererTesting.cs b/tests/CoreTests/CoreObjectsTests/CollectionDeepObservererTesting.cs similarity index 97% rename from tests/LiveChartsCore.UnitTesting/CoreObjectsTests/CollectionDeepObservererTesting.cs rename to tests/CoreTests/CoreObjectsTests/CollectionDeepObservererTesting.cs index 5e1a37baa..d409ff26d 100644 --- a/tests/LiveChartsCore.UnitTesting/CoreObjectsTests/CollectionDeepObservererTesting.cs +++ b/tests/CoreTests/CoreObjectsTests/CollectionDeepObservererTesting.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using System.Collections.ObjectModel; -using LiveChartsCore.UnitTesting.MockedObjects; +using CoreTests.MockedObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting.CoreObjectsTests; +namespace CoreTests.CoreObjectsTests; [TestClass] public class CollectionDeepObservererTesting diff --git a/tests/LiveChartsCore.UnitTesting/CoreObjectsTests/ColorTesting.cs b/tests/CoreTests/CoreObjectsTests/ColorTesting.cs similarity index 91% rename from tests/LiveChartsCore.UnitTesting/CoreObjectsTests/ColorTesting.cs rename to tests/CoreTests/CoreObjectsTests/ColorTesting.cs index 121b04fd3..6190740eb 100644 --- a/tests/LiveChartsCore.UnitTesting/CoreObjectsTests/ColorTesting.cs +++ b/tests/CoreTests/CoreObjectsTests/ColorTesting.cs @@ -1,7 +1,7 @@ using LiveChartsCore.Drawing; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting.CoreObjectsTests; +namespace CoreTests.CoreObjectsTests; [TestClass] public class ColorTesting diff --git a/tests/LiveChartsCore.UnitTesting/CoreObjectsTests/LabelerTesting.cs b/tests/CoreTests/CoreObjectsTests/LabelerTesting.cs similarity index 98% rename from tests/LiveChartsCore.UnitTesting/CoreObjectsTests/LabelerTesting.cs rename to tests/CoreTests/CoreObjectsTests/LabelerTesting.cs index cfb541f0e..a73d7b6e9 100644 --- a/tests/LiveChartsCore.UnitTesting/CoreObjectsTests/LabelerTesting.cs +++ b/tests/CoreTests/CoreObjectsTests/LabelerTesting.cs @@ -1,7 +1,8 @@ using System.Globalization; +using LiveChartsCore; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting.CoreObjectsTests; +namespace CoreTests.CoreObjectsTests; [TestClass] public class LabelerTesting diff --git a/tests/LiveChartsCore.UnitTesting/CoreObjectsTests/TransitionsTesting.cs b/tests/CoreTests/CoreObjectsTests/TransitionsTesting.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/CoreObjectsTests/TransitionsTesting.cs rename to tests/CoreTests/CoreObjectsTests/TransitionsTesting.cs index e36e218e8..fb8cb440c 100644 --- a/tests/LiveChartsCore.UnitTesting/CoreObjectsTests/TransitionsTesting.cs +++ b/tests/CoreTests/CoreObjectsTests/TransitionsTesting.cs @@ -1,10 +1,11 @@ using System; +using LiveChartsCore; using LiveChartsCore.Drawing; using LiveChartsCore.Motion; using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting.CoreObjectsTests; +namespace CoreTests.CoreObjectsTests; [TestClass] public class TransitionsTesting diff --git a/tests/CoreTests/CoreTests.csproj b/tests/CoreTests/CoreTests.csproj new file mode 100644 index 000000000..c5082922f --- /dev/null +++ b/tests/CoreTests/CoreTests.csproj @@ -0,0 +1,29 @@ + + + + Exe + net462;net8.0 + false + + + + $(NoWarn);MSTEST0037;MSTEST0023;CS0618 + + + + + + + + $(DefineConstants);STRONG_NAMED_ASSEMBLIES + + + + + + + + + + + diff --git a/tests/LiveChartsCore.UnitTesting/LayoutTests/StackLayoutTest.cs b/tests/CoreTests/LayoutTests/StackLayoutTest.cs similarity index 93% rename from tests/LiveChartsCore.UnitTesting/LayoutTests/StackLayoutTest.cs rename to tests/CoreTests/LayoutTests/StackLayoutTest.cs index 08280d5c7..99c1f3f99 100644 --- a/tests/LiveChartsCore.UnitTesting/LayoutTests/StackLayoutTest.cs +++ b/tests/CoreTests/LayoutTests/StackLayoutTest.cs @@ -1,4 +1,6 @@ -using LiveChartsCore.SkiaSharpView; +using LiveChartsCore; +using LiveChartsCore.Drawing; +using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView.Drawing.Layouts; using LiveChartsCore.SkiaSharpView.Painting; @@ -6,7 +8,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.LayoutTests; +namespace CoreTests.LayoutTests; [TestClass] public class StackLayoutTest @@ -16,11 +18,11 @@ public void StackLayoutHorizontalStart() { var stackPanel = new StackLayout { - Padding = new Drawing.Padding(10, 20), + Padding = new Padding(10, 20), X = 100, Y = 200, - VerticalAlignment = Drawing.Align.Start, - Orientation = Drawing.ContainerOrientation.Horizontal + VerticalAlignment = Align.Start, + Orientation = ContainerOrientation.Horizontal }; RectangleGeometry g1, g2; @@ -81,12 +83,12 @@ public void StackLayoutHorizontalMiddle() { var stackLayout = new StackLayout { - Padding = new Drawing.Padding(10, 20), + Padding = new Padding(10, 20), X = 100, Y = 200, // also default should be middle... //VerticalAlignment = Drawing.Align.Middle, - Orientation = Drawing.ContainerOrientation.Horizontal + Orientation = ContainerOrientation.Horizontal }; RectangleGeometry g1, g2; @@ -140,11 +142,11 @@ public void StackLayoutHorizontalEnd() { var stackLayout = new StackLayout { - Padding = new Drawing.Padding(10, 20), + Padding = new Padding(10, 20), X = 100, Y = 200, - VerticalAlignment = Drawing.Align.End, - Orientation = Drawing.ContainerOrientation.Horizontal + VerticalAlignment = Align.End, + Orientation = ContainerOrientation.Horizontal }; RectangleGeometry g1, g2; @@ -199,11 +201,11 @@ public void StackLayoutVerticalStart() { var stackPanel = new StackLayout { - Padding = new Drawing.Padding(10, 20), + Padding = new Padding(10, 20), X = 100, Y = 200, - HorizontalAlignment = Drawing.Align.Start, - Orientation = Drawing.ContainerOrientation.Vertical + HorizontalAlignment = Align.Start, + Orientation = ContainerOrientation.Vertical }; RectangleGeometry g1, g2; @@ -263,12 +265,12 @@ public void StackLayoutVerticalMiddle() { var stackPanel = new StackLayout { - Padding = new Drawing.Padding(10, 20), + Padding = new Padding(10, 20), X = 100, Y = 200, // also default should be middle... //HorizontalAlignment = Drawing.Align.Middle, - Orientation = Drawing.ContainerOrientation.Vertical + Orientation = ContainerOrientation.Vertical }; RectangleGeometry g1, g2; @@ -323,11 +325,11 @@ public void StackLayoutVerticalEnd() { var stackPanel = new StackLayout { - Padding = new Drawing.Padding(10, 20), + Padding = new Padding(10, 20), X = 100, Y = 200, - HorizontalAlignment = Drawing.Align.End, - Orientation = Drawing.ContainerOrientation.Vertical + HorizontalAlignment = Align.End, + Orientation = ContainerOrientation.Vertical }; RectangleGeometry g1, g2; @@ -382,12 +384,12 @@ public void StackLayoutHorizontalStartWrap() { var stackPanel = new StackLayout { - Padding = new Drawing.Padding(0), + Padding = new Padding(0), X = 100, Y = 200, MaxWidth = 12 * 3, - VerticalAlignment = Drawing.Align.Start, - Orientation = Drawing.ContainerOrientation.Horizontal + VerticalAlignment = Align.Start, + Orientation = ContainerOrientation.Horizontal }; RectangleGeometry g0, g1, g2; @@ -501,12 +503,12 @@ public void StackPanelLayoutMiddleWrap() { var stackPanel = new StackLayout { - Padding = new Drawing.Padding(0), + Padding = new Padding(0), X = 100, Y = 200, MaxWidth = 12 * 3, - VerticalAlignment = Drawing.Align.Middle, - Orientation = Drawing.ContainerOrientation.Horizontal + VerticalAlignment = Align.Middle, + Orientation = ContainerOrientation.Horizontal }; RectangleGeometry g0, g1, g2; @@ -620,12 +622,12 @@ public void StackLayoutHorizontalEndWrap() { var stackPanel = new StackLayout { - Padding = new Drawing.Padding(0), + Padding = new Padding(0), X = 100, Y = 200, MaxWidth = 12 * 3, - VerticalAlignment = Drawing.Align.End, - Orientation = Drawing.ContainerOrientation.Horizontal + VerticalAlignment = Align.End, + Orientation = ContainerOrientation.Horizontal }; RectangleGeometry g0, g1, g2; @@ -739,12 +741,12 @@ public void StackPanelLayoutStartWrap() { var stackPanel = new StackLayout { - Padding = new Drawing.Padding(0), + Padding = new Padding(0), X = 200, Y = 100, MaxHeight = 12 * 3, - HorizontalAlignment = Drawing.Align.Start, - Orientation = Drawing.ContainerOrientation.Vertical + HorizontalAlignment = Align.Start, + Orientation = ContainerOrientation.Vertical }; RectangleGeometry g0, g1, g2; @@ -858,12 +860,12 @@ public void StackLayoutVerticalMiddleWrap() { var stackPanel = new StackLayout { - Padding = new Drawing.Padding(0), + Padding = new Padding(0), X = 200, Y = 100, MaxHeight = 12 * 3, - HorizontalAlignment = Drawing.Align.Middle, - Orientation = Drawing.ContainerOrientation.Vertical + HorizontalAlignment = Align.Middle, + Orientation = ContainerOrientation.Vertical }; RectangleGeometry g0, g1, g2; @@ -977,12 +979,12 @@ public void StackPanelLayoutEndWrap() { var stackPanel = new StackLayout { - Padding = new Drawing.Padding(0), + Padding = new Padding(0), X = 200, Y = 100, MaxHeight = 12 * 3, - HorizontalAlignment = Drawing.Align.End, - Orientation = Drawing.ContainerOrientation.Vertical + HorizontalAlignment = Align.End, + Orientation = ContainerOrientation.Vertical }; RectangleGeometry g0, g1, g2; diff --git a/tests/LiveChartsCore.UnitTesting/LayoutTests/TableLayoutTest.cs b/tests/CoreTests/LayoutTests/TableLayoutTest.cs similarity index 92% rename from tests/LiveChartsCore.UnitTesting/LayoutTests/TableLayoutTest.cs rename to tests/CoreTests/LayoutTests/TableLayoutTest.cs index 70e9c220a..daeefcda9 100644 --- a/tests/LiveChartsCore.UnitTesting/LayoutTests/TableLayoutTest.cs +++ b/tests/CoreTests/LayoutTests/TableLayoutTest.cs @@ -1,4 +1,6 @@ -using LiveChartsCore.SkiaSharpView; +using LiveChartsCore; +using LiveChartsCore.Drawing; +using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView.Drawing.Layouts; using LiveChartsCore.SkiaSharpView.Painting; @@ -6,7 +8,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.LayoutTests; +namespace CoreTests.LayoutTests; [TestClass] public class TableLayoutTest @@ -19,11 +21,11 @@ public void TableStart() var table = new TableLayout { - Padding = new Drawing.Padding(px, py), + Padding = new Padding(px, py), X = 100, Y = 200, - VerticalAlignment = Drawing.Align.Start, - HorizontalAlignment = Drawing.Align.Start + VerticalAlignment = Align.Start, + HorizontalAlignment = Align.Start }; RectangleGeometry g1, g2; @@ -102,11 +104,11 @@ public void TableStartFirstEmpty() var table = new TableLayout { - Padding = new Drawing.Padding(px, py), + Padding = new Padding(px, py), X = 100, Y = 200, - VerticalAlignment = Drawing.Align.Start, - HorizontalAlignment = Drawing.Align.Start + VerticalAlignment = Align.Start, + HorizontalAlignment = Align.Start }; RectangleGeometry g1, g2; @@ -185,11 +187,11 @@ public void TableStartSomeEmpty() var table = new TableLayout { - Padding = new Drawing.Padding(px, py), + Padding = new Padding(px, py), X = 100, Y = 200, - VerticalAlignment = Drawing.Align.Start, - HorizontalAlignment = Drawing.Align.Start + VerticalAlignment = Align.Start, + HorizontalAlignment = Align.Start }; RectangleGeometry g1, g2; @@ -279,11 +281,11 @@ public void TableMiddle() var table = new TableLayout { - Padding = new Drawing.Padding(px, py), + Padding = new Padding(px, py), X = 100, Y = 200, - VerticalAlignment = Drawing.Align.Middle, - HorizontalAlignment = Drawing.Align.Middle + VerticalAlignment = Align.Middle, + HorizontalAlignment = Align.Middle }; RectangleGeometry g1, g2; @@ -361,11 +363,11 @@ public void TableEnd() var table = new TableLayout { - Padding = new Drawing.Padding(px, py), + Padding = new Padding(px, py), X = 100, Y = 200, - VerticalAlignment = Drawing.Align.End, - HorizontalAlignment = Drawing.Align.End + VerticalAlignment = Align.End, + HorizontalAlignment = Align.End }; RectangleGeometry g1, g2; @@ -443,11 +445,11 @@ public void UnevenColumns() var table = new TableLayout { - Padding = new Drawing.Padding(px, py), + Padding = new Padding(px, py), X = 100, Y = 200, - VerticalAlignment = Drawing.Align.Start, - HorizontalAlignment = Drawing.Align.Start + VerticalAlignment = Align.Start, + HorizontalAlignment = Align.Start }; LabelGeometry g00, g01, g10, g11; diff --git a/tests/LiveChartsCore.UnitTesting/MockedObjects/PropertyChangedObject.cs b/tests/CoreTests/MockedObjects/PropertyChangedObject.cs similarity index 89% rename from tests/LiveChartsCore.UnitTesting/MockedObjects/PropertyChangedObject.cs rename to tests/CoreTests/MockedObjects/PropertyChangedObject.cs index 9e378e799..96e8a87aa 100644 --- a/tests/LiveChartsCore.UnitTesting/MockedObjects/PropertyChangedObject.cs +++ b/tests/CoreTests/MockedObjects/PropertyChangedObject.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace LiveChartsCore.UnitTesting.MockedObjects; +namespace CoreTests.MockedObjects; public class PropertyChangedObject : INotifyPropertyChanged { diff --git a/tests/CoreTests/MockedObjects/TestLabel.cs b/tests/CoreTests/MockedObjects/TestLabel.cs new file mode 100644 index 000000000..6b2125250 --- /dev/null +++ b/tests/CoreTests/MockedObjects/TestLabel.cs @@ -0,0 +1,12 @@ +using LiveChartsCore.Drawing; +using LiveChartsCore.SkiaSharpView.Drawing.Geometries; + +namespace CoreTests.MockedObjects; + +public class TestLabel : LabelGeometry +{ + public TestLabel() + { + Background = new LvcColor(200, 200, 200, 50); + } +} diff --git a/tests/LiveChartsCore.UnitTesting/MockedObjects/TestObserver.cs b/tests/CoreTests/MockedObjects/TestObserver.cs similarity index 92% rename from tests/LiveChartsCore.UnitTesting/MockedObjects/TestObserver.cs rename to tests/CoreTests/MockedObjects/TestObserver.cs index 3c43149f0..5dc2427ec 100644 --- a/tests/LiveChartsCore.UnitTesting/MockedObjects/TestObserver.cs +++ b/tests/CoreTests/MockedObjects/TestObserver.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using LiveChartsCore.Kernel.Observers; -namespace LiveChartsCore.UnitTesting.MockedObjects; +namespace CoreTests.MockedObjects; public class TestObserver : IDisposable { diff --git a/tests/LiveChartsCore.UnitTesting/OtherTests/AxisTesting.cs b/tests/CoreTests/OtherTests/AxisTesting.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/OtherTests/AxisTesting.cs rename to tests/CoreTests/OtherTests/AxisTesting.cs index 0e2e598df..3fd0169f6 100644 --- a/tests/LiveChartsCore.UnitTesting/OtherTests/AxisTesting.cs +++ b/tests/CoreTests/OtherTests/AxisTesting.cs @@ -7,10 +7,10 @@ using SkiaSharp; using LiveChartsCore.Defaults; using System.Diagnostics; -using LiveChartsCore.UnitTesting.CoreObjectsTests; using LiveChartsCore.Measure; +using CoreTests.CoreObjectsTests; -namespace LiveChartsCore.UnitTesting.OtherTests; +namespace CoreTests.OtherTests; [TestClass] public class AxisTesting diff --git a/tests/LiveChartsCore.UnitTesting/OtherTests/DataProviderTest.cs b/tests/CoreTests/OtherTests/DataProviderTest.cs similarity index 98% rename from tests/LiveChartsCore.UnitTesting/OtherTests/DataProviderTest.cs rename to tests/CoreTests/OtherTests/DataProviderTest.cs index 99a33adb3..78acbe9f7 100644 --- a/tests/LiveChartsCore.UnitTesting/OtherTests/DataProviderTest.cs +++ b/tests/CoreTests/OtherTests/DataProviderTest.cs @@ -6,7 +6,7 @@ using LiveChartsCore.SkiaSharpView.SKCharts; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting.OtherTests; +namespace CoreTests.OtherTests; [TestClass] public class DataProviderTest @@ -299,7 +299,7 @@ public void FetchReturnEqualityOnValueTypes() { Width = 100, Height = 100, - FindingStrategy = Measure.FindingStrategy.ExactMatch, + FindingStrategy = LiveChartsCore.Measure.FindingStrategy.ExactMatch, Series = [sutSeries] }; diff --git a/tests/LiveChartsCore.UnitTesting/OtherTests/DrawMarginAndLegendsTests.cs b/tests/CoreTests/OtherTests/DrawMarginAndLegendsTests.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/OtherTests/DrawMarginAndLegendsTests.cs rename to tests/CoreTests/OtherTests/DrawMarginAndLegendsTests.cs index ade4016fd..f10793e27 100644 --- a/tests/LiveChartsCore.UnitTesting/OtherTests/DrawMarginAndLegendsTests.cs +++ b/tests/CoreTests/OtherTests/DrawMarginAndLegendsTests.cs @@ -9,7 +9,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.OtherTests; +namespace CoreTests.OtherTests; [TestClass] public class DrawMarginAndLegendsTests diff --git a/tests/LiveChartsCore.UnitTesting/OtherTests/EventsTests.cs b/tests/CoreTests/OtherTests/EventsTests.cs similarity index 88% rename from tests/LiveChartsCore.UnitTesting/OtherTests/EventsTests.cs rename to tests/CoreTests/OtherTests/EventsTests.cs index 8c9227951..3916c53d3 100644 --- a/tests/LiveChartsCore.UnitTesting/OtherTests/EventsTests.cs +++ b/tests/CoreTests/OtherTests/EventsTests.cs @@ -11,7 +11,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.OtherTests; +namespace CoreTests.OtherTests; [TestClass] public class EventsTests @@ -28,7 +28,7 @@ public void CartesianBasicCase() new ScatterSeries { Values = new double[] { 0, 1, 2 }, - DataPadding = new Drawing.LvcPoint(0, 0) + DataPadding = new LvcPoint(0, 0) } }, XAxes = new[] { new Axis { IsVisible = false, } }, @@ -42,7 +42,7 @@ public void CartesianBasicCase() Text = "Hello world", TextSize = 20, Paint = new SolidColorPaint(SKColors.Red), - LocationUnit = Measure.MeasureUnit.ChartValues + LocationUnit = MeasureUnit.ChartValues }, new GeometryVisual { @@ -51,8 +51,8 @@ public void CartesianBasicCase() Width = 0.5, Height = 0.5, Fill = new SolidColorPaint(SKColors.Blue), - LocationUnit = Measure.MeasureUnit.ChartValues, - SizeUnit = Measure.MeasureUnit.ChartValues + LocationUnit = MeasureUnit.ChartValues, + SizeUnit = MeasureUnit.ChartValues } } }; diff --git a/tests/LiveChartsCore.UnitTesting/OtherTests/LabelsMeasureTest.cs b/tests/CoreTests/OtherTests/LabelsMeasureTest.cs similarity index 93% rename from tests/LiveChartsCore.UnitTesting/OtherTests/LabelsMeasureTest.cs rename to tests/CoreTests/OtherTests/LabelsMeasureTest.cs index baee116b6..6db4d5721 100644 --- a/tests/LiveChartsCore.UnitTesting/OtherTests/LabelsMeasureTest.cs +++ b/tests/CoreTests/OtherTests/LabelsMeasureTest.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; -using System.Linq; +using LiveChartsCore; +using LiveChartsCore.Drawing; using LiveChartsCore.Kernel; +using LiveChartsCore.Measure; using LiveChartsCore.Motion; using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView.Drawing; @@ -12,7 +14,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.OtherTests; +namespace CoreTests.OtherTests; [TestClass] public class LabelsMeasureTest @@ -30,13 +32,13 @@ public void BasicCase() { X = 10, Y = y, - LocationUnit = Measure.MeasureUnit.Pixels, - VerticalAlignment = Drawing.Align.Start, - HorizontalAlignment = Drawing.Align.Start, + LocationUnit = MeasureUnit.Pixels, + VerticalAlignment = Align.Start, + HorizontalAlignment = Align.Start, TextSize = h, Text = "X-█-X", Paint = new SolidColorPaint(SKColors.Black), - BackgroundColor = new Drawing.LvcColor(0, 0, 0, 50) + BackgroundColor = new LvcColor(0, 0, 0, 50) }); y += h + 10; @@ -79,13 +81,13 @@ public void MultiLine() { X = 10, Y = y, - LocationUnit = Measure.MeasureUnit.Pixels, - VerticalAlignment = Drawing.Align.Start, - HorizontalAlignment = Drawing.Align.Start, + LocationUnit = MeasureUnit.Pixels, + VerticalAlignment = Align.Start, + HorizontalAlignment = Align.Start, TextSize = 25, Text = t, Paint = new SolidColorPaint(SKColors.Black), - BackgroundColor = new Drawing.LvcColor(0, 0, 0, 50) + BackgroundColor = new LvcColor(0, 0, 0, 50) }); y += th * lineHeight + 10; diff --git a/tests/LiveChartsCore.UnitTesting/OtherTests/ScaleFunctionsTests.cs b/tests/CoreTests/OtherTests/ScaleFunctionsTests.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/OtherTests/ScaleFunctionsTests.cs rename to tests/CoreTests/OtherTests/ScaleFunctionsTests.cs index b8e84ebe3..abac41f64 100644 --- a/tests/LiveChartsCore.UnitTesting/OtherTests/ScaleFunctionsTests.cs +++ b/tests/CoreTests/OtherTests/ScaleFunctionsTests.cs @@ -8,7 +8,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.OtherTests; +namespace CoreTests.OtherTests; [TestClass] public class ScaleFunctionsTests diff --git a/tests/LiveChartsCore.UnitTesting/OtherTests/VisualElementsTests.cs b/tests/CoreTests/OtherTests/VisualElementsTests.cs similarity index 98% rename from tests/LiveChartsCore.UnitTesting/OtherTests/VisualElementsTests.cs rename to tests/CoreTests/OtherTests/VisualElementsTests.cs index a34b69cee..04ed38b41 100644 --- a/tests/LiveChartsCore.UnitTesting/OtherTests/VisualElementsTests.cs +++ b/tests/CoreTests/OtherTests/VisualElementsTests.cs @@ -9,7 +9,7 @@ using SkiaSharp; using LiveChartsCore.Kernel; -namespace LiveChartsCore.UnitTesting.OtherTests; +namespace CoreTests.OtherTests; [TestClass] public class VisualElementsTests diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/BoxSeriesTests.cs b/tests/CoreTests/SeriesTests/BoxSeriesTests.cs similarity index 98% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/BoxSeriesTests.cs rename to tests/CoreTests/SeriesTests/BoxSeriesTests.cs index d3664d653..d0fb9b23c 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/BoxSeriesTests.cs +++ b/tests/CoreTests/SeriesTests/BoxSeriesTests.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using CoreTests.MockedObjects; using LiveChartsCore.Defaults; using LiveChartsCore.Drawing; using LiveChartsCore.Measure; @@ -7,11 +8,10 @@ using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.MockedObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class BoxSeriesTest @@ -100,7 +100,7 @@ public void ShouldPlaceToolTips() Name = "A", MaxBarWidth = 1000, YToolTipLabelFormatter = x => $"{x.Coordinate.PrimaryValue}{Environment.NewLine}{x.Coordinate.PrimaryValue}{Environment.NewLine}{x.Coordinate.PrimaryValue}{Environment.NewLine}", - DataPadding = new Drawing.LvcPoint(0, 0) + DataPadding = new LvcPoint(0, 0) }; var tooltip = new SKDefaultTooltip { Easing = null }; @@ -217,7 +217,7 @@ public void ShouldPlaceDataLabel() new(1, .75, 0.25, 0, 0.5), new(10, 9.75, 9.25, 9, 9.5) }, - DataPadding = new Drawing.LvcPoint(0, 0), + DataPadding = new LvcPoint(0, 0), }; var chart = new SKCartesianChart diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/ColumnSeriesTest.cs b/tests/CoreTests/SeriesTests/ColumnSeriesTest.cs similarity index 98% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/ColumnSeriesTest.cs rename to tests/CoreTests/SeriesTests/ColumnSeriesTest.cs index 3204b666e..147dde5d4 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/ColumnSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/ColumnSeriesTest.cs @@ -1,16 +1,16 @@ using System; using System.Linq; +using CoreTests.MockedObjects; using LiveChartsCore.Drawing; using LiveChartsCore.Measure; using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.MockedObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class ColumnSeriesTest @@ -86,7 +86,7 @@ public void ShouldPlaceToolTips() { Values = new double[] { 1, 2, 3, 4, 5 }, Name = "Series #1", - DataPadding = new Drawing.LvcPoint(0, 0) + DataPadding = new LvcPoint(0, 0) }; var tooltip = new SKDefaultTooltip { Easing = null }; @@ -199,7 +199,7 @@ public void ShouldPlaceDataLabel() var sutSeries = new ColumnSeries { Values = new double[] { -10, -5, -1, 0, 1, 5, 10 }, - DataPadding = new Drawing.LvcPoint(0, 0), + DataPadding = new LvcPoint(0, 0), }; var chart = new SKCartesianChart diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/FinancialSeriesTest.cs b/tests/CoreTests/SeriesTests/FinancialSeriesTest.cs similarity index 98% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/FinancialSeriesTest.cs rename to tests/CoreTests/SeriesTests/FinancialSeriesTest.cs index 0cd775aa2..cdf375292 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/FinancialSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/FinancialSeriesTest.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using CoreTests.MockedObjects; using LiveChartsCore.Defaults; using LiveChartsCore.Drawing; using LiveChartsCore.Kernel; @@ -8,11 +9,10 @@ using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.MockedObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class FinancialSeriesTest @@ -123,7 +123,7 @@ public void ShouldPlaceToolTips() Name = "Aaaa", MaxBarWidth = 1000, YToolTipLabelFormatter = x => $"{x.Coordinate.PrimaryValue}{Environment.NewLine}{x.Coordinate.PrimaryValue}{Environment.NewLine}{x.Coordinate.PrimaryValue}{Environment.NewLine}", - DataPadding = new Drawing.LvcPoint(0, 0) + DataPadding = new LvcPoint(0, 0) }; var tooltip = new SKDefaultTooltip { Easing = null }; @@ -240,7 +240,7 @@ public void ShouldPlaceDataLabel() new(1, .75, 0.25, 0), new(10, 9.75, 9.25, 9) }, - DataPadding = new Drawing.LvcPoint(0, 0), + DataPadding = new LvcPoint(0, 0), }; var chart = new SKCartesianChart diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/GeneralSeriesTests.cs b/tests/CoreTests/SeriesTests/GeneralSeriesTests.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/GeneralSeriesTests.cs rename to tests/CoreTests/SeriesTests/GeneralSeriesTests.cs index 3bdf120e7..66f061363 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/GeneralSeriesTests.cs +++ b/tests/CoreTests/SeriesTests/GeneralSeriesTests.cs @@ -1,13 +1,14 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +using LiveChartsCore; using LiveChartsCore.Drawing; using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView.Extensions; using LiveChartsCore.SkiaSharpView.SKCharts; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class GeneralSeriesTests diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/HeatSeriesTest.cs b/tests/CoreTests/SeriesTests/HeatSeriesTest.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/HeatSeriesTest.cs rename to tests/CoreTests/SeriesTests/HeatSeriesTest.cs index f6c0924a6..8794351b9 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/HeatSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/HeatSeriesTest.cs @@ -1,6 +1,7 @@ using System; using System.Collections.ObjectModel; using System.Linq; +using CoreTests.MockedObjects; using LiveChartsCore.Defaults; using LiveChartsCore.Drawing; using LiveChartsCore.Measure; @@ -8,11 +9,10 @@ using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.MockedObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class HeatSeriesTest diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/LineSeriesTest.cs b/tests/CoreTests/SeriesTests/LineSeriesTest.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/LineSeriesTest.cs rename to tests/CoreTests/SeriesTests/LineSeriesTest.cs index 03df97a4a..2eb52a831 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/LineSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/LineSeriesTest.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using CoreTests.MockedObjects; using LiveChartsCore.Drawing; using LiveChartsCore.Drawing.Segments; using LiveChartsCore.Measure; @@ -7,11 +8,10 @@ using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.MockedObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class LineSeriesTest diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/PieSeriesTest.cs b/tests/CoreTests/SeriesTests/PieSeriesTest.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/PieSeriesTest.cs rename to tests/CoreTests/SeriesTests/PieSeriesTest.cs index 1fb30c224..a0932bc1f 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/PieSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/PieSeriesTest.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using CoreTests.MockedObjects; using LiveChartsCore.Drawing; using LiveChartsCore.Measure; using LiveChartsCore.SkiaSharpView; @@ -7,11 +8,10 @@ using LiveChartsCore.SkiaSharpView.Extensions; using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.MockedObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class PieSeriesTest diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/PolarLineSeriesTest.cs b/tests/CoreTests/SeriesTests/PolarLineSeriesTest.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/PolarLineSeriesTest.cs rename to tests/CoreTests/SeriesTests/PolarLineSeriesTest.cs index ebbb44205..b62ed7d9f 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/PolarLineSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/PolarLineSeriesTest.cs @@ -7,7 +7,7 @@ using LiveChartsCore.SkiaSharpView.SKCharts; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class PolarLineSeriesTest diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/RowSeriesTest.cs b/tests/CoreTests/SeriesTests/RowSeriesTest.cs similarity index 98% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/RowSeriesTest.cs rename to tests/CoreTests/SeriesTests/RowSeriesTest.cs index 802fa34b8..cdbeab120 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/RowSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/RowSeriesTest.cs @@ -4,7 +4,7 @@ using LiveChartsCore.SkiaSharpView.SKCharts; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class RowSeriesTest diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/ScatterSeriesTest.cs b/tests/CoreTests/SeriesTests/ScatterSeriesTest.cs similarity index 98% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/ScatterSeriesTest.cs rename to tests/CoreTests/SeriesTests/ScatterSeriesTest.cs index 7466dec98..237481991 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/ScatterSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/ScatterSeriesTest.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using CoreTests.MockedObjects; using LiveChartsCore.Defaults; using LiveChartsCore.Drawing; using LiveChartsCore.Measure; @@ -7,11 +8,10 @@ using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.MockedObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class ScatterSeriesTest @@ -105,7 +105,7 @@ public void ShouldPlaceToolTips() var sutSeries = new ScatterSeries { Values = new double[] { 1, 2, 3, 4, 5 }, - DataPadding = new Drawing.LvcPoint(0, 0), + DataPadding = new LvcPoint(0, 0), YToolTipLabelFormatter = x => $"{x.Coordinate.PrimaryValue}" + $"{Environment.NewLine}{x.Coordinate.PrimaryValue}" + @@ -222,7 +222,7 @@ public void ShouldPlaceDataLabel() var sutSeries = new ScatterSeries { Values = new double[] { -10, -5, -1, 0, 1, 5, 10 }, - DataPadding = new Drawing.LvcPoint(0, 0), + DataPadding = new LvcPoint(0, 0), }; var chart = new SKCartesianChart diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/StackedAreaSeriesTest.cs b/tests/CoreTests/SeriesTests/StackedAreaSeriesTest.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/StackedAreaSeriesTest.cs rename to tests/CoreTests/SeriesTests/StackedAreaSeriesTest.cs index 9a0356e9e..5abcfe5cd 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/StackedAreaSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/StackedAreaSeriesTest.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using CoreTests.MockedObjects; using LiveChartsCore.Drawing; using LiveChartsCore.Drawing.Segments; using LiveChartsCore.Measure; @@ -7,11 +8,10 @@ using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.MockedObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class StackedAreaSeriesTest diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/StackedColumnSeriesTest.cs b/tests/CoreTests/SeriesTests/StackedColumnSeriesTest.cs similarity index 98% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/StackedColumnSeriesTest.cs rename to tests/CoreTests/SeriesTests/StackedColumnSeriesTest.cs index 95859c2a7..bffa504c8 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/StackedColumnSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/StackedColumnSeriesTest.cs @@ -1,15 +1,16 @@ using System; using System.Linq; +using CoreTests.MockedObjects; +using LiveChartsCore.Drawing; using LiveChartsCore.Measure; using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.MockedObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class StackedColumnSeriesTest @@ -128,7 +129,7 @@ public void ShouldPlaceDataLabel() var sutSeries = new StackedColumnSeries { Values = new double[] { -10, -5, -1, 0, 1, 5, 10 }, - DataPadding = new Drawing.LvcPoint(0, 0), + DataPadding = new LvcPoint(0, 0), DataLabelsPosition = DataLabelsPosition.End }; diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/StackedRowSeriesTest.cs b/tests/CoreTests/SeriesTests/StackedRowSeriesTest.cs similarity index 98% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/StackedRowSeriesTest.cs rename to tests/CoreTests/SeriesTests/StackedRowSeriesTest.cs index 7fb433f44..83a86bdc9 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/StackedRowSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/StackedRowSeriesTest.cs @@ -4,7 +4,7 @@ using LiveChartsCore.SkiaSharpView.SKCharts; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class StackedRowSeriesTest diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/StackedStepAreaSeriesTest.cs b/tests/CoreTests/SeriesTests/StackedStepAreaSeriesTest.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/StackedStepAreaSeriesTest.cs rename to tests/CoreTests/SeriesTests/StackedStepAreaSeriesTest.cs index 844dc4f68..8acb7d413 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/StackedStepAreaSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/StackedStepAreaSeriesTest.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using CoreTests.MockedObjects; using LiveChartsCore.Drawing; using LiveChartsCore.Drawing.Segments; using LiveChartsCore.Measure; @@ -7,11 +8,10 @@ using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.MockedObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class StackedStepAreaSeriesTest diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/StepLineSeriesTest.cs b/tests/CoreTests/SeriesTests/StepLineSeriesTest.cs similarity index 99% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/StepLineSeriesTest.cs rename to tests/CoreTests/SeriesTests/StepLineSeriesTest.cs index 8c1dec6fc..5279cde60 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/StepLineSeriesTest.cs +++ b/tests/CoreTests/SeriesTests/StepLineSeriesTest.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using CoreTests.MockedObjects; using LiveChartsCore.Drawing; using LiveChartsCore.Drawing.Segments; using LiveChartsCore.Measure; @@ -7,11 +8,10 @@ using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.MockedObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class StepLineSeriesTest diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/VisibilityTests.cs b/tests/CoreTests/SeriesTests/VisibilityTests.cs similarity index 97% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/VisibilityTests.cs rename to tests/CoreTests/SeriesTests/VisibilityTests.cs index 7817e570c..5232e326e 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/VisibilityTests.cs +++ b/tests/CoreTests/SeriesTests/VisibilityTests.cs @@ -1,15 +1,16 @@ using System; using System.Collections; using System.Linq; +using CoreTests.CoreObjectsTests; +using LiveChartsCore; using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.CoreObjectsTests; using LiveChartsGeneratedCode; using Microsoft.VisualStudio.TestTools.UnitTesting; using SkiaSharp; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; [TestClass] public class VisibilityTests diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/_MemoryTests.cs b/tests/CoreTests/SeriesTests/_MemoryTests.cs similarity index 98% rename from tests/LiveChartsCore.UnitTesting/SeriesTests/_MemoryTests.cs rename to tests/CoreTests/SeriesTests/_MemoryTests.cs index 34a9e8f1b..c77ef69d6 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/_MemoryTests.cs +++ b/tests/CoreTests/SeriesTests/_MemoryTests.cs @@ -1,16 +1,17 @@ using System; using System.Collections; using System.Collections.ObjectModel; +using CoreTests.CoreObjectsTests; +using LiveChartsCore; using LiveChartsCore.Defaults; using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.UnitTesting.CoreObjectsTests; using LiveChartsGeneratedCode; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting.SeriesTests; +namespace CoreTests.SeriesTests; -//[TestClass] +[TestClass] public class _MemoryTests { private static readonly int s_repeatCount; @@ -18,7 +19,7 @@ public class _MemoryTests static _MemoryTests() { - s_repeatCount = 5000; + s_repeatCount = 1500; // originally 5000, reduced for faster test runs var threshold = 2 * 1024 * 1024 * (s_repeatCount / 5000d); // 2MB each 5000 repeats s_treshold = threshold < 1 * 1024 * 1024 ? 1 * 1024 * 1024 diff --git a/tests/LiveChartsCore.UnitTesting/TestsInitializer.cs b/tests/CoreTests/TestsInitializer.cs similarity index 88% rename from tests/LiveChartsCore.UnitTesting/TestsInitializer.cs rename to tests/CoreTests/TestsInitializer.cs index 638e9048f..6ade4ecf6 100644 --- a/tests/LiveChartsCore.UnitTesting/TestsInitializer.cs +++ b/tests/CoreTests/TestsInitializer.cs @@ -1,8 +1,9 @@ -using LiveChartsCore.Motion; +using LiveChartsCore; +using LiveChartsCore.Motion; using LiveChartsCore.SkiaSharpView; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace LiveChartsCore.UnitTesting; +namespace CoreTests; [TestClass] public class TestsInitializer diff --git a/tests/LiveChartsCore.UnitTesting/LiveChartsCore.UnitTesting.csproj b/tests/LiveChartsCore.UnitTesting/LiveChartsCore.UnitTesting.csproj deleted file mode 100644 index 09114723e..000000000 --- a/tests/LiveChartsCore.UnitTesting/LiveChartsCore.UnitTesting.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - $(GlobalLangVersion) - net462;net6.0;net8.0 - false - - - - - - - - - - - - - - diff --git a/tests/LiveChartsCore.UnitTesting/MockedObjects/TestLabel.cs b/tests/LiveChartsCore.UnitTesting/MockedObjects/TestLabel.cs deleted file mode 100644 index 2004e4924..000000000 --- a/tests/LiveChartsCore.UnitTesting/MockedObjects/TestLabel.cs +++ /dev/null @@ -1,11 +0,0 @@ -using LiveChartsCore.SkiaSharpView.Drawing.Geometries; - -namespace LiveChartsCore.UnitTesting.MockedObjects; - -public class TestLabel : LabelGeometry -{ - public TestLabel() - { - Background = new Drawing.LvcColor(200, 200, 200, 50); - } -} diff --git a/tests/SharedUITests/CartesianChartTests.cs b/tests/SharedUITests/CartesianChartTests.cs new file mode 100644 index 000000000..0640cb1c6 --- /dev/null +++ b/tests/SharedUITests/CartesianChartTests.cs @@ -0,0 +1,60 @@ +using Factos; +using SharedUITests.Helpers; +using Xunit; + +// to run these tests, see the UITests project, specially the program.cs file. +// to enable IDE intellisense for these tests, go to Directory.Build.props and set UITesting to true. + +namespace SharedUITests; + +public class CartesianChartTests +{ + public AppController App => AppController.Current; + + [AppTestMethod] + public async Task ShouldLoad() + { + var sut = await App.NavigateTo(); + await sut.Chart.WaitUntilChartRenders(); + + Assert.ChartIsLoaded(sut.Chart); + } + +#if XAML_UI_TESTING + [AppTestMethod] + public async Task ShouldLoadTemplatedChart() + { + var sut = await App.NavigateTo(); + + // to make it simple, wait for some time for the template to load + await Task.Delay(2000); + + // now lets find the templated charts + foreach (var chart in sut.FindCharts()) + { + await chart.WaitUntilChartRenders(); + Assert.ChartIsLoaded(chart); + } + } +#endif + +#if !BLAZOR_UI_TESTING + // this test makes no sense in blazor. + + [AppTestMethod] + public async Task ShouldUnloadAndReload() + { + var sut = new Samples.Bars.AutoUpdate.View(); + + await App.NavigateToView(sut); + await sut.Chart.WaitUntilChartRenders(); + Assert.ChartIsLoaded(sut.Chart); + + await App.PopNavigation(); + + await App.NavigateToView(sut); + await sut.Chart.WaitUntilChartRenders(); + Assert.ChartIsLoaded(sut.Chart); + } +#endif +} diff --git a/tests/SharedUITests/GlobalUsings.cs b/tests/SharedUITests/GlobalUsings.cs new file mode 100644 index 000000000..d355267b5 --- /dev/null +++ b/tests/SharedUITests/GlobalUsings.cs @@ -0,0 +1,27 @@ +#if AVALONIA_UI_TESTING +global using Samples = AvaloniaSample; +#endif + +#if BLAZOR_UI_TESTING +global using Samples = BlazorSample.Pages; +#endif + +#if ETO_UI_TESTING +global using Samples = EtoFormsSample; +#endif + +#if MAUI_UI_TESTING +global using Samples = MauiSample; +#endif + +#if UNO_UI_TESTING || WINUI_UI_TESTING +global using Samples = WinUISample; +#endif + +#if WINFORMS_UI_TESTING +global using Samples = WinFormsSample; +#endif + +#if WPF_UI_TESTING +global using Samples = WPFSample; +#endif diff --git a/tests/SharedUITests/Helpers/UIHelpersExtensions.cs b/tests/SharedUITests/Helpers/UIHelpersExtensions.cs new file mode 100644 index 000000000..52cebe9e7 --- /dev/null +++ b/tests/SharedUITests/Helpers/UIHelpersExtensions.cs @@ -0,0 +1,103 @@ +// The MIT License(MIT) +// +// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using Factos; +using LiveChartsCore.Kernel.Sketches; +using Xunit; + +namespace SharedUITests.Helpers; + +public static class UIHelpersExtensions +{ + extension(AppController controller) + { + public async Task NavigateTo() + where T : class, new() + { +#if BLAZOR_UI_TESTING + var blazorController = (Factos.Blazor.BlazorAppController)controller; + return await blazorController.NavigateToView(); +#else + var view = new T(); + await controller.NavigateToView(view); + return view; +#endif + } + + } + + extension(IChartView chartView) + { + public Task WaitUntilChartRenders() + { + var tcs = new TaskCompletionSource(); + + if (chartView.CoreCanvas.IsValid) + { + tcs.SetResult(new()); + return tcs.Task; + } + + // force an update, then wait for the update to start in the ui thread + chartView.CoreChart.Update(new LiveChartsCore.Kernel.ChartUpdateParams + { + IsAutomaticUpdate = false, + Throttling = false + }); + + void Handler(IChartView chart) + { + chartView.UpdateStarted -= Handler; + tcs.SetResult(new()); + } + + chartView.UpdateStarted += Handler; + + return tcs.Task; + } + } + + extension(Assert) + { + public static void ChartIsLoaded(IChartView chartView) + { + Assert.True(chartView.CoreChart.IsLoaded); + + var fetchedPoints = chartView.Series + .SelectMany(s => s.Fetch(chartView.CoreChart)) + .ToArray(); + + Assert.NotEmpty(fetchedPoints); + + Assert.All(fetchedPoints, point => + { + // this only validates that points have a size and position + // but the proper scale and position is tested in LiveChartsCore.UnitTesting + + var v = point.Context.Visual; + Assert.NotNull(v); + Assert.True(v.X > 0); + Assert.True(v.Y > 0); + }); + } + } +} diff --git a/tests/SharedUITests/PieChartTests.cs b/tests/SharedUITests/PieChartTests.cs new file mode 100644 index 000000000..d122514a2 --- /dev/null +++ b/tests/SharedUITests/PieChartTests.cs @@ -0,0 +1,42 @@ +using Factos; +using SharedUITests.Helpers; +using Xunit; + +// to run these tests, see the UITests project, specially the program.cs file. +// to enable IDE intellisense for these tests, go to Directory.Build.props and set UITesting to true. + +namespace SharedUITests; + +public class PieChartTests +{ + public AppController App => AppController.Current; + + [AppTestMethod] + public async Task ShouldLoad() + { + var sut = await App.NavigateTo(); + await sut.Chart.WaitUntilChartRenders(); + + Assert.ChartIsLoaded(sut.Chart); + } + +#if !BLAZOR_UI_TESTING + // this test makes no sense in blazor. + + [AppTestMethod] + public async Task ShouldUnloadAndReload() + { + var sut = new Samples.Pies.AutoUpdate.View(); + + await App.NavigateToView(sut); + await sut.Chart.WaitUntilChartRenders(); + Assert.ChartIsLoaded(sut.Chart); + + await App.PopNavigation(); + + await App.NavigateToView(sut); + await sut.Chart.WaitUntilChartRenders(); + Assert.ChartIsLoaded(sut.Chart); + } +#endif +} diff --git a/tests/SharedUITests/PolarChartTests.cs b/tests/SharedUITests/PolarChartTests.cs new file mode 100644 index 000000000..9f3fe70b2 --- /dev/null +++ b/tests/SharedUITests/PolarChartTests.cs @@ -0,0 +1,22 @@ +using Factos; +using SharedUITests.Helpers; +using Xunit; + +// to run these tests, see the UITests project, specially the program.cs file. +// to enable IDE intellisense for these tests, go to Directory.Build.props and set UITesting to true. + +namespace SharedUITests; + +public class PolarChartTests +{ + public AppController App => AppController.Current; + + [AppTestMethod] + public async Task ShouldLoad() + { + var sut = await App.NavigateTo(); + await sut.Chart.WaitUntilChartRenders(); + + Assert.ChartIsLoaded(sut.Chart); + } +} diff --git a/tests/SharedUITests/SharedUITests.projitems b/tests/SharedUITests/SharedUITests.projitems new file mode 100644 index 000000000..a72afcb56 --- /dev/null +++ b/tests/SharedUITests/SharedUITests.projitems @@ -0,0 +1,14 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + 730ba90c-a574-4b17-9eeb-c28a4d782449 + + + SharedUITests + + + + + \ No newline at end of file diff --git a/tests/SharedUITests/SharedUITests.shproj b/tests/SharedUITests/SharedUITests.shproj new file mode 100644 index 000000000..c4a891fe2 --- /dev/null +++ b/tests/SharedUITests/SharedUITests.shproj @@ -0,0 +1,13 @@ + + + + 730ba90c-a574-4b17-9eeb-c28a4d782449 + 14.0 + + + + + + + + diff --git a/tests/UITests/Program.cs b/tests/UITests/Program.cs new file mode 100644 index 000000000..494aa5fc6 --- /dev/null +++ b/tests/UITests/Program.cs @@ -0,0 +1,130 @@ +#pragma warning disable IDE0073 // The file header is missing or not located at the top of the file +#pragma warning disable format + +using Factos.Server; +using Factos.Server.Settings; +using Factos.Server.Settings.Apps; +using Microsoft.Testing.Extensions; +using Microsoft.Testing.Platform.Builder; + +// About UI test: +// we use https://github.com/beto-rodriguez/Factos +// it allows us to run the same UI tests against multiple UI frameworks, +// including desktop, web and mobile platforms. + +// how it works: +// we define tests in the SharedUITests project, +// then each sample app references the SharedUITests project, +// finally factos starts each sample app, connects to it and runs the tests defined in SharedUITests. + +#if DEBUG +// notice on Debug the cli args are overridden to make it easier to test locally, +// on Release the args passed from the CI pipeline are used. + +// To select which app to run, set the appToRun variable, options are listed at the toTest table below (uid column) +// setting appToRun to "manual-start" will wait for you to start the app manually. + +// uno and maui require also to pass the target framework, see tf variable below, will be ignored if not required by the tested app. +// emulators must be running before starting the tests. + +var appToRun = "wpf-net462"; +var tf = "net10.0-android"; + +args = [ + "--select", appToRun, + "--test-env", $"tf={tf}" +]; + +// in debug we use the relative path from the bin\debug folder to the samples +var root = "../../../../../samples"; +#else +// in release we use the relative path from the root of the repo for CI purposes +var root = "samples"; +#endif + +var testsBuilder = await TestApplication.CreateBuilderAsync(args); +var testedApps = new List(); + +MSBuildArg[] msBuildArgs = []; + +#if !DEBUG +// in CI we use the nuget packages for everything +// we pack and test the nuget packages against the samples +// lvcversionsuffix is a version suffix we pass from the pipeline, it can be something like "-ci-1234" +// where 1234 is a build number or a commit id which NuGet packages were published with. +msBuildArgs = [ + new("UITesting", "true"), + new("UseNuGetForSamples", "true"), + new("LiveChartsVersionSuffix", "[lvcversionsuffix]") +]; +#endif + +MSBuildArg tf_var = new("TargetFramework", "[tf]"); +MSBuildArg tf_n10w = new("TestBuildTargetFramework", "net10.0-windows"); +MSBuildArg tf_n10w10 = new("TestBuildTargetFramework", "net10.0-windows10.0.19041.0"); +MSBuildArg tf_n462 = new("TestBuildTargetFramework", "net462"); +MSBuildArg isTest = new("IsTestBuild", "true"); +MSBuildArg[] winUIArgs = [ + .. msBuildArgs, + new("RuntimeIdentifier", "win-x64"), + new("WindowsPackageType", "None"), + new("WindowsAppSDKSelfContained", "true") +]; + +const string avaloniaDir = "AvaloniaSample/Platforms/AvaloniaSample"; +const string unoDir = "UnoPlatformSample/UnoPlatformSample"; + +TestRecord[] toTest = [ + // | projectPath | uid | msBuildArgs | host + // --------------------------------------------------------------------------------------------------------------------------------------- + new($"{root}/{avaloniaDir}.Android", "avalonia-android", msBuildArgs), + new($"{root}/{avaloniaDir}.Browser", "avalonia-browser", msBuildArgs, AppHost.HeadlessChrome), + new($"{root}/{avaloniaDir}.Desktop", "avalonia-desktop", msBuildArgs), + new($"{root}/{avaloniaDir}.iOS", "avalonia-ios", msBuildArgs), + + new($"{root}/BlazorSample", "blazor", msBuildArgs, AppHost.HeadlessChrome), + + new($"{root}/MauiSample", "maui", [..msBuildArgs, tf_var]), + + new($"{root}/{unoDir}", "uno", [..msBuildArgs, tf_var]), + + new($"{root}/WinUISample/WinUISample", "winui", winUIArgs), + new($"{root}/EtoFormsSample", "eto", msBuildArgs), + + // for winforms and wpf we ensure the nuget packages work on multiple target frameworks + // because net framework uses strong named assemblies + // there is also https://github.com/mono/SkiaSharp/issues/3153, which could cause conflicts when the package is restored + + new($"{root}/WinFormsSample", "winforms-net10", [..msBuildArgs, tf_n10w, isTest]), + new($"{root}/WinFormsSample", "winforms-net10w19041", [..msBuildArgs, tf_n10w10, isTest]), + new($"{root}/WinFormsSample", "winforms-net462", [..msBuildArgs, tf_n462, isTest]), + + new($"{root}/WpfSample", "wpf-net10", [..msBuildArgs, tf_n10w, isTest]), + new($"{root}/WpfSample", "wpf-net10w19041", [..msBuildArgs, tf_n10w10, isTest]), + new($"{root}/WpfSample", "wpf-net462", [..msBuildArgs, tf_n462, isTest]) +]; + +testedApps + .AddManuallyStartedApp(); + +foreach (var testRecord in toTest) + testedApps.Add( + project: testRecord.projectPath, + uid: testRecord.Uid, + msBuildArgs: testRecord.MSBuildArgs, + appHost: testRecord.host); + +testsBuilder + .AddFactos(new FactosSettings() + { + ConnectionTimeout = 600, + TestedApps = testedApps + }) + .AddTrxReportProvider(); + +using var testApp = await testsBuilder.BuildAsync(); + +return await testApp.RunAsync(); + +public record TestRecord( + string projectPath, string Uid, MSBuildArg[]? MSBuildArgs = null, AppHost host = AppHost.Auto); diff --git a/tests/UITests/UITests.csproj b/tests/UITests/UITests.csproj new file mode 100644 index 000000000..ee8553efb --- /dev/null +++ b/tests/UITests/UITests.csproj @@ -0,0 +1,15 @@ + + + + Exe + net10.0 + enable + enable + true + + + + + + +