diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c32b160f..ae41e059 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,32 +3,32 @@ name: Release
on:
workflow_dispatch:
inputs:
- version:
- description: '版本号'
+ version:
+ description: "版本号"
required: true
- default: '0.0.0.0'
+ default: "0.0.0.0"
enableX64:
- description: '启用x64'
+ description: "启用x64"
required: true
default: true
type: boolean
enableX64Native:
- description: '启用x64Native'
+ description: "启用x64Native"
required: true
default: true
type: boolean
enableX86:
- description: '启用x86'
+ description: "启用x86"
required: true
default: false
type: boolean
enableArm64:
- description: '启用Arm64'
+ description: "启用Arm64"
required: true
default: true
type: boolean
enableArm32:
- description: '启用Arm32'
+ description: "启用Arm32"
required: true
default: false
type: boolean
@@ -53,246 +53,241 @@ jobs:
nuget_package: biliuwp-lite-nuget-packages.zip
steps:
-
- - name: Configure Pagefile
- uses: al-cheb/configure-pagefile-action@v1.2
- with:
- minimum-size: 32GB
- maximum-size: 32GB
- disk-root: "C:"
-
- - name: Checkout
- uses: actions/checkout@v2
- with:
- fetch-depth: 0
-
- - name: EchoInput
- run: |
- echo 启用x64编译 ${{ github.event.inputs.enableX64 }}
- echo 启用x86编译 ${{ github.event.inputs.enableX86 }}
- echo 启用Arm64编译 ${{ github.event.inputs.enableArm64 }}
- echo 启用Arm编译 ${{ github.event.inputs.enableArm32 }}
-
- - name: Download and process necessary files
- run: |
- curl --location $env:Webdav_addr --header "$env:Webdav_auth" -o "$env:UWP_Project_Directory/$env:SigningCertificate" --insecure
- curl --location $env:nuget_package_addr --header "$env:Webdav_auth" -o "$env:nuget_package" --insecure
- Expand-Archive -path $env:nuget_package -DestinationPath ./
- cp -r ./packages ./src/
-
- - uses: release-drafter/release-drafter@v5
- name: Create release draft
- id: release-drafter
-
- - name: Setup MSBuild.exe
- uses: microsoft/setup-msbuild@v1.0.3
-
- - name: Windows SDK Install
- uses: ChristopheLav/windows-sdk-install@v1.0.1
- with:
- version-sdk: 18362
- features: 'OptionId.WindowsPerformanceToolkit,OptionId.WindowsDesktopDebuggers,OptionId.AvrfExternal,OptionId.NetFxSoftwareDevelopmentKit,OptionId.WindowsSoftwareLogoToolkit,OptionId.IpOverUsb,OptionId.MSIInstallTools,OptionId.SigningTools,OptionId.UWPManaged,OptionId.UWPCPP,OptionId.UWPLocalized,OptionId.DesktopCPPx86,OptionId.DesktopCPPx64,OptionId.DesktopCPParm,OptionId.DesktopCPParm64'
-
- - name: Update manifest version
- run: |
- [xml]$manifest = get-content ".\$env:UWP_Project_Directory\Package.appxmanifest"
- $manifest.Package.Identity.Version = "${{github.event.inputs.version}}"
- $manifest.save(".\$env:UWP_Project_Directory\Package.appxmanifest")
-
- - name: Create Package Directory
- run: New-Item -ItemType Directory -Path C:\Package
-
- - name: document processing
- run: |
- git clone https://github.com/ywmoyue/OnlinePageToPDF-Node.git
- cd OnlinePageToPDF-Node
- npm install
- node index.js --waitTime=35000 --pageUrl="http://markdown.muyan233.top:352/?fileUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fywmoyue%2Fbiliuwp-lite%2Fdev%2Fdocument%2Finstall-readme.md" --pdfFilePath="安装教程.pdf"
- cd ..
- cp ./OnlinePageToPDF-Node/安装教程.pdf C:\Package\安装教程.pdf
-
- - name: Build x64
- run: |
- msbuild $env:UWP_Project_Directory /p:Platform=x64 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore
- env:
- BuildMode: SideloadOnly
- Configuration: Release
- if: github.event.inputs.enableX64 == 'true'
-
- - name: copy x64 document
- run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test\安装教程.pdf
- if: github.event.inputs.enableX64 == 'true'
-
- - name: Remove x64 useless files
- run: |
- cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test
- rm -r -fo *.appxsym
- cd Dependencies
- rm -r -fo arm,arm64,x86
- if: github.event.inputs.enableX64 == 'true'
-
- - name: Create x64 archive
- run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64.zip
- if: github.event.inputs.enableX64 == 'true'
-
- - name: Update x64 release asset
- id: upload-release-asset-x64
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
- if: github.event.inputs.enableX64 == 'true'
- with:
- upload_url: ${{ steps.release-drafter.outputs.upload_url }}
- asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64.zip
- asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_x64.zip
- asset_content_type: application/zip
-
-
-
- - name: Set x64 native
- run: |
- rm $env:UWP_Project_Path
- cp $env:UWP_X64_Native_Project_Path $env:UWP_Project_Path
- if: github.event.inputs.enableX64Native == 'true'
-
- - name: Build x64 native
- run: |
- msbuild $env:UWP_Project_Directory /p:Platform=x64 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore
- env:
- BuildMode: SideloadOnly
- Configuration: Release
- if: github.event.inputs.enableX64Native == 'true'
-
- - name: copy x64 native document
- run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test\安装教程.pdf
- if: github.event.inputs.enableX64Native == 'true'
-
- - name: Remove x64 native useless files
- run: |
- cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test
- rm -r -fo *.appxsym
- cd Dependencies
- rm -r -fo arm,arm64,x86
- if: github.event.inputs.enableX64Native == 'true'
-
- - name: Create x64 native archive
- run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64_native.zip
- if: github.event.inputs.enableX64Native == 'true'
-
- - name: Update x64 native release asset
- id: upload-release-asset-x64-native
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
- if: github.event.inputs.enableX64Native == 'true'
- with:
- upload_url: ${{ steps.release-drafter.outputs.upload_url }}
- asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64_native.zip
- asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_x64_native.zip
- asset_content_type: application/zip
-
-
- - name: Build x86
- run: msbuild $env:UWP_Project_Directory /p:Platform=x86 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore
- if: github.event.inputs.enableX86 == 'true'
- env:
- BuildMode: SideloadOnly
- Configuration: Release
-
- - name: copy x86 document
- run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x86_Test\安装教程.pdf
- if: github.event.inputs.enableX86 == 'true'
-
- - name: Remove x86 useless files
- run: |
- cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x86_Test
- rm -r -fo *.appxsym
- cd Dependencies
- rm -r -fo arm,arm64,x64
- if: github.event.inputs.enableX86 == 'true'
-
- - name: Create x86 archive
- run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x86_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x86.zip
- if: github.event.inputs.enableX86 == 'true'
-
- - name: Update x86 release asset
- id: upload-release-asset-x86
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
- if: github.event.inputs.enableX86 == 'true'
- with:
- upload_url: ${{ steps.release-drafter.outputs.upload_url }}
- asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x86.zip
- asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_x86.zip
- asset_content_type: application/zip
-
- - name: Build ARM64
- run: msbuild $env:UWP_Project_Directory /p:Platform=ARM64 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore
- if: github.event.inputs.enableArm64 == 'true'
- env:
- BuildMode: SideloadOnly
- Configuration: Release
-
- - name: copy arm64 document
- run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM64_Test\安装教程.pdf
- if: github.event.inputs.enableArm64 == 'true'
-
- - name: Remove arm64 useless files
- run: |
- cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM64_Test
- rm -r -fo *.appxsym
- cd Dependencies
- rm -r -fo arm,x64,x86
- if: github.event.inputs.enableArm64 == 'true'
-
- - name: Create ARM64 archive
- run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM64_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM64.zip
- if: github.event.inputs.enableArm64 == 'true'
-
- - name: Update ARM64 release asset
- id: upload-release-asset-ARM64
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
- if: github.event.inputs.enableArm64 == 'true'
- with:
- upload_url: ${{ steps.release-drafter.outputs.upload_url }}
- asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM64.zip
- asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_ARM64.zip
- asset_content_type: application/zip
-
- - name: Build ARM32
- run: msbuild $env:UWP_Project_Directory /p:Platform=ARM /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore
- if: github.event.inputs.enableArm32 == 'true'
- env:
- BuildMode: SideloadOnly
- Configuration: Release
-
- - name: copy arm32 document
- run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM_Test\安装教程.pdf
- if: github.event.inputs.enableArm32 == 'true'
-
- - name: Remove arm32 useless files
- run: |
- cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM_Test
- rm -r -fo *.appxsym
- cd Dependencies
- rm -r -fo arm64,x64,x86
- if: github.event.inputs.enableArm32 == 'true'
-
- - name: Create ARM32 archive
- run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM.zip
- if: github.event.inputs.enableArm32 == 'true'
-
- - name: Update ARM32 release asset
- id: upload-release-asset-ARM32
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
- if: github.event.inputs.enableArm32 == 'true'
- with:
- upload_url: ${{ steps.release-drafter.outputs.upload_url }}
- asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM.zip
- asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_ARM.zip
- asset_content_type: application/zip
+ - name: Configure Pagefile
+ uses: al-cheb/configure-pagefile-action@v1.2
+ with:
+ minimum-size: 32GB
+ maximum-size: 32GB
+ disk-root: "C:"
+
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: EchoInput
+ run: |
+ echo 启用x64编译 ${{ github.event.inputs.enableX64 }}
+ echo 启用x86编译 ${{ github.event.inputs.enableX86 }}
+ echo 启用Arm64编译 ${{ github.event.inputs.enableArm64 }}
+ echo 启用Arm编译 ${{ github.event.inputs.enableArm32 }}
+
+ - name: Download and process necessary files
+ run: |
+ curl --location $env:Webdav_addr --header "$env:Webdav_auth" -o "$env:UWP_Project_Directory/$env:SigningCertificate" --insecure
+ curl --location $env:nuget_package_addr --header "$env:Webdav_auth" -o "$env:nuget_package" --insecure
+ Expand-Archive -path $env:nuget_package -DestinationPath ./
+ cp -r ./packages ./src/
+
+ - uses: release-drafter/release-drafter@v5
+ name: Create release draft
+ id: release-drafter
+
+ - name: Setup MSBuild.exe
+ uses: microsoft/setup-msbuild@v1.0.3
+
+ - name: Windows SDK Install
+ uses: ChristopheLav/windows-sdk-install@v1.0.1
+ with:
+ version-sdk: 18362
+ features: "OptionId.WindowsPerformanceToolkit,OptionId.WindowsDesktopDebuggers,OptionId.AvrfExternal,OptionId.NetFxSoftwareDevelopmentKit,OptionId.WindowsSoftwareLogoToolkit,OptionId.IpOverUsb,OptionId.MSIInstallTools,OptionId.SigningTools,OptionId.UWPManaged,OptionId.UWPCPP,OptionId.UWPLocalized,OptionId.DesktopCPPx86,OptionId.DesktopCPPx64,OptionId.DesktopCPParm,OptionId.DesktopCPParm64"
+
+ - name: Update manifest version
+ run: |
+ [xml]$manifest = get-content ".\$env:UWP_Project_Directory\Package.appxmanifest"
+ $manifest.Package.Identity.Version = "${{github.event.inputs.version}}"
+ $manifest.save(".\$env:UWP_Project_Directory\Package.appxmanifest")
+
+ - name: Create Package Directory
+ run: New-Item -ItemType Directory -Path C:\Package
+
+ - name: document processing
+ run: |
+ git clone https://github.com/ywmoyue/OnlinePageToPDF-Node.git
+ cd OnlinePageToPDF-Node
+ npm install
+ node index.js --waitTime=35000 --pageUrl="http://markdown.muyan233.top:352/?fileUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fywmoyue%2Fbiliuwp-lite%2Fdev%2Fdocument%2Finstall-readme.md" --pdfFilePath="安装教程.pdf"
+ cd ..
+ cp ./OnlinePageToPDF-Node/安装教程.pdf C:\Package\安装教程.pdf
+
+ - name: Build x64
+ run: |
+ msbuild $env:UWP_Project_Directory /p:Platform=x64 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore
+ env:
+ BuildMode: SideloadOnly
+ Configuration: Release
+ if: github.event.inputs.enableX64 == 'true'
+
+ - name: copy x64 document
+ run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test\安装教程.pdf
+ if: github.event.inputs.enableX64 == 'true'
+
+ - name: Remove x64 useless files
+ run: |
+ cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test
+ rm -r -fo *.appxsym
+ cd Dependencies
+ rm -r -fo arm,arm64,x86
+ if: github.event.inputs.enableX64 == 'true'
+
+ - name: Create x64 archive
+ run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64.zip
+ if: github.event.inputs.enableX64 == 'true'
+
+ - name: Update x64 release asset
+ id: upload-release-asset-x64
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
+ if: github.event.inputs.enableX64 == 'true'
+ with:
+ upload_url: ${{ steps.release-drafter.outputs.upload_url }}
+ asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64.zip
+ asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_x64.zip
+ asset_content_type: application/zip
+
+ - name: Set x64 native
+ run: |
+ ./scripts/setNative.ps1 -csprojPath $env:UWP_Project_Path
+ if: github.event.inputs.enableX64Native == 'true'
+
+ - name: Build x64 native
+ run: |
+ msbuild $env:UWP_Project_Directory /p:Platform=x64 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore /p:Use64BitCompiler=true
+ env:
+ BuildMode: SideloadOnly
+ Configuration: Release
+ if: github.event.inputs.enableX64Native == 'true'
+
+ - name: copy x64 native document
+ run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test\安装教程.pdf
+ if: github.event.inputs.enableX64Native == 'true'
+
+ - name: Remove x64 native useless files
+ run: |
+ cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test
+ rm -r -fo *.appxsym
+ cd Dependencies
+ rm -r -fo arm,arm64,x86
+ if: github.event.inputs.enableX64Native == 'true'
+
+ - name: Create x64 native archive
+ run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x64_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64_native.zip
+ if: github.event.inputs.enableX64Native == 'true'
+
+ - name: Update x64 native release asset
+ id: upload-release-asset-x64-native
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
+ if: github.event.inputs.enableX64Native == 'true'
+ with:
+ upload_url: ${{ steps.release-drafter.outputs.upload_url }}
+ asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x64_native.zip
+ asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_x64_native.zip
+ asset_content_type: application/zip
+
+ - name: Build x86
+ run: msbuild $env:UWP_Project_Directory /p:Platform=x86 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore
+ if: github.event.inputs.enableX86 == 'true'
+ env:
+ BuildMode: SideloadOnly
+ Configuration: Release
+
+ - name: copy x86 document
+ run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x86_Test\安装教程.pdf
+ if: github.event.inputs.enableX86 == 'true'
+
+ - name: Remove x86 useless files
+ run: |
+ cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x86_Test
+ rm -r -fo *.appxsym
+ cd Dependencies
+ rm -r -fo arm,arm64,x64
+ if: github.event.inputs.enableX86 == 'true'
+
+ - name: Create x86 archive
+ run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_x86_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x86.zip
+ if: github.event.inputs.enableX86 == 'true'
+
+ - name: Update x86 release asset
+ id: upload-release-asset-x86
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
+ if: github.event.inputs.enableX86 == 'true'
+ with:
+ upload_url: ${{ steps.release-drafter.outputs.upload_url }}
+ asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_x86.zip
+ asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_x86.zip
+ asset_content_type: application/zip
+
+ - name: Build ARM64
+ run: msbuild $env:UWP_Project_Directory /p:Platform=ARM64 /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore
+ if: github.event.inputs.enableArm64 == 'true'
+ env:
+ BuildMode: SideloadOnly
+ Configuration: Release
+
+ - name: copy arm64 document
+ run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM64_Test\安装教程.pdf
+ if: github.event.inputs.enableArm64 == 'true'
+
+ - name: Remove arm64 useless files
+ run: |
+ cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM64_Test
+ rm -r -fo *.appxsym
+ cd Dependencies
+ rm -r -fo arm,x64,x86
+ if: github.event.inputs.enableArm64 == 'true'
+
+ - name: Create ARM64 archive
+ run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM64_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM64.zip
+ if: github.event.inputs.enableArm64 == 'true'
+
+ - name: Update ARM64 release asset
+ id: upload-release-asset-ARM64
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
+ if: github.event.inputs.enableArm64 == 'true'
+ with:
+ upload_url: ${{ steps.release-drafter.outputs.upload_url }}
+ asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM64.zip
+ asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_ARM64.zip
+ asset_content_type: application/zip
+
+ - name: Build ARM32
+ run: msbuild $env:UWP_Project_Directory /p:Platform=ARM /p:Configuration=Release /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=$env:SigningCertificatePasswd /restore
+ if: github.event.inputs.enableArm32 == 'true'
+ env:
+ BuildMode: SideloadOnly
+ Configuration: Release
+
+ - name: copy arm32 document
+ run: cp C:\Package\安装教程.pdf ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM_Test\安装教程.pdf
+ if: github.event.inputs.enableArm32 == 'true'
+
+ - name: Remove arm32 useless files
+ run: |
+ cd ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM_Test
+ rm -r -fo *.appxsym
+ cd Dependencies
+ rm -r -fo arm64,x64,x86
+ if: github.event.inputs.enableArm32 == 'true'
+
+ - name: Create ARM32 archive
+ run: Compress-Archive -Path ${{env.UWP_Project_Directory}}\AppPackages\${{env.AppName}}_${{github.event.inputs.version}}_ARM_Test -DestinationPath C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM.zip
+ if: github.event.inputs.enableArm32 == 'true'
+
+ - name: Update ARM32 release asset
+ id: upload-release-asset-ARM32
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
+ if: github.event.inputs.enableArm32 == 'true'
+ with:
+ upload_url: ${{ steps.release-drafter.outputs.upload_url }}
+ asset_path: C:\Package\${{env.AppName}}_${{github.event.inputs.version}}_ARM.zip
+ asset_name: ${{env.AppName}}_${{github.event.inputs.version}}_ARM.zip
+ asset_content_type: application/zip
diff --git a/BiliLite.sln b/BiliLite.sln
index c7201e94..3ab038f3 100644
--- a/BiliLite.sln
+++ b/BiliLite.sln
@@ -28,6 +28,8 @@ Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "BiliLite.Packages", "src\Bi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BiliLite.Win32Tools", "src\BiliLite.Win32Tools\BiliLite.Win32Tools.csproj", "{B44AD18B-7805-4FFB-A29E-C57D09C8D425}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackgroundTasks", "src\BackgroundTasks\BackgroundTasks.csproj", "{32288EDB-3F7F-479A-8303-7BB6705E0636}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -200,6 +202,26 @@ Global
{B44AD18B-7805-4FFB-A29E-C57D09C8D425}.Release|x64.Build.0 = Release|Any CPU
{B44AD18B-7805-4FFB-A29E-C57D09C8D425}.Release|x86.ActiveCfg = Release|Any CPU
{B44AD18B-7805-4FFB-A29E-C57D09C8D425}.Release|x86.Build.0 = Release|Any CPU
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Debug|ARM.ActiveCfg = Debug|ARM
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Debug|ARM.Build.0 = Debug|ARM
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Debug|ARM64.Build.0 = Debug|ARM64
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Debug|x64.ActiveCfg = Debug|x64
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Debug|x64.Build.0 = Debug|x64
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Debug|x86.ActiveCfg = Debug|x86
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Debug|x86.Build.0 = Debug|x86
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Release|Any CPU.Build.0 = Release|Any CPU
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Release|ARM.ActiveCfg = Release|ARM
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Release|ARM.Build.0 = Release|ARM
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Release|ARM64.ActiveCfg = Release|ARM64
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Release|ARM64.Build.0 = Release|ARM64
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Release|x64.ActiveCfg = Release|x64
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Release|x64.Build.0 = Release|x64
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Release|x86.ActiveCfg = Release|x86
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/scripts/setNative.ps1 b/scripts/setNative.ps1
new file mode 100644
index 00000000..f6cc6cef
--- /dev/null
+++ b/scripts/setNative.ps1
@@ -0,0 +1,47 @@
+param (
+ [string]$csprojPath
+)
+
+# Check if the input file exists
+if (-not (Test-Path $csprojPath)) {
+ Write-Error "File not found: $csprojPath"
+ exit 1
+}
+
+# Read the content of the csproj file with UTF-8 encoding
+$csprojContent = Get-Content -Path $csprojPath -Raw -Encoding UTF8
+
+# Define the target PropertyGroup condition
+# Use backticks to escape the $ character
+$targetCondition = "'`$(Configuration)|`$(Platform)' == 'Release|x64'"
+
+# Find the PropertyGroup with the target condition
+$propertyGroupRegex = [regex]::Escape("") + ".*?" + [regex]::Escape("")
+$propertyGroupMatch = [regex]::Match($csprojContent, $propertyGroupRegex, [Text.RegularExpressions.RegexOptions]::Singleline)
+
+if ($propertyGroupMatch.Success) {
+ # Extract the PropertyGroup content
+ $propertyGroupContent = $propertyGroupMatch.Value
+
+ # Check if UseDotNetNativeToolchain exists in the PropertyGroup
+ $useDotNetNativeToolchainRegex = [regex]::Escape("") + ".*?" + [regex]::Escape("")
+ $useDotNetNativeToolchainMatch = [regex]::Match($propertyGroupContent, $useDotNetNativeToolchainRegex)
+
+ if ($useDotNetNativeToolchainMatch.Success) {
+ # Replace the value of UseDotNetNativeToolchain with true
+ $updatedPropertyGroupContent = $propertyGroupContent -replace $useDotNetNativeToolchainRegex, "true"
+ } else {
+ # If UseDotNetNativeToolchain doesn't exist, add it
+ $updatedPropertyGroupContent = $propertyGroupContent -replace "", "true"
+ }
+
+ # Replace the original PropertyGroup with the updated one
+ $csprojContent = $csprojContent -replace [regex]::Escape($propertyGroupContent), $updatedPropertyGroupContent
+
+ # Write the updated content back to the file with UTF-8 encoding
+ Set-Content -Path $csprojPath -Value $csprojContent -Encoding UTF8
+
+ Write-Host "Updated UseDotNetNativeToolchain to true in the PropertyGroup with condition '$targetCondition'."
+} else {
+ Write-Warning "PropertyGroup with condition '$targetCondition' not found in the csproj file."
+}
\ No newline at end of file
diff --git a/src/BackgroundTasks/BackgroundTasks.csproj b/src/BackgroundTasks/BackgroundTasks.csproj
new file mode 100644
index 00000000..ecad63af
--- /dev/null
+++ b/src/BackgroundTasks/BackgroundTasks.csproj
@@ -0,0 +1,154 @@
+
+
+
+
+ latest
+ Debug
+ AnyCPU
+ {32288EDB-3F7F-479A-8303-7BB6705E0636}
+ winmdobj
+ Properties
+ BackgroundTasks
+ BackgroundTasks
+ zh-CN
+ UAP
+ 10.0.22621.0
+ 10.0.19041.0
+ 14
+ 512
+ {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ false
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE;NETFX_CORE;WINDOWS_UWP
+ prompt
+ 4
+
+
+ x86
+ true
+ bin\x86\Debug\
+ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
+ ;2008
+ full
+ false
+ prompt
+
+
+ x86
+ bin\x86\Release\
+ TRACE;NETFX_CORE;WINDOWS_UWP
+ true
+ ;2008
+ pdbonly
+ false
+ prompt
+
+
+ ARM
+ true
+ bin\ARM\Debug\
+ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
+ ;2008
+ full
+ false
+ prompt
+
+
+ ARM
+ bin\ARM\Release\
+ TRACE;NETFX_CORE;WINDOWS_UWP
+ true
+ ;2008
+ pdbonly
+ false
+ prompt
+
+
+ ARM64
+ true
+ bin\ARM64\Debug\
+ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
+ ;2008
+ full
+ false
+ prompt
+
+
+ ARM64
+ bin\ARM64\Release\
+ TRACE;NETFX_CORE;WINDOWS_UWP
+ true
+ ;2008
+ pdbonly
+ false
+ prompt
+
+
+ x64
+ true
+ bin\x64\Debug\
+ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
+ ;2008
+ full
+ false
+ prompt
+ true
+
+
+ x64
+ bin\x64\Release\
+ TRACE;NETFX_CORE;WINDOWS_UWP
+ true
+ ;2008
+ pdbonly
+ false
+ prompt
+
+
+ PackageReference
+
+
+
+
+
+
+
+ 6.2.14
+
+
+
+
+ {8b90b3b3-844b-4610-9dcf-c9b250182ae3}
+ BiliLite.UWP
+
+
+
+ 14.0
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/BackgroundTasks/Properties/AssemblyInfo.cs b/src/BackgroundTasks/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..a8a3fb81
--- /dev/null
+++ b/src/BackgroundTasks/Properties/AssemblyInfo.cs
@@ -0,0 +1,29 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("BackgroundTasks")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("BackgroundTasks")]
+[assembly: AssemblyCopyright("Copyright © 2021")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: ComVisible(false)]
\ No newline at end of file
diff --git a/src/BackgroundTasks/TileFeedBackgroundTask.cs b/src/BackgroundTasks/TileFeedBackgroundTask.cs
new file mode 100644
index 00000000..98a217a8
--- /dev/null
+++ b/src/BackgroundTasks/TileFeedBackgroundTask.cs
@@ -0,0 +1,23 @@
+using System.Diagnostics;
+using Windows.ApplicationModel.Background;
+using BiliLite.Extensions.Notifications;
+
+namespace BackgroundTasks
+{
+ public sealed class TileFeedBackgroundTask : IBackgroundTask
+ {
+ public void Run(IBackgroundTaskInstance taskInstance)
+ {
+ Debug.WriteLine("================ debug to updating tiles ================");
+
+ // Get a deferral, to prevent the task from closing prematurely
+ // while asynchronous code is still running.
+ var deferral = taskInstance.GetDeferral();
+
+ NotificationShowExtensions.Tile();
+
+ // Inform the system that the task is finished.
+ deferral.Complete();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.JSBridge/BiliLite.JSBridge.csproj b/src/BiliLite.JSBridge/BiliLite.JSBridge.csproj
index f815d6fb..c11e0309 100644
--- a/src/BiliLite.JSBridge/BiliLite.JSBridge.csproj
+++ b/src/BiliLite.JSBridge/BiliLite.JSBridge.csproj
@@ -2,6 +2,7 @@
+ latest
Debug
AnyCPU
{809C7636-0AF1-4695-9230-22F74D7B1327}
diff --git a/src/BiliLite.Packages/Package.appxmanifest b/src/BiliLite.Packages/Package.appxmanifest
index 3b9a830e..717d0de8 100644
--- a/src/BiliLite.Packages/Package.appxmanifest
+++ b/src/BiliLite.Packages/Package.appxmanifest
@@ -61,6 +61,12 @@
+
+
+
+
+
@@ -72,4 +78,14 @@
+
+
+
+ CLRHost.dll
+
+
+
+
diff --git a/src/BiliLite.UWP/App.xaml b/src/BiliLite.UWP/App.xaml
index aff62f40..6b7e7ee8 100644
--- a/src/BiliLite.UWP/App.xaml
+++ b/src/BiliLite.UWP/App.xaml
@@ -12,10 +12,11 @@
-
-
-
-
+
+
+
+
+
4
diff --git a/src/BiliLite.UWP/App.xaml.cs b/src/BiliLite.UWP/App.xaml.cs
index 187139b9..cc3a42d0 100644
--- a/src/BiliLite.UWP/App.xaml.cs
+++ b/src/BiliLite.UWP/App.xaml.cs
@@ -1,8 +1,11 @@
using BiliLite.Extensions;
+using BiliLite.Extensions.Notifications;
using BiliLite.Models.Common;
using BiliLite.Models.Events;
+using BiliLite.Pages;
using BiliLite.Services;
using FFmpegInteropX;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Toolkit.Uwp.Helpers;
using System;
@@ -14,8 +17,6 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
-using BiliLite.Pages;
-using Microsoft.Extensions.DependencyInjection;
namespace BiliLite
{
@@ -161,7 +162,6 @@ private async void Navigation(object arguments, bool prelaunch = false)
rootFrame.NavigationFailed += OnNavigationFailed;
-
//主题颜色
rootFrame.RequestedTheme = (ElementTheme)SettingService.GetValue(SettingConstants.UI.THEME, 0);
@@ -182,7 +182,8 @@ private async void Navigation(object arguments, bool prelaunch = false)
}
// 确保当前窗口处于活动状态
Window.Current.Activate();
- ExtendAcrylicIntoTitleBar();
+ var themeService = ServiceProvider.GetRequiredService();
+ themeService.InitTitleBar();
}
}
@@ -205,6 +206,7 @@ private async void InitBili()
// await Task.Delay(200); // 防止初始屏幕闪烁
}
}
+
//圆角
App.Current.Resources["ImageCornerRadius"] = new CornerRadius(SettingService.GetValue(SettingConstants.UI.IMAGE_CORNER_RADIUS, 0));
await AppHelper.SetRegions();
@@ -222,6 +224,16 @@ private async void InitBili()
}
VideoPlayHistoryHelper.LoadABPlayHistories(true);
+ try
+ {
+ var themeService = ServiceProvider.GetRequiredService();
+ themeService.Init();
+ }
+ catch (Exception ex)
+ {
+ logger.Error("初始化主题错误", ex);
+ }
+
//var pluginService = ServiceProvider.GetRequiredService();
//await pluginService.Start();
}
@@ -255,11 +267,6 @@ private void OnSuspending(object sender, SuspendingEventArgs e)
deferral.Complete();
}
- public static void ExtendAcrylicIntoTitleBar()
- {
- AppExtensions.HandleTitleTheme();
- }
-
protected override void OnActivated(IActivatedEventArgs args)
{
base.OnActivated(args);
@@ -287,5 +294,12 @@ private void RegisterService()
logger.Error("Start Host Error", ex);
}
}
+
+ protected override async void OnBackgroundActivated(BackgroundActivatedEventArgs args)
+ {
+ //base.OnBackgroundActivated(args);
+ //IBackgroundTaskInstance taskInstance = args.TaskInstance;
+ await NotificationShowExtensions.Tile();
+ }
}
}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/BiliLite.UWP.csproj b/src/BiliLite.UWP/BiliLite.UWP.csproj
index 3bc9bf1a..05028001 100644
--- a/src/BiliLite.UWP/BiliLite.UWP.csproj
+++ b/src/BiliLite.UWP/BiliLite.UWP.csproj
@@ -10,7 +10,7 @@
BiliLite
BiliLite
zh-cn
- 8.0
+ latest
UAP
10.0.19041.0
10.0.18362.0
@@ -186,6 +186,7 @@
VideoListView.xaml
+
EditPlaySpeedMenuDialog.xaml
@@ -199,6 +200,7 @@
+
@@ -262,6 +264,7 @@
+
@@ -271,6 +274,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
MarkdownViewerPage.xaml
@@ -279,8 +331,13 @@
+
+
+
+
+
@@ -788,9 +845,9 @@
-
+
-
+
@@ -799,25 +856,25 @@
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
@@ -829,7 +886,7 @@
-
+
@@ -1457,22 +1514,30 @@
Designer
MSBuild:Compile
-
+
MSBuild:Compile
Designer
-
+
MSBuild:Compile
Designer
-
+
MSBuild:Compile
Designer
-
+
MSBuild:Compile
Designer
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
@@ -1535,6 +1600,9 @@
6.1.1
+
+ 7.1.3
+
6.1.1
@@ -1611,6 +1679,7 @@
+
diff --git a/src/BiliLite.UWP/Controls/CommentControl.xaml b/src/BiliLite.UWP/Controls/CommentControl.xaml
index c6401b6e..19fa40e7 100644
--- a/src/BiliLite.UWP/Controls/CommentControl.xaml
+++ b/src/BiliLite.UWP/Controls/CommentControl.xaml
@@ -11,7 +11,7 @@
xmlns:convert="using:BiliLite.Converters" xmlns:modules="using:BiliLite.Modules"
xmlns:comment="using:BiliLite.ViewModels.Comment"
xmlns:common="using:BiliLite.Models.Common"
- xmlns:viewModels="using:BiliLite.ViewModels"
+ xmlns:viewModels="using:BiliLite.ViewModels" xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
d:DesignHeight="300"
d:DesignWidth="400"
x:Name="CommentControlContent"
@@ -49,7 +49,7 @@
-
+
@@ -59,7 +59,7 @@
-
+
@@ -388,7 +388,7 @@
-
+
@@ -462,7 +462,7 @@
-
+
加载更多
diff --git a/src/BiliLite.UWP/Controls/Dynamic/DynamicItemControl.xaml b/src/BiliLite.UWP/Controls/Dynamic/DynamicItemControl.xaml
index 26e5b54f..88642b80 100644
--- a/src/BiliLite.UWP/Controls/Dynamic/DynamicItemControl.xaml
+++ b/src/BiliLite.UWP/Controls/Dynamic/DynamicItemControl.xaml
@@ -40,7 +40,7 @@
-
+
diff --git a/src/BiliLite.UWP/Controls/PlayerControl.xaml b/src/BiliLite.UWP/Controls/PlayerControl.xaml
index b123eae1..a710dff8 100644
--- a/src/BiliLite.UWP/Controls/PlayerControl.xaml
+++ b/src/BiliLite.UWP/Controls/PlayerControl.xaml
@@ -14,6 +14,7 @@
xmlns:common="using:BiliLite.Models.Common"
xmlns:player1="using:BiliLite.Models.Common.Player"
xmlns:modules="using:BiliLite.Modules"
+ xmlns:video="using:BiliLite.Models.Common.Video" xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
d:DesignHeight="800"
d:DesignWidth="1000">
@@ -299,7 +300,7 @@
-
+
@@ -337,7 +338,7 @@
SelectedItem="{Binding Path=Select,Mode=OneWay}"
SelectionChanged="NodeList_SelectionChanged" >
-
+
@@ -605,10 +606,6 @@
繁体字幕转简体
-
@@ -633,10 +630,6 @@
-
-
-
-
@@ -701,9 +694,9 @@
-
+ Maximum="{Binding ElementName=Player,Path=Duration,Mode=OneWay}">
@@ -946,7 +939,7 @@
-
+
diff --git a/src/BiliLite.UWP/Controls/PlayerControl.xaml.cs b/src/BiliLite.UWP/Controls/PlayerControl.xaml.cs
index 1bb8e454..16558e6b 100644
--- a/src/BiliLite.UWP/Controls/PlayerControl.xaml.cs
+++ b/src/BiliLite.UWP/Controls/PlayerControl.xaml.cs
@@ -1,4 +1,4 @@
-using BiliLite.Modules;
+using BiliLite.Modules;
using NSDanmaku.Model;
using System;
using System.Collections.Generic;
@@ -54,7 +54,6 @@ public sealed partial class PlayerControl : UserControl, IDisposable
private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
private readonly bool m_useNsDanmaku = true;
private readonly IDanmakuController m_danmakuController;
- private readonly FrostMasterDanmakuController m_assSubtitleController;
private readonly VideoDanmakuSettingsControlViewModel m_danmakuSettingsControlViewModel;
private readonly PlayControlViewModel m_viewModel;
private readonly PlayerToastService m_playerToastService;
@@ -177,9 +176,6 @@ public PlayerControl()
m_danmakuController = App.ServiceProvider.GetRequiredService();
m_danmakuController.Init(DanmakuCanvas);
}
-
- m_assSubtitleController = App.ServiceProvider.GetRequiredService();
- m_assSubtitleController.Init(SubtitleCanvas);
}
private void Timer_focus_Tick(object sender, object e)
@@ -233,7 +229,6 @@ private void PlayerControl_Unloaded(object sender, RoutedEventArgs e)
private async void PlayerControl_Loaded(object sender, RoutedEventArgs e)
{
m_danmakuController.Clear();
- m_assSubtitleController.Clear();
BtnFoucs.Focus(FocusState.Programmatic);
_systemMediaTransportControls = SystemMediaTransportControls.GetForCurrentView();
_systemMediaTransportControls.IsPlayEnabled = true;
@@ -604,14 +599,6 @@ private void LoadSutitleSetting()
SettingService.SetValue(SettingConstants.Player.SUBTITLE_SIZE, SubtitleSettingSize.Value);
UpdateSubtitle();
});
- //外置字幕大小
- //OutsideSubtitleSettingSize.Value = 3;//SettingService.GetValue(SettingConstants.Player.SUBTITLE_SIZE, 40);
- //OutsideSubtitleSettingSize.ValueChanged += new RangeBaseValueChangedEventHandler((e, args) =>
- //{
- // if (miniWin) return;
- // //SettingService.SetValue(SettingConstants.Player.SUBTITLE_SIZE, SubtitleSettingSize.Value);
- // m_assSubtitleController.SetFontZoom((int)OutsideSubtitleSettingSize.Value);
- //});
//字幕描边颜色
SubtitleSettingBorderColor.SelectedIndex = SettingService.GetValue(SettingConstants.Player.SUBTITLE_BORDER_COLOR, 0);
SubtitleSettingBorderColor.SelectionChanged += new SelectionChangedEventHandler((e, args) =>
@@ -840,7 +827,6 @@ private async void DanmuTimer_Tick(object sender, object e)
return;
}
m_danmakuController.UpdateTime(position);
- m_assSubtitleController.UpdateTime(position);
var needDistinct = DanmuSettingMerge.IsOn;
var level = DanmuSettingShieldLevel.Value;
@@ -854,7 +840,6 @@ private async void DanmuTimer_Tick(object sender, object e)
if (Player.PlayState == PlayState.Pause)
{
m_danmakuController.Pause();
- m_assSubtitleController.Pause();
}
}
@@ -1024,15 +1009,6 @@ private async void SetSubTitle(string url)
{
try
{
- if (url.EndsWith(".ass"))
- {
- var content = await playerHelper.GetAssFileContent(url);
- m_assSubtitleController.SetFontZoom(1);
- m_assSubtitleController.SetAssSubtitle(content);
-
- return;
- }
-
subtitles = await playerHelper.GetSubtitle(url);
if (subtitles != null)
{
@@ -1050,9 +1026,8 @@ private async void SetSubTitle(string url)
subtitleTimer.Start();
}
}
- catch (Exception ex)
+ catch (Exception)
{
- _logger.Error(ex.Message, ex);
Notify.ShowMessageToast("加载字幕失败了");
}
@@ -1166,7 +1141,6 @@ private async Task GenerateSubtitleItem(string text)
///
private void ClearSubTitle()
{
- m_assSubtitleController.Clear();
if (subtitles != null)
{
if (subtitleTimer != null)
@@ -1614,7 +1588,7 @@ private async Task ChangeQualityPlayVideo(BiliPlayUrlInfo qual
if (quality.PlayUrlType == BiliPlayUrlType.DASH)
{
var realPlayerType = (RealPlayerType)SettingService.GetValue(SettingConstants.Player.USE_REAL_PLAYER_TYPE, (int)SettingConstants.Player.DEFAULT_USE_REAL_PLAYER_TYPE);
- if (realPlayerType==RealPlayerType.Native)
+ if (realPlayerType == RealPlayerType.Native)
{
result = await Player.PlayerDashUseNative(quality.DashInfo, quality.UserAgent, quality.Referer, positon: _postion);
@@ -1701,17 +1675,12 @@ public void FullScreen(bool fullScreen)
FullScreenEvent?.Invoke(this, fullScreen);
MessageCenter.SetFullscreen(fullScreen);
m_danmakuController.SetFullscreen(fullScreen);
- m_assSubtitleController.SetFullscreen(fullScreen);
if (fullScreen)
{
BottomBtnExitFull.Visibility = Visibility.Visible;
BottomBtnFull.Visibility = Visibility.Collapsed;
BottomBtnFullWindows.Visibility = Visibility.Collapsed;
BottomBtnExitFullWindows.Visibility = Visibility.Collapsed;
- if (SettingService.GetValue(SettingConstants.UI.DISPLAY_MODE, 0) > 0)
- {
- TopControlBar.Margin = new Thickness(0, 48, 0, 0);
- }
//全屏
if (!view.IsFullScreenMode)
@@ -2258,7 +2227,6 @@ private void BottomBtnPlay_Click(object sender, RoutedEventArgs e)
{
Player.Play();
m_danmakuController.Resume();
- m_assSubtitleController.Resume();
}
}
@@ -2320,7 +2288,6 @@ private void Player_PlayStateChanged(object sender, PlayState e)
BottomBtnPlay.Visibility = Visibility.Collapsed;
BottomBtnPause.Visibility = Visibility.Visible;
m_danmakuController.Resume();
- m_assSubtitleController.Resume();
break;
case PlayState.Pause:
KeepScreenOn(false);
@@ -2333,7 +2300,6 @@ private void Player_PlayStateChanged(object sender, PlayState e)
BottomBtnPlay.Visibility = Visibility.Visible;
BottomBtnPause.Visibility = Visibility.Collapsed;
m_danmakuController.Pause();
- m_assSubtitleController.Pause();
break;
case PlayState.End:
KeepScreenOn(false);
@@ -2367,7 +2333,6 @@ private void Player_PlayBufferStart(object sender, EventArgs e)
TxtBuffering.Text = "正在缓冲...";
BufferingProgress = 0;
m_danmakuController.Pause();
- m_assSubtitleController.Pause();
}
private void Player_PlayBuffering(object sender, double e)
@@ -2383,7 +2348,6 @@ private void Player_PlayBufferEnd(object sender, EventArgs e)
GridBuffering.Visibility = Visibility.Collapsed;
Buffering = false;
m_danmakuController.Resume();
- m_assSubtitleController.Resume();
}
private async void Player_PlayMediaEnded(object sender, EventArgs e)
@@ -2396,7 +2360,6 @@ private async void Player_PlayMediaEnded(object sender, EventArgs e)
return;
}
m_danmakuController.Pause();
- m_assSubtitleController.Pause();
InteractionChoices.Visibility = Visibility.Visible;
return;
}
@@ -2450,7 +2413,6 @@ private async void Player_PlayMediaEnded(object sender, EventArgs e)
{
ClearSubTitle();
m_danmakuController.Clear();
- m_assSubtitleController.Clear();
Player.Play();
return;
}
@@ -2467,7 +2429,6 @@ private async void Player_PlayMediaEnded(object sender, EventArgs e)
{
ClearSubTitle();
m_danmakuController.Clear();
- m_assSubtitleController.Clear();
Player.Play();
return;
}
@@ -3014,19 +2975,5 @@ private void ViewPoint_OnTapped(object sender, TappedRoutedEventArgs e)
if (!(element.DataContext is PlayerInfoViewPoint viewPoint)) return;
SetPosition(viewPoint.From);
}
-
- private async void BtnImportSubFile_OnClick(object sender, RoutedEventArgs e)
- {
- var path = await playerHelper.GetOutsideSubtitle();
-
- if (path == null) return;
-
- (BottomBtnSelctSubtitle.Flyout as MenuFlyout).Items.Add(new ToggleMenuFlyoutItem()
- {
- Tag = path,
- Name = "外置字幕"
- });
- SetSubTitle(path);
- }
}
}
diff --git a/src/BiliLite.UWP/Controls/Settings/UISettingsControl.xaml b/src/BiliLite.UWP/Controls/Settings/UISettingsControl.xaml
index 67f861e6..68daec49 100644
--- a/src/BiliLite.UWP/Controls/Settings/UISettingsControl.xaml
+++ b/src/BiliLite.UWP/Controls/Settings/UISettingsControl.xaml
@@ -200,6 +200,14 @@
+
+
+
+
+
+
+
@@ -322,16 +330,24 @@
-
-
-
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/BiliLite.UWP/Controls/Settings/UISettingsControl.xaml.cs b/src/BiliLite.UWP/Controls/Settings/UISettingsControl.xaml.cs
index fcb763cb..dd8fc806 100644
--- a/src/BiliLite.UWP/Controls/Settings/UISettingsControl.xaml.cs
+++ b/src/BiliLite.UWP/Controls/Settings/UISettingsControl.xaml.cs
@@ -7,8 +7,11 @@
using BiliLite.Models.Common;
using BiliLite.Models.Common.Home;
using BiliLite.Services;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml.Controls;
using Microsoft.Toolkit.Uwp.UI;
+using BiliLite.Extensions.Notifications;
+using Windows.ApplicationModel.Background;
//https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板
@@ -16,8 +19,11 @@ namespace BiliLite.Controls.Settings
{
public sealed partial class UISettingsControl : UserControl
{
+ private readonly ThemeService m_themeService;
+
public UISettingsControl()
{
+ m_themeService = App.ServiceProvider.GetRequiredService();
this.InitializeComponent();
LoadUI();
}
@@ -29,25 +35,10 @@ private void LoadUI()
{
cbTheme.SelectionChanged += new SelectionChangedEventHandler((obj, args) =>
{
- SettingService.SetValue(SettingConstants.UI.THEME, cbTheme.SelectedIndex);
- Frame rootFrame = Window.Current.Content as Frame;
- switch (cbTheme.SelectedIndex)
- {
- case 1:
- rootFrame.RequestedTheme = ElementTheme.Light;
- break;
- case 2:
- rootFrame.RequestedTheme = ElementTheme.Dark;
- break;
- //case 3:
- // // TODO: 切换自定义主题
- // rootFrame.Resources = Application.Current.Resources.ThemeDictionaries["Pink"] as ResourceDictionary;
- // break;
- default:
- rootFrame.RequestedTheme = ElementTheme.Default;
- break;
- }
- App.ExtendAcrylicIntoTitleBar();
+ var themeIndex = cbTheme.SelectedIndex;
+ if (themeIndex > 2)
+ m_themeService.SetTheme(ElementTheme.Default);
+ m_themeService.SetTheme((ElementTheme)themeIndex);
});
});
@@ -142,6 +133,24 @@ private void LoadUI()
};
};
+ //动态磁贴
+ SwitchTile.IsOn = SettingService.GetValue(SettingConstants.UI.ENABLE_NOTIFICATION_TILES, false);
+ SwitchTile.Loaded += (sender, e) =>
+ {
+ SwitchTile.Toggled += (obj, args) =>
+ {
+ SettingService.SetValue(SettingConstants.UI.ENABLE_NOTIFICATION_TILES, SwitchTile.IsOn);
+ if (SwitchTile.IsOn)
+ {
+ RegisterBackgroundTask();
+ }
+ else
+ {
+ // TODO: UnregisterBackgroundTask
+ }
+ };
+ };
+
//图片圆角半径
numImageCornerRadius.Value = SettingService.GetValue(SettingConstants.UI.IMAGE_CORNER_RADIUS, 0);
ImageCornerRadiusExample.CornerRadius = new CornerRadius(numImageCornerRadius.Value);
@@ -297,6 +306,36 @@ private void LoadUI()
};
};
+ // 标签最小宽度
+ NumTabItemMinWidth.Value = SettingService.GetValue(SettingConstants.UI.TAB_ITEM_MIN_WIDTH, SettingConstants.UI.DEFAULT_TAB_ITEM_MIN_WIDTH);
+ NumTabItemMinWidth.Loaded += (sender, e) =>
+ {
+ NumTabItemMinWidth.ValueChanged += (obj, args) =>
+ {
+ SettingService.SetValue(SettingConstants.UI.TAB_ITEM_MIN_WIDTH, NumTabItemMinWidth.Value);
+ };
+ };
+
+ // 标签最大宽度
+ NumTabItemMaxWidth.Value = SettingService.GetValue(SettingConstants.UI.TAB_ITEM_MAX_WIDTH, SettingConstants.UI.DEFAULT_TAB_ITEM_MAX_WIDTH);
+ NumTabItemMaxWidth.Loaded += (sender, e) =>
+ {
+ NumTabItemMaxWidth.ValueChanged += (obj, args) =>
+ {
+ SettingService.SetValue(SettingConstants.UI.TAB_ITEM_MAX_WIDTH, NumTabItemMaxWidth.Value);
+ };
+ };
+
+ // 标签高度
+ NumTabHeight.Value = SettingService.GetValue(SettingConstants.UI.TAB_HEIGHT, SettingConstants.UI.DEFAULT_TAB_HEIGHT);
+ NumTabHeight.Loaded += (sender, e) =>
+ {
+ NumTabHeight.ValueChanged += (obj, args) =>
+ {
+ SettingService.SetValue(SettingConstants.UI.TAB_HEIGHT, NumTabHeight.Value);
+ };
+ };
+
//显示视频底部进度条
SwShowVideoBottomProgress.IsOn = SettingService.GetValue(SettingConstants.UI.SHOW_VIDEO_BOTTOM_VIRTUAL_PROGRESS_BAR, SettingConstants.UI.DEFAULT_SHOW_VIDEO_BOTTOM_VIRTUAL_PROGRESS_BAR);
SwShowVideoBottomProgress.Loaded += (sender, e) =>
@@ -372,5 +411,13 @@ private void menuRemoveHomeItem_Click(object sender, RoutedEventArgs e)
ExceptHomeNavItems();
Notify.ShowMessageToast("更改成功,重启生效");
}
+
+ private void RegisterBackgroundTask()
+ {
+ NotificationRegisterExtensions.BackgroundTask("DisposableTileFeedBackgroundTask");
+ NotificationRegisterExtensions.BackgroundTask("TileFeedBackgroundTask", new TimeTrigger(15, false));
+ //NotificationRegisterExtensions.BackgroundTask("TileFeedBackgroundTask",
+ // "BackgroundTasks.TileFeedBackgroundTask", new TimeTrigger(15, false));
+ }
}
}
diff --git a/src/BiliLite.UWP/Controls/VideoListView.xaml b/src/BiliLite.UWP/Controls/VideoListView.xaml
index e7012f07..263982f8 100644
--- a/src/BiliLite.UWP/Controls/VideoListView.xaml
+++ b/src/BiliLite.UWP/Controls/VideoListView.xaml
@@ -5,7 +5,7 @@
xmlns:local="using:BiliLite.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:muxc="using:Microsoft.Toolkit.Uwp.UI.Controls"
+ xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:video="using:BiliLite.ViewModels.Video"
xmlns:video1="using:BiliLite.Models.Common.Video"
xmlns:common="using:BiliLite.Controls.Common"
@@ -33,7 +33,7 @@
ItemsSource="{x:Bind m_viewModel.Sections,Mode=OneWay}">
-
diff --git a/src/BiliLite.UWP/Converters/ColorSelectedConvert.cs b/src/BiliLite.UWP/Converters/ColorSelectedConvert.cs
index e29abf5e..59ea77bc 100644
--- a/src/BiliLite.UWP/Converters/ColorSelectedConvert.cs
+++ b/src/BiliLite.UWP/Converters/ColorSelectedConvert.cs
@@ -2,16 +2,20 @@
using Windows.UI;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
+using BiliLite.Services;
+using Microsoft.Extensions.DependencyInjection;
+
namespace BiliLite.Converters
{
public class ColorSelectedConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
- if (value == null) return new SolidColorBrush((Color)App.Current.Resources["TextColor"]);
+ var themeService = App.ServiceProvider.GetRequiredService();
+ if (value == null) return new SolidColorBrush((Color)themeService.ThemeResource["TextColor"]);
return value.ToString() == parameter.ToString()
- ? new SolidColorBrush((Color)App.Current.Resources["SystemAccentColor"])
- : new SolidColorBrush((Color)App.Current.Resources["TextColor"]);
+ ? new SolidColorBrush((Color)themeService.ThemeResource["SystemAccentColor"])
+ : new SolidColorBrush((Color)themeService.ThemeResource["TextColor"]);
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
diff --git a/src/BiliLite.UWP/Converters/InverseBooleanConverter.cs b/src/BiliLite.UWP/Converters/InverseBooleanConverter.cs
new file mode 100644
index 00000000..3a63bea4
--- /dev/null
+++ b/src/BiliLite.UWP/Converters/InverseBooleanConverter.cs
@@ -0,0 +1,12 @@
+using System;
+using Windows.UI.Xaml.Data;
+
+namespace BiliLite.Converters
+{
+ public class InverseBooleanConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, string language) => !(bool)value;
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language) => throw new NotImplementedException();
+ }
+}
diff --git a/src/BiliLite.UWP/Dialogs/CopyOrMoveFavVideoDialog.xaml.cs b/src/BiliLite.UWP/Dialogs/CopyOrMoveFavVideoDialog.xaml.cs
index 11142ba1..b5848179 100644
--- a/src/BiliLite.UWP/Dialogs/CopyOrMoveFavVideoDialog.xaml.cs
+++ b/src/BiliLite.UWP/Dialogs/CopyOrMoveFavVideoDialog.xaml.cs
@@ -1,6 +1,5 @@
using BiliLite.Models;
using BiliLite.Models.Requests.Api.User;
-using BiliLite.Modules;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -8,6 +7,7 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using BiliLite.Extensions;
+using BiliLite.Models.Common.Favorites;
using BiliLite.Models.Responses;
using BiliLite.ViewModels.User;
@@ -44,7 +44,7 @@ private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, Conten
List ids = new List();
foreach (var videoItem in selectItems)
{
- ids.Add(videoItem.id);
+ ids.Add(videoItem.Id);
}
if (isMove)
{
diff --git a/src/BiliLite.UWP/Dialogs/DownloadDialog.xaml b/src/BiliLite.UWP/Dialogs/DownloadDialog.xaml
index b9acd975..48fbc8e0 100644
--- a/src/BiliLite.UWP/Dialogs/DownloadDialog.xaml
+++ b/src/BiliLite.UWP/Dialogs/DownloadDialog.xaml
@@ -78,7 +78,7 @@
-
+
diff --git a/src/BiliLite.UWP/Dialogs/SendCommentDialog.xaml b/src/BiliLite.UWP/Dialogs/SendCommentDialog.xaml
index 897b9ef1..b4917c7e 100644
--- a/src/BiliLite.UWP/Dialogs/SendCommentDialog.xaml
+++ b/src/BiliLite.UWP/Dialogs/SendCommentDialog.xaml
@@ -26,7 +26,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
diff --git a/src/BiliLite.UWP/Dialogs/SendDynamicDialog.xaml b/src/BiliLite.UWP/Dialogs/SendDynamicDialog.xaml
index afb35b13..e3426cc5 100644
--- a/src/BiliLite.UWP/Dialogs/SendDynamicDialog.xaml
+++ b/src/BiliLite.UWP/Dialogs/SendDynamicDialog.xaml
@@ -6,7 +6,7 @@
xmlns:modules="using:BiliLite.Modules"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:viewModels="using:BiliLite.ViewModels"
+ xmlns:viewModels="using:BiliLite.ViewModels" xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
@@ -18,7 +18,7 @@
-
+
@@ -28,7 +28,7 @@
-
+
@@ -165,7 +165,7 @@
-
+
图片上传中...
diff --git a/src/BiliLite.UWP/Dialogs/SendDynamicV2Dialog.xaml b/src/BiliLite.UWP/Dialogs/SendDynamicV2Dialog.xaml
index ab138b78..5e55a486 100644
--- a/src/BiliLite.UWP/Dialogs/SendDynamicV2Dialog.xaml
+++ b/src/BiliLite.UWP/Dialogs/SendDynamicV2Dialog.xaml
@@ -6,7 +6,7 @@
xmlns:modules="using:BiliLite.Modules"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:viewModels="using:BiliLite.ViewModels"
+ xmlns:viewModels="using:BiliLite.ViewModels" xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
@@ -18,7 +18,7 @@
-
+
@@ -28,7 +28,7 @@
-
+
@@ -165,7 +165,7 @@
-
+
图片上传中...
diff --git a/src/BiliLite.UWP/Dialogs/SendReviewDialog.xaml.cs b/src/BiliLite.UWP/Dialogs/SendReviewDialog.xaml.cs
index 198d36fa..7192c3e8 100644
--- a/src/BiliLite.UWP/Dialogs/SendReviewDialog.xaml.cs
+++ b/src/BiliLite.UWP/Dialogs/SendReviewDialog.xaml.cs
@@ -1,7 +1,8 @@
using BiliLite.Extensions;
-using BiliLite.Modules.Season;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
+using BiliLite.ViewModels.Season;
+using Microsoft.Extensions.DependencyInjection;
// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“内容对话框”项模板
@@ -9,12 +10,13 @@ namespace BiliLite.Dialogs
{
public sealed partial class SendReviewDialog : ContentDialog
{
- SeasonReviewVM seasonReviewVM;
+ private readonly SeasonReviewViewModel m_viewModel;
+
public SendReviewDialog(int mediaId)
{
+ m_viewModel = App.ServiceProvider.GetRequiredService();
+ m_viewModel.MediaID = mediaId;
this.InitializeComponent();
- seasonReviewVM = new SeasonReviewVM();
- seasonReviewVM.MediaID = mediaId;
}
private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
@@ -25,7 +27,7 @@ private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, Conten
return;
}
int score = (int)rating.Value * 2;
- var result = await seasonReviewVM.SendShortReview(txtBoxContent.Text, checkShare.IsChecked.Value, score);
+ var result = await m_viewModel.SendShortReview(txtBoxContent.Text, checkShare.IsChecked.Value, score);
if (result)
{
this.Hide();
diff --git a/src/BiliLite.UWP/Extensions/MapperExtensions.cs b/src/BiliLite.UWP/Extensions/MapperExtensions.cs
index 8c7df82f..a5561384 100644
--- a/src/BiliLite.UWP/Extensions/MapperExtensions.cs
+++ b/src/BiliLite.UWP/Extensions/MapperExtensions.cs
@@ -15,7 +15,6 @@
using BiliLite.Models.Common.Season;
using BiliLite.Models.Common.Settings;
using BiliLite.Models.Common.User;
-using BiliLite.Models.Common.User.UserDetails;
using BiliLite.Models.Common.UserDynamic;
using BiliLite.Models.Common.Video;
using BiliLite.Models.Common.Video.Detail;
@@ -76,7 +75,11 @@ public static IServiceCollection AddMapper(this IServiceCollection services)
expression.CreateMap();
expression.CreateMap();
expression.CreateMap();
- expression.CreateMap();
+ expression.CreateMap();
+ expression.CreateMap();
+ expression.CreateMap();
+ expression.CreateMap();
+ expression.CreateMap();
expression.CreateMap()
.ForMember(dest => dest.Author,
opt => opt.MapFrom(src =>
diff --git a/src/BiliLite.UWP/Extensions/Notifications/NotificationRegisterExtensions.cs b/src/BiliLite.UWP/Extensions/Notifications/NotificationRegisterExtensions.cs
new file mode 100644
index 00000000..4611448b
--- /dev/null
+++ b/src/BiliLite.UWP/Extensions/Notifications/NotificationRegisterExtensions.cs
@@ -0,0 +1,99 @@
+using System;
+using Windows.ApplicationModel.Background;
+
+namespace BiliLite.Extensions.Notifications
+{
+ public class NotificationRegisterExtensions
+ {
+ ///
+ /// 单次执行后台任务
+ ///
+ ///
+ public static async void BackgroundTask(string taskName)
+ {
+ BackgroundExecutionManager.RemoveAccess();
+ var backgroundAccessStatus = await BackgroundExecutionManager.RequestAccessAsync();
+ if (backgroundAccessStatus == BackgroundAccessStatus.AllowedSubjectToSystemPolicy ||
+ backgroundAccessStatus == BackgroundAccessStatus.AlwaysAllowed)
+ {
+ foreach (var task in BackgroundTaskRegistration.AllTasks)
+ {
+ if (task.Value.Name == taskName)
+ {
+ task.Value.Unregister(true);
+ }
+ }
+
+ var taskBuilder = new BackgroundTaskBuilder()
+ {
+ Name = taskName,
+ };
+ var trigger = new ApplicationTrigger();
+ taskBuilder.SetTrigger(trigger);
+ taskBuilder.Register();
+ await trigger.RequestAsync();
+ }
+ }
+
+ ///
+ /// 注册进程内后台任务
+ ///
+ ///
+ ///
+ public static async void BackgroundTask(string taskName, IBackgroundTrigger trigger)
+ {
+ BackgroundExecutionManager.RemoveAccess();
+ var backgroundAccessStatus = await BackgroundExecutionManager.RequestAccessAsync();
+ if (backgroundAccessStatus == BackgroundAccessStatus.AllowedSubjectToSystemPolicy ||
+ backgroundAccessStatus == BackgroundAccessStatus.AlwaysAllowed)
+ {
+ foreach (var task in BackgroundTaskRegistration.AllTasks)
+ {
+ if (task.Value.Name == taskName)
+ {
+ task.Value.Unregister(true);
+ }
+ }
+
+ var taskBuilder = new BackgroundTaskBuilder()
+ {
+ Name = taskName,
+ };
+ taskBuilder.SetTrigger(trigger);
+ taskBuilder.Register();
+ }
+ }
+
+ ///
+ /// (不可用)注册进程外后台任务
+ ///
+ ///
+ ///
+ ///
+ public static async void BackgroundTask(string taskName, string taskEntryPoint, IBackgroundTrigger trigger)
+ {
+ BackgroundExecutionManager.RemoveAccess();
+ var backgroundAccessStatus = await BackgroundExecutionManager.RequestAccessAsync();
+ if (backgroundAccessStatus == BackgroundAccessStatus.AllowedSubjectToSystemPolicy ||
+ backgroundAccessStatus == BackgroundAccessStatus.AlwaysAllowed)
+ {
+ foreach (var task in BackgroundTaskRegistration.AllTasks)
+ {
+ if (task.Value.Name == taskName)
+ {
+ task.Value.Unregister(true);
+ }
+ }
+
+
+ var taskBuilder = new BackgroundTaskBuilder()
+ {
+ Name = taskName,
+ TaskEntryPoint = taskEntryPoint
+ };
+ taskBuilder.SetTrigger(trigger);
+ taskBuilder.Register();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Extensions/Notifications/NotificationShowExtensions.cs b/src/BiliLite.UWP/Extensions/Notifications/NotificationShowExtensions.cs
new file mode 100644
index 00000000..d42a988a
--- /dev/null
+++ b/src/BiliLite.UWP/Extensions/Notifications/NotificationShowExtensions.cs
@@ -0,0 +1,47 @@
+using System.Threading.Tasks;
+using Windows.UI.Notifications;
+using BiliLite.Models.Common.Notifications.Template;
+using BiliLite.Services.Notification;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace BiliLite.Extensions.Notifications
+{
+ public class NotificationShowExtensions
+ {
+ public static async Task Tile()
+ {
+ // Create a tile update manager for the specified syndication feed.
+ var updater = TileUpdateManager.CreateTileUpdaterForApplication();
+ updater.Clear();
+ updater.EnableNotificationQueue(true);
+
+ var liveTileHelper = App.ServiceProvider.GetRequiredService();
+
+ await liveTileHelper.RefreshTile();
+ foreach (var tile in liveTileHelper.TileFurnace)
+ {
+ var content = TileTemplate.LiveTile(tile);
+ var notification = new TileNotification(content.GetXml())
+ {
+ Tag = tile.Name,
+ };
+ updater.Update(notification);
+ }
+ }
+
+ public static void Dialog()
+ {
+
+ }
+
+ public static void MessageDialog()
+ {
+
+ }
+
+ public static void Toast()
+ {
+
+ }
+ }
+}
diff --git a/src/BiliLite.UWP/Extensions/ViewModelExtensions.cs b/src/BiliLite.UWP/Extensions/ViewModelExtensions.cs
index 9447e40c..b17762ef 100644
--- a/src/BiliLite.UWP/Extensions/ViewModelExtensions.cs
+++ b/src/BiliLite.UWP/Extensions/ViewModelExtensions.cs
@@ -1,4 +1,6 @@
-using BiliLite.ViewModels;
+using System.Linq;
+using BiliLite.Models.Attributes;
+using BiliLite.ViewModels;
using BiliLite.ViewModels.Comment;
using BiliLite.ViewModels.Common;
using BiliLite.ViewModels.Download;
@@ -12,6 +14,7 @@
using BiliLite.ViewModels.UserDynamic;
using BiliLite.ViewModels.Video;
using Microsoft.Extensions.DependencyInjection;
+using System.Reflection;
namespace BiliLite.Extensions
{
@@ -55,7 +58,28 @@ public static IServiceCollection AddViewModels(this IServiceCollection services)
services.AddTransient();
services.AddTransient();
services.AddTransient();
+
+ services.AddAttributeViewModel();
+
return services;
}
+
+ private static void AddAttributeViewModel(this IServiceCollection services)
+ {
+ var types = Assembly.GetExecutingAssembly().GetTypes();
+
+ foreach (var type in types)
+ {
+ if (type.GetCustomAttributes(typeof(RegisterSingletonViewModelAttribute), false).Any())
+ {
+ services.AddSingleton(type);
+ }
+
+ if (type.GetCustomAttributes(typeof(RegisterTransientViewModelAttribute), false).Any())
+ {
+ services.AddTransient(type);
+ }
+ }
+ }
}
}
diff --git a/src/BiliLite.UWP/MainPage.xaml b/src/BiliLite.UWP/MainPage.xaml
index 01fb1013..4876fd6c 100644
--- a/src/BiliLite.UWP/MainPage.xaml
+++ b/src/BiliLite.UWP/MainPage.xaml
@@ -25,7 +25,6 @@
PreviewKeyDown="TabView_OnPreviewKeyDown"
TabCloseRequested="TabView_TabCloseRequested"
TabItemsChanged="tabView_TabItemsChanged"
- LayoutUpdated="TabView_OnLayoutUpdated"
TabWidthMode="SizeToContent">
diff --git a/src/BiliLite.UWP/MainPage.xaml.cs b/src/BiliLite.UWP/MainPage.xaml.cs
index ec5ae0ce..af0ccc58 100644
--- a/src/BiliLite.UWP/MainPage.xaml.cs
+++ b/src/BiliLite.UWP/MainPage.xaml.cs
@@ -1,4 +1,10 @@
-using BiliLite.Pages;
+using BiliLite.Controls;
+using BiliLite.Extensions;
+using BiliLite.Models.Common;
+using BiliLite.Pages;
+using BiliLite.Services;
+using BiliLite.ViewModels.Common;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml.Controls;
using System;
using System.Linq;
@@ -9,12 +15,6 @@
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Navigation;
-using BiliLite.Controls;
-using BiliLite.Models.Common;
-using BiliLite.Extensions;
-using BiliLite.Services;
-using BiliLite.ViewModels.Common;
-using Microsoft.Extensions.DependencyInjection;
// https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x804 上介绍了“空白页”项模板
@@ -265,6 +265,9 @@ private void ClosePage(TabViewItem tabItem)
}
private void tabView_Loaded(object sender, RoutedEventArgs e)
{
+ // 根据Tab高度设置图片视图边距
+ gridViewer.Margin = new Thickness(0, m_viewModel.TabHeight, 0, 0);
+
var frame = new MyFrame();
frame.Navigate(typeof(HomePage));
@@ -325,17 +328,19 @@ private void InitTabViewStyle()
var styleKvp = dict.FirstOrDefault(x => x.Key.ToString().Contains("TabViewItem"));
- if (!(styleKvp.Value is Style style)) return;
- style.Setters.Add(new Setter(TabViewItem.MinWidthProperty, m_viewModel.TabItemMinWidth));
- style.Setters.Add(new Setter(TabViewItem.MaxWidthProperty, m_viewModel.TabItemMaxWidth));
- }
+ if (styleKvp.Value is Style style)
+ {
+ style.Setters.Add(new Setter(TabViewItem.MinWidthProperty, m_viewModel.TabItemMinWidth));
+ style.Setters.Add(new Setter(TabViewItem.MaxWidthProperty, m_viewModel.TabItemMaxWidth));
+ style.Setters.Add(new Setter(TabViewItem.HeightProperty, m_viewModel.TabHeight));
+ }
- private void TabView_OnLayoutUpdated(object sender, object e)
- {
- // TODO: LayoutUpdated调用频繁,后续更换其他事件
- var tabList = tabView.FindFirstChildByType();
- if (tabList == null) return;
- tabList.MaxWidth = tabView.ActualWidth - 175;
+ var tabStyleKvp = dict.FirstOrDefault(x => x.Key.ToString().Contains("TabViewListView"));
+
+ if (tabStyleKvp.Value is Style tabStyle)
+ {
+ tabStyle.Setters.Add(new Setter(TabViewItem.HeightProperty, m_viewModel.TabHeight));
+ }
}
}
}
diff --git a/src/BiliLite.UWP/Models/Attributes/RegisterServiceAttributes.cs b/src/BiliLite.UWP/Models/Attributes/RegisterServiceAttributes.cs
new file mode 100644
index 00000000..be7ebf04
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Attributes/RegisterServiceAttributes.cs
@@ -0,0 +1,28 @@
+using System;
+
+namespace BiliLite.Models.Attributes
+{
+ [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
+ public class RegisterSingletonServiceAttribute : Attribute
+ {
+
+ }
+
+ [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
+ public class RegisterTransientServiceAttribute : Attribute
+ {
+
+ }
+
+ [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
+ public class RegisterSingletonViewModelAttribute : Attribute
+ {
+
+ }
+
+ [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
+ public class RegisterTransientViewModelAttribute : Attribute
+ {
+
+ }
+}
diff --git a/src/BiliLite.UWP/Models/Common/Anime/AnimeTimelineItemModel.cs b/src/BiliLite.UWP/Models/Common/Anime/AnimeTimelineItemModel.cs
new file mode 100644
index 00000000..5e529b6f
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Anime/AnimeTimelineItemModel.cs
@@ -0,0 +1,22 @@
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Anime;
+
+public class AnimeTimelineItemModel : ISeasonItem
+{
+ [JsonProperty("season_id")]
+ public int SeasonId { get; set; }
+
+ public string Cover { get; set; }
+
+ [JsonProperty("square_cover")]
+ public string SquareCover { get; set; }
+
+ [JsonProperty("pub_index")]
+ public string PubIndex { get; set; }
+
+ [JsonProperty("pub_time")]
+ public string PubTime { get; set; }
+
+ public string Title { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Anime/AnimeTimelineModel.cs b/src/BiliLite.UWP/Models/Common/Anime/AnimeTimelineModel.cs
new file mode 100644
index 00000000..0a38117c
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Anime/AnimeTimelineModel.cs
@@ -0,0 +1,19 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Anime;
+
+public class AnimeTimelineModel
+{
+ public string Week { get; set; }
+
+ [JsonProperty("day_week")]
+ public int DayWeek { get; set; }
+
+ public string Date { get; set; }
+
+ [JsonProperty("is_today")]
+ public bool IsToday { get; set; }
+
+ public List Seasons { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Anime/AnimeTypeItem.cs b/src/BiliLite.UWP/Models/Common/Anime/AnimeTypeItem.cs
new file mode 100644
index 00000000..bac2153a
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Anime/AnimeTypeItem.cs
@@ -0,0 +1,8 @@
+namespace BiliLite.Models.Common.Anime;
+
+public class AnimeTypeItem
+{
+ public string Name { get; set; }
+
+ public AnimeType AnimeType { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/ComboBoxItemData.cs b/src/BiliLite.UWP/Models/Common/ComboBoxItemData.cs
index 3e5b070a..d2138704 100644
--- a/src/BiliLite.UWP/Models/Common/ComboBoxItemData.cs
+++ b/src/BiliLite.UWP/Models/Common/ComboBoxItemData.cs
@@ -6,4 +6,11 @@ public class ComboBoxItemData
public int Value { get; set; }
}
+
+ public class ComboBoxItemData
+ {
+ public string Text { get; set; }
+
+ public T Value { get; set; }
+ }
}
diff --git a/src/BiliLite.UWP/Models/Common/Enumerates.cs b/src/BiliLite.UWP/Models/Common/Enumerates.cs
index 3030c7f0..46011dc6 100644
--- a/src/BiliLite.UWP/Models/Common/Enumerates.cs
+++ b/src/BiliLite.UWP/Models/Common/Enumerates.cs
@@ -561,4 +561,23 @@ public enum SearchType
///
Topic = 7
}
+
+ public enum IndexSeasonType
+ {
+ Anime = 1,
+ Movie = 2,
+ Documentary = 3,
+ Guochuang = 4,
+ TV = 5,
+ Variety = 7
+ }
+
+ public enum DownloadedSortMode
+ {
+ Default,
+ TimeDesc,
+ TimeAsc,
+ TitleDesc,
+ TitleAsc,
+ }
}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Favorites/FavoriteDetailModel.cs b/src/BiliLite.UWP/Models/Common/Favorites/FavoriteDetailModel.cs
new file mode 100644
index 00000000..a45d0d2f
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Favorites/FavoriteDetailModel.cs
@@ -0,0 +1,11 @@
+using System.Collections.Generic;
+using BiliLite.Modules;
+
+namespace BiliLite.Models.Common.Favorites;
+
+public class FavoriteDetailModel
+{
+ public FavoriteInfoModel Info { get; set; }
+
+ public List Medias { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Favorites/FavoriteInfoModel.cs b/src/BiliLite.UWP/Models/Common/Favorites/FavoriteInfoModel.cs
new file mode 100644
index 00000000..41560755
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Favorites/FavoriteInfoModel.cs
@@ -0,0 +1,32 @@
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Favorites;
+
+public class FavoriteInfoModel
+{
+ public string Cover { get; set; }
+
+ public int Attr { get; set; }
+
+ public bool Privacy => Attr == 2;
+
+ public string Fid { get; set; }
+
+ public string Id { get; set; }
+
+ [JsonProperty("like_state")]
+ public int LikeState { get; set; }
+
+ [JsonProperty("fav_state")]
+ public int FavState { get; set; }
+
+ public string Mid { get; set; }
+
+ public string Title { get; set; }
+ public int Type { get; set; }
+
+ [JsonProperty("media_count")]
+ public int MediaCount { get; set; }
+
+ public FavoriteInfoVideoItemUpperModel Upper { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Favorites/FavoriteInfoVideoItemModel.cs b/src/BiliLite.UWP/Models/Common/Favorites/FavoriteInfoVideoItemModel.cs
new file mode 100644
index 00000000..74848d7f
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Favorites/FavoriteInfoVideoItemModel.cs
@@ -0,0 +1,17 @@
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Favorites;
+
+public class FavoriteInfoVideoItemModel
+{
+ public string Id { get; set; }
+
+ public string Cover { get; set; }
+
+ public string Title { get; set; }
+
+ public FavoriteInfoVideoItemUpperModel Upper { get; set; }
+
+ [JsonProperty("cnt_info")]
+ public FavoriteInfoVideoItemStatModel CntInfo { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Favorites/FavoriteInfoVideoItemStatModel.cs b/src/BiliLite.UWP/Models/Common/Favorites/FavoriteInfoVideoItemStatModel.cs
new file mode 100644
index 00000000..c9853d2b
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Favorites/FavoriteInfoVideoItemStatModel.cs
@@ -0,0 +1,16 @@
+namespace BiliLite.Models.Common.Favorites;
+
+public class FavoriteInfoVideoItemStatModel
+{
+ public int Coin { get; set; }
+
+ public int Collect { get; set; }
+
+ public int Danmaku { get; set; }
+
+ public int Play { get; set; }
+
+ public int Reply { get; set; }
+
+ public int Share { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Favorites/FavoriteInfoVideoItemUpperModel.cs b/src/BiliLite.UWP/Models/Common/Favorites/FavoriteInfoVideoItemUpperModel.cs
new file mode 100644
index 00000000..964a214e
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Favorites/FavoriteInfoVideoItemUpperModel.cs
@@ -0,0 +1,10 @@
+namespace BiliLite.Models.Common.Favorites;
+
+public class FavoriteInfoVideoItemUpperModel
+{
+ public string Face { get; set; }
+
+ public string Name { get; set; }
+
+ public string Mid { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/CinemaHomeBannerModel.cs b/src/BiliLite.UWP/Models/Common/Home/CinemaHomeBannerModel.cs
new file mode 100644
index 00000000..08693151
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/CinemaHomeBannerModel.cs
@@ -0,0 +1,11 @@
+namespace BiliLite.Models.Common.Home
+{
+ public class CinemaHomeBannerModel
+ {
+ public string Title { get; set; }
+
+ public string Img { get; set; }
+
+ public string Url { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/CinemaHomeFallItemModel.cs b/src/BiliLite.UWP/Models/Common/Home/CinemaHomeFallItemModel.cs
new file mode 100644
index 00000000..2fefc331
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/CinemaHomeFallItemModel.cs
@@ -0,0 +1,17 @@
+namespace BiliLite.Models.Common.Home
+{
+ public class CinemaHomeFallItemModel
+ {
+ public string Cover { get; set; }
+
+ public string Desc { get; set; }
+
+ public string Title { get; set; }
+
+ public string Link { get; set; }
+
+ public long Cursor { get; set; }
+
+ public int Wid { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/CinemaHomeFallModel.cs b/src/BiliLite.UWP/Models/Common/Home/CinemaHomeFallModel.cs
new file mode 100644
index 00000000..f4121687
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/CinemaHomeFallModel.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+
+namespace BiliLite.Models.Common.Home
+{
+ public class CinemaHomeFallModel
+ {
+ public int Wid { get; set; }
+
+ public string Title { get; set; }
+
+ public bool ShowMore { get; set; } = true;
+
+ public List Items { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/CinemaHomeHotItem.cs b/src/BiliLite.UWP/Models/Common/Home/CinemaHomeHotItem.cs
new file mode 100644
index 00000000..53ce4a3a
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/CinemaHomeHotItem.cs
@@ -0,0 +1,37 @@
+using BiliLite.Models.Common.Anime;
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Home
+{
+ public class CinemaHomeHotItem : ISeasonItem
+ {
+ public string Hat { get; set; }
+
+ public string Cover { get; set; }
+
+ public string Badge { get; set; }
+
+ [JsonProperty("badge_type")]
+ public int BadgeType { get; set; }
+
+ public bool ShowBadge => !string.IsNullOrEmpty(Badge);
+
+ public string Desc { get; set; }
+
+ public string Title { get; set; }
+
+ public string Link { get; set; }
+
+ [JsonProperty("season_id")]
+ public int SeasonId { get; set; }
+
+ [JsonProperty("season_type")]
+ public int SeasonType { get; set; }
+
+ public string Type { get; set; }
+
+ public int Wid { get; set; }
+
+ public CinemaHomeStatModel Stat { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/CinemaHomeModel.cs b/src/BiliLite.UWP/Models/Common/Home/CinemaHomeModel.cs
new file mode 100644
index 00000000..c53e9132
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/CinemaHomeModel.cs
@@ -0,0 +1,33 @@
+using System.Collections.Generic;
+
+namespace BiliLite.Models.Common.Home
+{
+ public class CinemaHomeModel
+ {
+ public List Banners { get; set; }
+
+ public List Falls { get; set; }
+
+ public List Update { get; set; }
+
+ ///
+ /// 记录片 87
+ ///
+ public List Documentary { get; set; }
+
+ ///
+ /// 电影 88
+ ///
+ public List Movie { get; set; }
+
+ ///
+ /// 电视剧 89
+ ///
+ public List Tv { get; set; }
+
+ ///
+ /// 综艺 173
+ ///
+ public List Variety { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/CinemaHomeStatModel.cs b/src/BiliLite.UWP/Models/Common/Home/CinemaHomeStatModel.cs
new file mode 100644
index 00000000..921b4b8f
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/CinemaHomeStatModel.cs
@@ -0,0 +1,16 @@
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Home
+{
+ public class CinemaHomeStatModel
+ {
+ public long View { get; set; }
+
+ [JsonProperty("follow_view")]
+ public string FollowView { get; set; }
+
+ public long Follow { get; set; }
+
+ public long Danmaku { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/HotDataItemModel.cs b/src/BiliLite.UWP/Models/Common/Home/HotDataItemModel.cs
new file mode 100644
index 00000000..571f3a2b
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/HotDataItemModel.cs
@@ -0,0 +1,56 @@
+using BiliLite.Models.Common.Recommend;
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Home
+{
+ public class HotDataItemModel
+ {
+ [JsonProperty("card_type")]
+ public string CardType { get; set; }
+
+ [JsonProperty("card_goto")]
+ public string CardGoto { get; set; }
+
+ public string Param { get; set; }
+
+ public string Cover { get; set; }
+
+ public string Title { get; set; }
+
+ public string Idx { get; set; }
+
+ public string Uri { get; set; }
+
+ [JsonProperty("cover_right_text_1")]
+ public string CoverRightText1 { get; set; }
+
+ [JsonProperty("right_desc_1")]
+ public string RightDesc1 { get; set; }
+
+ [JsonProperty("right_desc_2")]
+ public string RightDesc2 { get; set; }
+
+ [JsonProperty("cover_left_text_1")]
+ public string CoverLeftText1 { get; set; }
+
+ [JsonProperty("cover_left_text_2")]
+ public string CoverLeftText2 { get; set; }
+
+ [JsonProperty("cover_left_text_3")]
+ public string CoverLeftText3 { get; set; }
+
+ public string TextInfo1 => string.IsNullOrEmpty(CoverRightText1) ? CoverLeftText1 : CoverRightText1;
+
+ public string TextInfo2 => string.IsNullOrEmpty(RightDesc1) ? CoverLeftText2 : RightDesc1;
+
+ public string TextInfo3 => string.IsNullOrEmpty(RightDesc2) ? CoverLeftText3 : RightDesc2;
+
+ [JsonProperty("rcmd_reason_style")]
+ public RecommendRcmdReasonStyleModel RcmdReasonStyle { get; set; }
+
+ [JsonProperty("top_rcmd_reason_style")]
+ public RecommendRcmdReasonStyleModel TopRcmdReasonStyle { get; set; }
+
+ public RecommendRcmdReasonStyleModel RcmdReason => RcmdReasonStyle ?? TopRcmdReasonStyle;
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/HotTopItemModel.cs b/src/BiliLite.UWP/Models/Common/Home/HotTopItemModel.cs
new file mode 100644
index 00000000..7cc8a7d1
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/HotTopItemModel.cs
@@ -0,0 +1,19 @@
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Home
+{
+ public class HotTopItemModel
+ {
+ [JsonProperty("entrance_id")]
+ public int EntranceId { get; set; }
+
+ public string Icon { get; set; }
+
+ [JsonProperty("module_id")]
+ public string ModuleId { get; set; }
+
+ public string Uri { get; set; }
+
+ public string Title { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/LiveHomeAreaModel.cs b/src/BiliLite.UWP/Models/Common/Home/LiveHomeAreaModel.cs
new file mode 100644
index 00000000..67ae5e5c
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/LiveHomeAreaModel.cs
@@ -0,0 +1,24 @@
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Home
+{
+ public class LiveHomeAreaModel
+ {
+ public int Id { get; set; }
+
+ [JsonProperty("area_v2_id")]
+ public int AreaV2Id { get; set; }
+
+ [JsonProperty("area_v2_parent_id")]
+ public int AreaV2ParentId { get; set; }
+
+ [JsonProperty("tag_type")]
+ public int TagType { get; set; }
+
+ public string Title { get; set; }
+
+ public string Pic { get; set; }
+
+ public string Link { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/LiveHomeBannerModel.cs b/src/BiliLite.UWP/Models/Common/Home/LiveHomeBannerModel.cs
new file mode 100644
index 00000000..b3fdde90
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/LiveHomeBannerModel.cs
@@ -0,0 +1,13 @@
+namespace BiliLite.Models.Common.Home
+{
+ public class LiveHomeBannerModel
+ {
+ public int Id { get; set; }
+
+ public string Link { get; set; }
+
+ public string Pic { get; set; }
+
+ public string Title { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/LiveHomeItemsItemModel.cs b/src/BiliLite.UWP/Models/Common/Home/LiveHomeItemsItemModel.cs
new file mode 100644
index 00000000..72b84f83
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/LiveHomeItemsItemModel.cs
@@ -0,0 +1,42 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+namespace BiliLite.Models.Common.Home
+{
+ public class LiveHomeItemsItemModel
+ {
+ [JsonProperty("area_v2_id")]
+ public int AreaV2Id { get; set; }
+
+ [JsonProperty("area_v2_parent_id")]
+ public int AreaV2ParentId { get; set; }
+
+ [JsonProperty("area_v2_name")]
+ public string AreaV2Name { get; set; }
+
+ [JsonProperty("area_v2_parent_name")]
+ public string AreaV2ParentName { get; set; }
+
+ public string Title { get; set; }
+
+ public string Cover { get; set; }
+
+ public int Online { get; set; }
+
+ public string Roomid { get; set; }
+
+ public string Uname { get; set; }
+
+ public string Face { get; set; }
+
+ public string Uid { get; set; }
+
+ [JsonProperty("pendant_Info")]
+ public JObject PendantInfo { get; set; }
+
+ public LivePendentItemModel Pendent =>
+ PendantInfo.ContainsKey("2") ? JsonConvert.DeserializeObject(PendantInfo["2"].ToString()) : null;
+
+ public bool ShowPendent => Pendent != null;
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/LiveHomeItemsModel.cs b/src/BiliLite.UWP/Models/Common/Home/LiveHomeItemsModel.cs
new file mode 100644
index 00000000..5f9676ee
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/LiveHomeItemsModel.cs
@@ -0,0 +1,13 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Home
+{
+ public class LiveHomeItemsModel
+ {
+ [JsonProperty("module_info")]
+ public LiveHomeItemsModuleInfoModel ModuleInfo { get; set; }
+
+ public List List { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/LiveHomeItemsModuleInfoModel.cs b/src/BiliLite.UWP/Models/Common/Home/LiveHomeItemsModuleInfoModel.cs
new file mode 100644
index 00000000..83af3aa8
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/LiveHomeItemsModuleInfoModel.cs
@@ -0,0 +1,17 @@
+namespace BiliLite.Models.Common.Home
+{
+ public class LiveHomeItemsModuleInfoModel
+ {
+ public int Id { get; set; }
+
+ public string Link { get; set; }
+
+ public string Pic { get; set; }
+
+ public string Title { get; set; }
+
+ public int Type { get; set; }
+
+ public int Sort { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/LivePendentItemModel.cs b/src/BiliLite.UWP/Models/Common/Home/LivePendentItemModel.cs
new file mode 100644
index 00000000..c22c8e94
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/LivePendentItemModel.cs
@@ -0,0 +1,20 @@
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Home
+{
+ public class LivePendentItemModel
+ {
+ [JsonProperty("bg_pic")]
+ public string BgPic { get; set; }
+
+ [JsonProperty("bg_color")]
+ public string BgColor { get; set; }
+
+ public string Text { get; set; }
+
+ public string Name { get; set; }
+
+ [JsonProperty("type")]
+ public string Type { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/RegionChildrenItem.cs b/src/BiliLite.UWP/Models/Common/Home/RegionChildrenItem.cs
new file mode 100644
index 00000000..05384f2d
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/RegionChildrenItem.cs
@@ -0,0 +1,22 @@
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Home
+{
+ public class RegionChildrenItem
+ {
+ public int Tid { get; set; }
+
+ public int Reid { get; set; }
+
+ public string Name { get; set; }
+
+ public string Logo { get; set; }
+
+ public int Type { get; set; }
+
+ [JsonProperty("_goto")]
+ public string Goto { get; set; }
+
+ public string Param { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Home/RegionItem.cs b/src/BiliLite.UWP/Models/Common/Home/RegionItem.cs
new file mode 100644
index 00000000..f315274b
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Home/RegionItem.cs
@@ -0,0 +1,28 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Home
+{
+ public class RegionItem
+ {
+ public int Tid { get; set; }
+
+ public int Reid { get; set; }
+
+ public string Name { get; set; }
+
+ public string Logo { get; set; }
+
+ public string Uri { get; set; }
+
+ public int Type { get; set; }
+
+ [JsonProperty("is_bangumi")]
+ public int IsBangumi { get; set; }
+
+ [JsonProperty("_goto")]
+ public string Goto { get; set; }
+
+ public List Children { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Live/LiveMessageHandleActionsMap.cs b/src/BiliLite.UWP/Models/Common/Live/LiveMessageHandleActionsMap.cs
index e5ae4779..35c85b28 100644
--- a/src/BiliLite.UWP/Models/Common/Live/LiveMessageHandleActionsMap.cs
+++ b/src/BiliLite.UWP/Models/Common/Live/LiveMessageHandleActionsMap.cs
@@ -91,7 +91,7 @@ private void Danmu(LiveRoomViewModel viewModel, object message)
}
}
- if (viewModel.Messages.Count >= viewModel.CleanCount) viewModel.Messages.RemoveAt(0);
+ viewModel.CheckClearMessages();
viewModel.Messages.Add(m);
AddNewDanmu?.Invoke(null, m);
}
@@ -137,6 +137,7 @@ private void InteractWord(LiveRoomViewModel viewModel, object message)
msg.ShowMedal = info.ShowMedal;
}
+ viewModel.CheckClearMessages();
viewModel.Messages.Add(msg);
}
diff --git a/src/BiliLite.UWP/Models/Common/Notifications/NotificationTile.cs b/src/BiliLite.UWP/Models/Common/Notifications/NotificationTile.cs
new file mode 100644
index 00000000..d41f1401
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Notifications/NotificationTile.cs
@@ -0,0 +1,11 @@
+namespace BiliLite.Models.Common.Notifications
+{
+ public class NotificationTile
+ {
+ public string Name { get; set; }
+
+ public string Description { get; set; }
+
+ public string Url { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Notifications/Template/TileTemplate.cs b/src/BiliLite.UWP/Models/Common/Notifications/Template/TileTemplate.cs
new file mode 100644
index 00000000..0e6701c3
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Notifications/Template/TileTemplate.cs
@@ -0,0 +1,94 @@
+using Microsoft.Toolkit.Uwp.Notifications;
+
+namespace BiliLite.Models.Common.Notifications.Template
+{
+ public class TileTemplate
+ {
+ public static TileContent LiveTile(NotificationTile notificationTile) => new TileContent()
+ {
+ // 创建静态磁贴对象并返回
+ Visual = new TileVisual()
+ {
+ Branding = TileBranding.NameAndLogo,
+ TileMedium = new TileBinding()
+ {
+ Content = new TileBindingContentAdaptive()
+ {
+ Children =
+ {
+ new AdaptiveText()
+ {
+ Text = notificationTile.Description,
+ HintMaxLines = 3,
+ HintWrap = true,
+ },
+ new AdaptiveText()
+ {
+ Text = notificationTile.Name,
+ HintStyle = AdaptiveTextStyle.CaptionSubtle,
+ HintAlign = AdaptiveTextAlign.Center,
+ },
+ },
+ PeekImage = new TilePeekImage()
+ {
+ Source = notificationTile.Url,
+ HintOverlay = 30,
+ },
+ }
+ },
+ TileWide = new TileBinding()
+ {
+ Content = new TileBindingContentAdaptive()
+ {
+ Children =
+ {
+ new AdaptiveText()
+ {
+ Text = notificationTile.Description,
+ HintStyle = AdaptiveTextStyle.Body,
+ HintMaxLines = 2,
+ HintWrap = true,
+ },
+ new AdaptiveText()
+ {
+ Text = notificationTile.Name,
+ HintAlign = AdaptiveTextAlign.Center,
+ },
+ },
+ BackgroundImage = new TileBackgroundImage()
+ {
+ Source = notificationTile.Url,
+ },
+ }
+ },
+ TileLarge = new TileBinding()
+ {
+ Content = new TileBindingContentAdaptive()
+ {
+ Children =
+ {
+ new AdaptiveText()
+ {
+ Text = notificationTile.Description,
+ HintStyle = AdaptiveTextStyle.Subtitle,
+ HintMaxLines = 5,
+ HintWrap = true,
+ },
+ new AdaptiveText() {},
+ new AdaptiveText()
+ {
+ Text = notificationTile.Name,
+ HintStyle = AdaptiveTextStyle.Base,
+ HintAlign = AdaptiveTextAlign.Center,
+ },
+ },
+ BackgroundImage = new TileBackgroundImage()
+ {
+ Source = notificationTile.Url,
+ },
+ }
+ }
+ }
+ };
+ }
+}
diff --git a/src/BiliLite.UWP/Models/Common/Other/FindMoreEntranceModel.cs b/src/BiliLite.UWP/Models/Common/Other/FindMoreEntranceModel.cs
new file mode 100644
index 00000000..58601629
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Other/FindMoreEntranceModel.cs
@@ -0,0 +1,14 @@
+namespace BiliLite.Models.Common.Other;
+
+public class FindMoreEntranceModel
+{
+ public string Name { get; set; }
+
+ public string Desc { get; set; }
+
+ public int Type { get; set; }
+
+ public string Link { get; set; }
+
+ public string Pic { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Region/RegionChildOrderModel.cs b/src/BiliLite.UWP/Models/Common/Region/RegionChildOrderModel.cs
new file mode 100644
index 00000000..3fb80164
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Region/RegionChildOrderModel.cs
@@ -0,0 +1,15 @@
+namespace BiliLite.Models.Common.Region
+{
+ public class RegionChildOrderModel
+ {
+ public RegionChildOrderModel(string name, string order)
+ {
+ this.Name = name;
+ this.Order = order;
+ }
+
+ public string Name { get; set; }
+
+ public string Order { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Region/RegionHomeBannerItemModel.cs b/src/BiliLite.UWP/Models/Common/Region/RegionHomeBannerItemModel.cs
new file mode 100644
index 00000000..0605777d
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Region/RegionHomeBannerItemModel.cs
@@ -0,0 +1,13 @@
+namespace BiliLite.Models.Common.Region
+{
+ public class RegionHomeBannerItemModel
+ {
+ public int Id { get; set; }
+
+ public string Title { get; set; }
+
+ public string Image { get; set; }
+
+ public string Uri { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Region/RegionTagItemModel.cs b/src/BiliLite.UWP/Models/Common/Region/RegionTagItemModel.cs
new file mode 100644
index 00000000..0e1e5b25
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Region/RegionTagItemModel.cs
@@ -0,0 +1,17 @@
+namespace BiliLite.Models.Common.Region
+{
+ public class RegionTagItemModel
+ {
+ public int Tid { get; set; }
+
+ public int Rid { get; set; }
+
+ public int Reid { get; set; }
+
+ public string Tname { get; set; }
+
+ public string Rname { get; set; }
+
+ public string Rename { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Region/RegionVideoItemModel.cs b/src/BiliLite.UWP/Models/Common/Region/RegionVideoItemModel.cs
new file mode 100644
index 00000000..5779e88b
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Region/RegionVideoItemModel.cs
@@ -0,0 +1,25 @@
+namespace BiliLite.Models.Common.Region
+{
+ public class RegionVideoItemModel
+ {
+ public int Id { get; set; }
+
+ public string Title { get; set; }
+
+ public string Cover { get; set; }
+
+ public string Param { get; set; }
+
+ public string Name { get; set; }
+
+ public int Play { get; set; }
+
+ public int Danmaku { get; set; }
+
+ public string Rname { get; set; }
+
+ public int Duration { get; set; }
+
+ public int Rid { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Season/SeasonIndexConditionFilterItemModel.cs b/src/BiliLite.UWP/Models/Common/Season/SeasonIndexConditionFilterItemModel.cs
new file mode 100644
index 00000000..48a78251
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Season/SeasonIndexConditionFilterItemModel.cs
@@ -0,0 +1,8 @@
+namespace BiliLite.Models.Common.Season;
+
+public class SeasonIndexConditionFilterItemModel
+{
+ public string Keyword { get; set; }
+
+ public string Name { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Season/SeasonIndexConditionFilterModel.cs b/src/BiliLite.UWP/Models/Common/Season/SeasonIndexConditionFilterModel.cs
new file mode 100644
index 00000000..768df227
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Season/SeasonIndexConditionFilterModel.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+
+namespace BiliLite.Models.Common.Season;
+
+public class SeasonIndexConditionFilterModel
+{
+ public string Field { get; set; }
+
+ public string Name { get; set; }
+
+ public SeasonIndexConditionFilterItemModel Current { get; set; }
+
+ public List Values { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Season/SeasonIndexParameter.cs b/src/BiliLite.UWP/Models/Common/Season/SeasonIndexParameter.cs
new file mode 100644
index 00000000..56794385
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Season/SeasonIndexParameter.cs
@@ -0,0 +1,16 @@
+namespace BiliLite.Models.Common.Season;
+
+public class SeasonIndexParameter
+{
+ public IndexSeasonType Type { get; set; } = IndexSeasonType.Anime;
+
+ public string Area { get; set; } = "-1";
+
+ public string Style { get; set; } = "-1";
+
+ public string Year { get; set; } = "-1";
+
+ public string Month { get; set; } = "-1";
+
+ public string Order { get; set; } = "3";
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Season/SeasonIndexResultItemModel.cs b/src/BiliLite.UWP/Models/Common/Season/SeasonIndexResultItemModel.cs
new file mode 100644
index 00000000..7767441f
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Season/SeasonIndexResultItemModel.cs
@@ -0,0 +1,41 @@
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Season;
+
+public class SeasonIndexResultItemModel
+{
+ [JsonProperty("season_id")]
+ public int SeasonId { get; set; }
+
+ public string Title { get; set; }
+
+ public string Badge { get; set; }
+
+ [JsonProperty("badge_type")]
+ public int BadgeType { get; set; }
+
+ public bool ShowBadge => !string.IsNullOrEmpty(Badge);
+
+ public string Cover { get; set; }
+
+ [JsonProperty("index_show")]
+ public string IndexShow { get; set; }
+
+ [JsonProperty("is_finish")]
+ public int IsFinish { get; set; }
+
+ public string Link { get; set; }
+
+ [JsonProperty("media_id")]
+ public int MediaId { get; set; }
+
+ public string Order { get; set; }
+
+ [JsonProperty("order_type")]
+ public string OrderType { get; set; }
+
+ public bool ShowScore =>
+ OrderType == "score";
+
+ //public SeasonIndexResultItemOrderModel order { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Season/SeasonIndexResultItemOrderModel.cs b/src/BiliLite.UWP/Models/Common/Season/SeasonIndexResultItemOrderModel.cs
new file mode 100644
index 00000000..620c2e8b
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Season/SeasonIndexResultItemOrderModel.cs
@@ -0,0 +1,40 @@
+using BiliLite.Extensions;
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Season;
+
+public class SeasonIndexResultItemOrderModel
+{
+ public string Follow { get; set; }
+
+ public string Play { get; set; }
+
+ public string Score { get; set; }
+
+ [JsonProperty("pub_date")]
+ public long PubDate { get; set; }
+
+ [JsonProperty("pub_real_time")]
+ public long PubRealTime { get; set; }
+
+ [JsonProperty("renewal_time")]
+ public long RenewalTime { get; set; }
+
+ public string Type { get; set; }
+
+ public string BottomText
+ {
+ get
+ {
+ if (Type == "follow")
+ {
+ return Follow;
+ }
+ else
+ {
+ return RenewalTime.HandelTimestamp() + "更新";
+ }
+ }
+ }
+ public bool ShowScore => Type == "score";
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Season/SeasonRankItemModel.cs b/src/BiliLite.UWP/Models/Common/Season/SeasonRankItemModel.cs
new file mode 100644
index 00000000..743ca8db
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Season/SeasonRankItemModel.cs
@@ -0,0 +1,35 @@
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Season;
+
+public class SeasonRankItemModel
+{
+ public int Rank { get; set; }
+
+ public string Badge { get; set; }
+
+ public string Desc { get; set; }
+
+ [JsonProperty("season_id")]
+ public string SeasonId { get; set; }
+
+ public string Title { get; set; }
+
+ public string Url { get; set; }
+
+ public string Cover { get; set; }
+
+ [JsonProperty("badge_type")]
+ public int BadgeType { get; set; }
+
+ public int Pts { get; set; }
+
+ public bool ShowBadge => !string.IsNullOrEmpty(Badge);
+
+ public bool ShowDanmaku => Stat != null && Stat.Danmaku != 0;
+
+ public SeasonRankItemStatModel Stat { get; set; }
+
+ [JsonProperty("new_ep")]
+ public SeasonRankItemNewEPModel NewEp { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Season/SeasonRankItemNewEPModel.cs b/src/BiliLite.UWP/Models/Common/Season/SeasonRankItemNewEPModel.cs
new file mode 100644
index 00000000..7b60849b
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Season/SeasonRankItemNewEPModel.cs
@@ -0,0 +1,11 @@
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Season;
+
+public class SeasonRankItemNewEPModel
+{
+ public string Cover { get; set; }
+
+ [JsonProperty("index_show")]
+ public string IndexShow { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Season/SeasonRankItemStatModel.cs b/src/BiliLite.UWP/Models/Common/Season/SeasonRankItemStatModel.cs
new file mode 100644
index 00000000..5910d83f
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Season/SeasonRankItemStatModel.cs
@@ -0,0 +1,10 @@
+namespace BiliLite.Models.Common.Season;
+
+public class SeasonRankItemStatModel
+{
+ public long Danmaku { get; set; }
+
+ public long Follow { get; set; }
+
+ public long View { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Season/SeasonShortReviewItemAuthorModel.cs b/src/BiliLite.UWP/Models/Common/Season/SeasonShortReviewItemAuthorModel.cs
new file mode 100644
index 00000000..5e8e51c4
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Season/SeasonShortReviewItemAuthorModel.cs
@@ -0,0 +1,12 @@
+namespace BiliLite.Models.Common.Season;
+
+public class SeasonShortReviewItemAuthorModel
+{
+ public string Avatar { get; set; }
+
+ public string Uname { get; set; }
+
+ public long Mid { get; set; }
+
+ public SeasonShortReviewItemVIPModel Vip { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Season/SeasonShortReviewItemModel.cs b/src/BiliLite.UWP/Models/Common/Season/SeasonShortReviewItemModel.cs
new file mode 100644
index 00000000..cac1a1f4
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Season/SeasonShortReviewItemModel.cs
@@ -0,0 +1,28 @@
+using Newtonsoft.Json;
+
+namespace BiliLite.Models.Common.Season;
+
+public class SeasonShortReviewItemModel
+{
+ public long Ctime { get; set; }
+
+ public long Mid { get; set; }
+
+ [JsonProperty("review_id")]
+ public int ReviewId { get; set; }
+
+ public string Content { get; set; }
+
+ public string Progress { get; set; }
+
+ public int Score { get; set; }
+
+ ///
+ /// 评分,转为5分制
+ ///
+ public int Score5 => Score / 2;
+
+ public SeasonShortReviewItemAuthorModel Author { get; set; }
+
+ public SeasonShortReviewItemStatModel Stat { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Season/SeasonShortReviewItemStatModel.cs b/src/BiliLite.UWP/Models/Common/Season/SeasonShortReviewItemStatModel.cs
new file mode 100644
index 00000000..be611771
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Season/SeasonShortReviewItemStatModel.cs
@@ -0,0 +1,19 @@
+namespace BiliLite.Models.Common.Season;
+
+public class SeasonShortReviewItemStatModel
+{
+ ///
+ /// 是否已经点踩👎
+ ///
+ public int Disliked { get; set; }
+
+ ///
+ /// 是否已经点赞👍
+ ///
+ public int Liked { get; set; }
+
+ ///
+ /// 点赞数量
+ ///
+ public int Likes { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/Season/SeasonShortReviewItemVIPModel.cs b/src/BiliLite.UWP/Models/Common/Season/SeasonShortReviewItemVIPModel.cs
new file mode 100644
index 00000000..ece8d570
--- /dev/null
+++ b/src/BiliLite.UWP/Models/Common/Season/SeasonShortReviewItemVIPModel.cs
@@ -0,0 +1,8 @@
+namespace BiliLite.Models.Common.Season;
+
+public class SeasonShortReviewItemVIPModel
+{
+ public int VipType { get; set; }
+
+ public int VipStatus { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Models/Common/SettingConstants.cs b/src/BiliLite.UWP/Models/Common/SettingConstants.cs
index 18e3cf0b..68ebef35 100644
--- a/src/BiliLite.UWP/Models/Common/SettingConstants.cs
+++ b/src/BiliLite.UWP/Models/Common/SettingConstants.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using BiliLite.Models.Attributes;
+using BiliLite.Models.Attributes;
using BiliLite.Models.Common.Player;
using BiliLite.Services;
+using System.Collections.Generic;
namespace BiliLite.Models.Common
{
@@ -233,7 +233,19 @@ public class UI
public const string TAB_ITEM_MIN_WIDTH = "TabItemMinWidth";
[SettingDefaultValue]
- public const double DEFAULT_TAB_ITEM_MIN_WIDTH = 192;
+ public const double DEFAULT_TAB_ITEM_MIN_WIDTH = 0;
+
+ [SettingKey(typeof(double))]
+ public const string TAB_HEIGHT = "TabHeight";
+
+ [SettingDefaultValue]
+ public const double DEFAULT_TAB_HEIGHT = 40;
+
+ ///
+ /// 是否启用动态磁贴
+ ///
+ // 因为要开关时注册磁贴服务,所以不设置SettingKey
+ public const string ENABLE_NOTIFICATION_TILES = "EnableNotificationTiles";
}
public class Account
@@ -606,7 +618,7 @@ public class Player
[SettingKey(typeof(object))]
public const string FfmpegOptions = "FfmpegOptions";
- ///
+ ///
/// 使用外站视频替换无法播放的视频 bool
///
[SettingKey(typeof(bool))]
diff --git a/src/BiliLite.UWP/Models/Requests/Api/SeasonApi.cs b/src/BiliLite.UWP/Models/Requests/Api/SeasonApi.cs
index 809d6314..f6215493 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/SeasonApi.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/SeasonApi.cs
@@ -1,11 +1,19 @@
using BiliLite.Services;
using System;
using BiliLite.Models.Common;
+using Microsoft.Extensions.DependencyInjection;
namespace BiliLite.Models.Requests.Api
{
public class SeasonApi : BaseApi
{
+ private readonly CookieService m_cookieService;
+
+ public SeasonApi()
+ {
+ m_cookieService = App.ServiceProvider.GetRequiredService();
+ }
+
///
/// 用season_id / ep_id 取番剧信息
///
@@ -63,11 +71,12 @@ public ApiModel ShortReview(int media_id, string next = "", int sort = 0)
///
public ApiModel LikeReview(int media_id, int review_id, ReviewType review_type = ReviewType.Short)
{
+ var csrf = m_cookieService.GetCSRFToken();
var api = new ApiModel()
{
method = HttpMethods.Post,
- baseUrl = $"https://bangumi.bilibili.com/review/api/like",
- body = $"{ApiHelper.MustParameter(AppKey, true)}&media_id={media_id}&review_id={review_id}&review_type={(int)review_type}"
+ baseUrl = $"https://api.bilibili.com/pgc/review/action/like",
+ body = $"{ApiHelper.MustParameter(AppKey, true)}&media_id={media_id}&review_id={review_id}&review_type={(int)review_type}",
};
api.body += ApiHelper.GetSign(api.body, AppKey);
return api;
@@ -82,7 +91,7 @@ public ApiModel DislikeReview(int media_id, int review_id, ReviewType review_typ
var api = new ApiModel()
{
method = HttpMethods.Post,
- baseUrl = $"https://bangumi.bilibili.com/review/api/dislike",
+ baseUrl = $"https://api.bilibili.com/pgc/review/action/dislike",
body = $"{ApiHelper.MustParameter(AppKey, true)}&media_id={media_id}&review_id={review_id}&review_type={(int)review_type}"
};
api.body += ApiHelper.GetSign(api.body, AppKey);
@@ -101,7 +110,7 @@ public ApiModel SendShortReview(int media_id, string content, bool share_feed, i
var api = new ApiModel()
{
method = HttpMethods.Post,
- baseUrl = $"https://bangumi.bilibili.com/review/api/short/post",
+ baseUrl = $"https://api.bilibili.com/pgc/review/action/short/post",
body = $"{ApiHelper.MustParameter(AppKey, true)}&media_id={media_id}&content={Uri.EscapeDataString(content)}&share_feed={(share_feed ? 1 : 0)}&score={score}"
};
api.body += ApiHelper.GetSign(api.body, AppKey);
diff --git a/src/BiliLite.UWP/Modules/Detail/FavoriteDetailVM.cs b/src/BiliLite.UWP/Modules/Detail/FavoriteDetailVM.cs
deleted file mode 100644
index 46b77088..00000000
--- a/src/BiliLite.UWP/Modules/Detail/FavoriteDetailVM.cs
+++ /dev/null
@@ -1,434 +0,0 @@
-using BiliLite.Models;
-using BiliLite.Models.Requests.Api.User;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows.Input;
-using Windows.UI.Xaml.Controls;
-using BiliLite.Extensions;
-using BiliLite.Services;
-
-namespace BiliLite.Modules
-{
- public class FavoriteDetailVM : IModules
- {
- readonly FavoriteApi favoriteApi;
- public int Page { get; set; } = 1;
- public string Keyword { get; set; } = "";
- public string Id { get; set; }
- public int Type { get; set; }
- public FavoriteDetailVM()
- {
- favoriteApi = new FavoriteApi();
- RefreshCommand = new RelayCommand(Refresh);
- LoadMoreCommand = new RelayCommand(LoadMore);
- CollectCommand = new RelayCommand(DoCollect);
- CancelCollectCommand = new RelayCommand(DoCancelCollect);
- SelectCommand = new RelayCommand
public sealed partial class SeasonRankPage : BasePage
{
- readonly SeasonRankVM seasonRankVM;
+ readonly SeasonRankViewModel m_viewModel;
+
public SeasonRankPage()
{
+ m_viewModel = App.ServiceProvider.GetRequiredService();
this.InitializeComponent();
Title = "热门榜单";
this.NavigationCacheMode = NavigationCacheMode.Enabled;
- seasonRankVM = new SeasonRankVM();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -30,7 +33,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.New)
{
- seasonRankVM.LoadRankRegion((int)e.Parameter);
+ m_viewModel.LoadRankRegion((int)e.Parameter);
}
}
@@ -40,10 +43,10 @@ private async void pivot_SelectionChanged(object sender, SelectionChangedEventAr
{
return;
}
- var data = pivot.SelectedItem as SeasonRankModel;
+ var data = pivot.SelectedItem as SeasonRankDataViewModel;
if (data.Items == null || data.Items.Count == 0)
{
- await seasonRankVM.LoadRankDetail(data);
+ await m_viewModel.LoadRankDetail(data);
}
}
@@ -54,8 +57,8 @@ private void SeasonRankItemOpen(object sender, SeasonRankItemModel item, bool do
{
icon = Symbol.Play,
page = typeof(SeasonDetailPage),
- title = item.title,
- parameters = item.season_id,
+ title = item.Title,
+ parameters = item.SeasonId,
dontGoTo = dontGoTo
});
}
diff --git a/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml b/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml
index f0363440..28b0694b 100644
--- a/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml
+++ b/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml
@@ -8,28 +8,28 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:controls="using:BiliLite.Controls"
- xmlns:modules="using:BiliLite.Modules"
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:fa="using:FontAwesome5"
+ xmlns:anime="using:BiliLite.Models.Common.Anime"
Background="Transparent">
-
+
-
+
-
-
+
+
-
+
@@ -42,7 +42,7 @@
-
+
@@ -63,7 +63,7 @@
-
+
@@ -98,6 +98,6 @@
-
+
diff --git a/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml.cs b/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml.cs
index 66624815..31e03839 100644
--- a/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml.cs
@@ -1,11 +1,13 @@
using BiliLite.Extensions;
using BiliLite.Models.Common;
-using BiliLite.Modules;
using BiliLite.Services;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Navigation;
+using BiliLite.Models.Common.Anime;
+using BiliLite.ViewModels.Season;
+using Microsoft.Extensions.DependencyInjection;
// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
@@ -16,19 +18,22 @@ namespace BiliLite.Pages.Bangumi
///
public sealed partial class TimelinePage : BasePage
{
- Modules.AnimeTimelineVM timelineVM;
+ private AnimeTimelineViewModel m_viewModel;
+
public TimelinePage()
{
this.InitializeComponent();
Title = "番剧时间表";
}
+
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if(e.NavigationMode== NavigationMode.New)
{
- timelineVM = new AnimeTimelineVM((AnimeType)e.Parameter);
- this.DataContext = timelineVM;
+ m_viewModel = App.ServiceProvider.GetRequiredService();
+ m_viewModel.Init((AnimeType)e.Parameter);
+ this.DataContext = m_viewModel;
// timeLine.ItemsSource = e.Parameter as List;
// timeLine.SelectedItem = (e.Parameter as List).FirstOrDefault(x => x.is_today);
}
@@ -40,8 +45,8 @@ private async void cbType_SelectionChanged(object sender, SelectionChangedEventA
{
return;
}
- timelineVM.animeType = (cbType.SelectedItem as AnimeTypeItem).AnimeType;
- await timelineVM.GetTimeline();
+ m_viewModel.AnimeType = (cbType.SelectedItem as AnimeTypeItem).AnimeType;
+ await m_viewModel.GetTimeline();
}
private void AdaptiveGridView_ItemClick(object sender, ItemClickEventArgs e)
diff --git a/src/BiliLite.UWP/Pages/DownloadPage.xaml b/src/BiliLite.UWP/Pages/DownloadPage.xaml
index 0b3d8cde..c9f0f4f5 100644
--- a/src/BiliLite.UWP/Pages/DownloadPage.xaml
+++ b/src/BiliLite.UWP/Pages/DownloadPage.xaml
@@ -10,7 +10,7 @@
xmlns:controls="using:BiliLite.Controls"
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls" xmlns:modules="using:BiliLite.Modules"
xmlns:download="using:BiliLite.Models.Common.Download"
- xmlns:viewModel="using:BiliLite.ViewModels.Download"
+ xmlns:viewModel="using:BiliLite.ViewModels.Download" xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
Background="Transparent">
@@ -34,6 +34,19 @@
%
+
+
+
+
+
-
+
@@ -259,7 +272,7 @@
-
+
剧集
@@ -289,7 +302,7 @@
GB/GB
-
+
diff --git a/src/BiliLite.UWP/Pages/DownloadPage.xaml.cs b/src/BiliLite.UWP/Pages/DownloadPage.xaml.cs
index ee7280fc..e353e3b4 100644
--- a/src/BiliLite.UWP/Pages/DownloadPage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/DownloadPage.xaml.cs
@@ -31,6 +31,14 @@ public sealed partial class DownloadPage : BasePage, IRefreshablePage
private static readonly ILogger logger = GlobalLogger.FromCurrentType();
private readonly DownloadPageViewModel m_viewModel;
private readonly DownloadService m_downloadService;
+ private readonly ComboBoxItemData[] m_sortOptions = new ComboBoxItemData[]
+ {
+ new() { Text = "默认", Value = DownloadedSortMode.Default },
+ new() { Text = "时间倒序", Value = DownloadedSortMode.TimeDesc },
+ new() { Text = "时间顺序", Value = DownloadedSortMode.TimeAsc },
+ new() { Text = "标题顺序", Value = DownloadedSortMode.TitleAsc },
+ new() { Text = "标题倒序", Value = DownloadedSortMode.TitleDesc },
+ };
public DownloadPage()
{
@@ -46,6 +54,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
public async Task Refresh()
{
+ CbSortMode.SelectedIndex = 0;
m_downloadService.RefreshDownloaded();
}
@@ -350,5 +359,16 @@ private void BtnResumeSubItem_OnClick(object sender, RoutedEventArgs e)
m_downloadService.ResumeItem(item);
}
}
+
+ private void BtnClearSearch_OnClick(object sender, RoutedEventArgs e)
+ {
+ m_downloadService.SearchDownloaded("");
+ DownloadPivot.SelectedIndex = 1;
+ }
+
+ private void SortOptions_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ m_downloadService.SetDownloadedSortMode((DownloadedSortMode)CbSortMode.SelectedValue);
+ }
}
}
diff --git a/src/BiliLite.UWP/Pages/Home/AnimePage.xaml.cs b/src/BiliLite.UWP/Pages/Home/AnimePage.xaml.cs
index 2b4c6cbb..3a7da6d6 100644
--- a/src/BiliLite.UWP/Pages/Home/AnimePage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/Home/AnimePage.xaml.cs
@@ -1,7 +1,6 @@
using BiliLite.Extensions;
using BiliLite.Models;
using BiliLite.Models.Common;
-using BiliLite.Modules;
using BiliLite.Services;
using System;
using System.Threading.Tasks;
@@ -9,6 +8,7 @@
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using BiliLite.Models.Common.Anime;
+using BiliLite.Models.Common.Season;
using BiliLite.ViewModels.Home;
using Microsoft.Extensions.DependencyInjection;
@@ -128,7 +128,7 @@ private void btnOpenIndex_Click(object sender, RoutedEventArgs e)
title = animeType == AnimeType.Bangumi ? "番剧索引" : "国创索引",
parameters = new SeasonIndexParameter()
{
- type = animeType == AnimeType.Bangumi ? IndexSeasonType.Anime : IndexSeasonType.Guochuang
+ Type = animeType == AnimeType.Bangumi ? IndexSeasonType.Anime : IndexSeasonType.Guochuang
}
});
}
diff --git a/src/BiliLite.UWP/Pages/Home/HotPage.xaml b/src/BiliLite.UWP/Pages/Home/HotPage.xaml
index 12ce322b..5c0069a3 100644
--- a/src/BiliLite.UWP/Pages/Home/HotPage.xaml
+++ b/src/BiliLite.UWP/Pages/Home/HotPage.xaml
@@ -10,8 +10,9 @@
xmlns:controls="using:BiliLite.Controls"
xmlns:covert="using:BiliLite.Converters"
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
- xmlns:winui="using:Microsoft.UI.Xaml.Controls"
- Background="Transparent">
+ xmlns:winui="using:Microsoft.UI.Xaml.Controls"
+ xmlns:home="using:BiliLite.Models.Common.Home"
+ Background="Transparent">
@@ -23,12 +24,12 @@
OneRowModeEnabled="False"
Padding="8"
StretchContentForSingleRow="False"
- ItemsSource="{x:Bind Path=hotVM.HotItems,Mode=OneWay}"
+ ItemsSource="{x:Bind Path=m_viewModel.HotItems,Mode=OneWay}"
ItemHeight="100" DesiredWidth="560"
LoadMoreBottomOffset="0"
- LoadMoreCommand="{x:Bind Path=hotVM.LoadMoreCommand}"
+ LoadMoreCommand="{x:Bind Path=m_viewModel.LoadMoreCommand}"
CanLoadMore="True"
- Loading="{x:Bind Path=hotVM.Loading,Mode=OneWay}"
+ Loading="{x:Bind Path=m_viewModel.Loading,Mode=OneWay}"
SelectionMode="None" IsItemClickEnabled="True">
-
+
关注的直播
@@ -66,7 +67,7 @@
MoveOffset="600"
AlwayShowButton="False"
ItemClick="FollowLive_ItemClick"
- ItemsSource="{x:Bind Path=liveVM.liveAttentionVM.Follow,Mode=OneWay}"
+ ItemsSource="{x:Bind Path=m_viewModel.LiveAttentionVm.Follow,Mode=OneWay}"
SelectionMode="None"
Margin="-4 0 0 0"
ScrollViewer.HorizontalScrollMode="Enabled"
@@ -127,17 +128,17 @@
-
+
-
+
-
+
查看更多
@@ -146,7 +147,7 @@
MoveOffset="600"
AlwayShowButton="False"
ItemClick="LiveItems_ItemClick"
- ItemsSource="{x:Bind Path=list,Mode=OneWay}"
+ ItemsSource="{x:Bind Path=List,Mode=OneWay}"
SelectionMode="None"
Margin="-4 0 0 0"
ScrollViewer.HorizontalScrollMode="Enabled"
@@ -168,7 +169,7 @@
-
+
@@ -177,7 +178,7 @@
-
+
@@ -186,22 +187,22 @@
-
+
-
+
-
-
-
+
+
+
-
-
+
+
@@ -217,7 +218,7 @@
-
+
diff --git a/src/BiliLite.UWP/Pages/Home/LivePage.xaml.cs b/src/BiliLite.UWP/Pages/Home/LivePage.xaml.cs
index 1cbc0d20..423a9750 100644
--- a/src/BiliLite.UWP/Pages/Home/LivePage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/Home/LivePage.xaml.cs
@@ -1,6 +1,5 @@
using BiliLite.Extensions;
using BiliLite.Models.Common;
-using BiliLite.Modules;
using BiliLite.Modules.Live.LiveCenter;
using BiliLite.Pages.Live;
using BiliLite.Services;
@@ -10,6 +9,9 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
+using BiliLite.Models.Common.Home;
+using BiliLite.ViewModels.Home;
+using Microsoft.Extensions.DependencyInjection;
// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
@@ -20,11 +22,11 @@ namespace BiliLite.Pages.Home
///
public sealed partial class LivePage : Page,IRefreshablePage
{
- private Modules.LiveVM liveVM;
+ private LiveViewModel m_viewModel;
public LivePage()
{
this.InitializeComponent();
- liveVM = new Modules.LiveVM();
+ m_viewModel = App.ServiceProvider.GetRequiredService();
if (SettingService.GetValue(SettingConstants.UI.CACHE_HOME, true))
{
this.NavigationCacheMode = NavigationCacheMode.Enabled;
@@ -35,21 +37,21 @@ public LivePage()
}
}
- protected async override void OnNavigatedTo(NavigationEventArgs e)
+ protected override async void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
- if (e.NavigationMode == NavigationMode.New && liveVM.Banners == null)
+ if (e.NavigationMode == NavigationMode.New && m_viewModel.Banners == null)
{
await LoadData();
}
}
private async Task LoadData()
{
- await liveVM.GetLiveHome();
+ await m_viewModel.GetLiveHome();
if (SettingService.Account.Logined)
{
- liveVM.ShowFollows = true;
- await liveVM.liveAttentionVM.GetFollows();
+ m_viewModel.ShowFollows = true;
+ await m_viewModel.LiveAttentionVm.GetFollows();
}
}
@@ -65,7 +67,7 @@ private async void btnRefresh_Click(object sender, RoutedEventArgs e)
private async void BannerItem_Click(object sender, RoutedEventArgs e)
{
- var result = await MessageCenter.HandelUrl(((sender as HyperlinkButton).DataContext as LiveHomeBannerModel).link);
+ var result = await MessageCenter.HandelUrl(((sender as HyperlinkButton).DataContext as LiveHomeBannerModel).Link);
if (!result)
{
Notify.ShowMessageToast("不支持打开的链接");
@@ -96,15 +98,15 @@ private void LiveItems_ItemClick(object sender, ItemClickEventArgs e)
{
icon = Symbol.Video,
page = typeof(LiveDetailPage),
- title = data.uname + "的直播间",
- parameters = data.roomid
+ title = data.Uname + "的直播间",
+ parameters = data.Roomid
});
}
private void loadMore_Click(object sender, RoutedEventArgs e)
{
var data = (sender as HyperlinkButton).DataContext as LiveHomeItemsModel;
- if (data.module_info.title == "推荐直播")
+ if (data.ModuleInfo.Title == "推荐直播")
{
MessageCenter.NavigateToPage(this, new NavigationInfo()
{
@@ -113,18 +115,18 @@ private void loadMore_Click(object sender, RoutedEventArgs e)
title = "全部直播"
});
}
- if (!string.IsNullOrEmpty(data.module_info.link))
+ if (!string.IsNullOrEmpty(data.ModuleInfo.Link))
{
try
{
- var match = Regex.Match(data.module_info.link, @"parentAreaId=(\d+)&areaId=(\d+)");
+ var match = Regex.Match(data.ModuleInfo.Link, @"parentAreaId=(\d+)&areaId=(\d+)");
if (match.Groups.Count == 3)
{
MessageCenter.NavigateToPage(this, new NavigationInfo()
{
icon = Symbol.Document,
page = typeof(LiveAreaDetailPage),
- title = data.module_info.title,
+ title = data.ModuleInfo.Title,
parameters = new LiveAreaPar()
{
parent_id = match.Groups[1].Value.ToInt32(),
@@ -146,13 +148,13 @@ private void loadMore_Click(object sender, RoutedEventArgs e)
private void GridView_ItemClick(object sender, ItemClickEventArgs e)
{
var area = e.ClickedItem as LiveHomeAreaModel;
- if (area.id == 0)
+ if (area.Id == 0)
{
MessageCenter.NavigateToPage(this, new NavigationInfo()
{
icon = Symbol.Document,
page = typeof(LiveAreaPage),
- title = area.title
+ title = area.Title
});
return;
}
@@ -160,11 +162,11 @@ private void GridView_ItemClick(object sender, ItemClickEventArgs e)
{
icon = Symbol.Document,
page = typeof(LiveAreaDetailPage),
- title = area.title,
+ title = area.Title,
parameters = new LiveAreaPar()
{
- parent_id = area.area_v2_parent_id,
- area_id = area.area_v2_id
+ parent_id = area.AreaV2ParentId,
+ area_id = area.AreaV2Id
}
});
}
diff --git a/src/BiliLite.UWP/Pages/Home/MoviePage.xaml b/src/BiliLite.UWP/Pages/Home/MoviePage.xaml
index cfd90810..1c20fc2c 100644
--- a/src/BiliLite.UWP/Pages/Home/MoviePage.xaml
+++ b/src/BiliLite.UWP/Pages/Home/MoviePage.xaml
@@ -12,9 +12,11 @@
xmlns:winui="using:Microsoft.UI.Xaml.Controls"
xmlns:fa="using:FontAwesome5"
xmlns:models="using:BiliLite.Models"
+ xmlns:home="using:BiliLite.ViewModels.Home"
+ xmlns:homeModel="using:BiliLite.Models.Common.Home"
Background="Transparent">
-
+
@@ -32,7 +34,7 @@
-
+
@@ -44,7 +46,7 @@
-
+
@@ -62,7 +64,7 @@
-
+
@@ -84,19 +86,19 @@
-
+
-
+
-
+
-
+
@@ -112,7 +114,7 @@
-
+
我的追剧
@@ -122,8 +124,8 @@
-
+
@@ -218,7 +220,7 @@
-
+
@@ -247,7 +249,7 @@
+ MoveOffset="600" AlwayShowButton="False" SelectionMode="None" ItemClick="{x:Bind Path=m_viewModel.SeasonItemClick}" ItemsSource="{x:Bind Path=m_viewModel.HomeData.Documentary,Mode=OneWay}" ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollMode="Disabled" ItemTemplate="{StaticResource HotAnimeItem}" IsItemClickEnabled="True">
-
+
-
-
+
+
@@ -29,6 +29,6 @@
-
+
diff --git a/src/BiliLite.UWP/Pages/Home/RegionsPage.xaml.cs b/src/BiliLite.UWP/Pages/Home/RegionsPage.xaml.cs
index 8c200728..23b96da0 100644
--- a/src/BiliLite.UWP/Pages/Home/RegionsPage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/Home/RegionsPage.xaml.cs
@@ -1,21 +1,10 @@
using BiliLite.Models.Common;
-using BiliLite.Modules;
-using BiliLite.Modules.Home;
using BiliLite.Services;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
-using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Controls.Primitives;
-using Windows.UI.Xaml.Data;
-using Windows.UI.Xaml.Input;
-using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
+using BiliLite.Models.Common.Home;
+using BiliLite.ViewModels.Home;
+using Microsoft.Extensions.DependencyInjection;
// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
@@ -26,11 +15,12 @@ namespace BiliLite.Pages.Home
///
public sealed partial class RegionsPage : Page
{
- RegionVM channelVM;
+ private readonly RegionViewModel m_viewModel;
+
public RegionsPage()
{
+ m_viewModel = App.ServiceProvider.GetRequiredService();
this.InitializeComponent();
- channelVM = new RegionVM();
if (SettingService.GetValue(SettingConstants.UI.CACHE_HOME, true))
{
this.NavigationCacheMode = NavigationCacheMode.Enabled;
@@ -41,12 +31,12 @@ public RegionsPage()
}
}
- protected async override void OnNavigatedTo(NavigationEventArgs e)
+ protected override async void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
- if (e.NavigationMode == NavigationMode.New && channelVM.Regions == null)
+ if (e.NavigationMode == NavigationMode.New && m_viewModel.Regions == null)
{
- await channelVM.GetRegions();
+ await m_viewModel.GetRegions();
}
}
@@ -54,74 +44,74 @@ protected async override void OnNavigatedTo(NavigationEventArgs e)
private void GridView_ItemClick(object sender, ItemClickEventArgs e)
{
var item = e.ClickedItem as RegionItem;
- if (item.uri.Contains("http"))
+ if (item.Uri.Contains("http"))
{
MessageCenter.NavigateToPage(this, new NavigationInfo()
{
icon = Symbol.World,
page = typeof(WebPage),
- title = item.name,
- parameters = item.uri
+ title = item.Name,
+ parameters = item.Uri
});
return;
}
- if (item.children != null)
+ if (item.Children != null)
{
MessageCenter.NavigateToPage(this, new NavigationInfo()
{
icon = Symbol.Document,
page = typeof(Pages.RegionDetailPage),
- title = item.name,
+ title = item.Name,
parameters = new OpenRegionInfo()
{
- id = item.tid
+ id = item.Tid
}
});
return;
}
- if (item.name == "番剧")
+ if (item.Name == "番剧")
{
MessageCenter.NavigateToPage(this, new NavigationInfo()
{
icon = Symbol.Home,
page = typeof(Pages.Home.AnimePage),
- title = item.name,
+ title = item.Name,
parameters = AnimeType.Bangumi
});
return;
}
- if (item.name == "国创")
+ if (item.Name == "国创")
{
MessageCenter.NavigateToPage(this, new NavigationInfo()
{
icon = Symbol.Home,
page = typeof(Pages.Home.AnimePage),
- title = item.name,
+ title = item.Name,
parameters = AnimeType.Bangumi
});
return;
}
- if (item.name == "放映厅")
+ if (item.Name == "放映厅")
{
MessageCenter.NavigateToPage(this, new NavigationInfo()
{
icon = Symbol.Home,
page = typeof(Pages.Home.MoviePage),
- title = item.name
+ title = item.Name
});
return;
}
- if (item.name == "直播")
+ if (item.Name == "直播")
{
MessageCenter.NavigateToPage(this, new NavigationInfo()
{
icon = Symbol.Home,
page = typeof(Pages.Home.LivePage),
- title = item.name
+ title = item.Name
});
return;
}
- if (item.name == "全区排行榜")
+ if (item.Name == "全区排行榜")
{
MessageCenter.NavigateToPage(this, new NavigationInfo()
{
diff --git a/src/BiliLite.UWP/Pages/HomePage.xaml b/src/BiliLite.UWP/Pages/HomePage.xaml
index d99f3415..0b0b9cd8 100644
--- a/src/BiliLite.UWP/Pages/HomePage.xaml
+++ b/src/BiliLite.UWP/Pages/HomePage.xaml
@@ -66,15 +66,15 @@
-->
-
-
+
+
等级
/
-
+
diff --git a/src/BiliLite.UWP/Pages/Live/LiveCenterPage.xaml b/src/BiliLite.UWP/Pages/Live/LiveCenterPage.xaml
index e4ab034e..a46cbea3 100644
--- a/src/BiliLite.UWP/Pages/Live/LiveCenterPage.xaml
+++ b/src/BiliLite.UWP/Pages/Live/LiveCenterPage.xaml
@@ -6,7 +6,7 @@
xmlns:local="using:BiliLite.Pages.Live"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d"
+ mc:Ignorable="d" xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:control="using:BiliLite.Controls"
xmlns:modules="using:BiliLite.Modules.Live.LiveCenter"
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
@@ -24,7 +24,7 @@
-
+
@@ -1222,7 +1222,7 @@
-
+
赠送
diff --git a/src/BiliLite.UWP/Pages/LiveDetailPage.xaml.cs b/src/BiliLite.UWP/Pages/LiveDetailPage.xaml.cs
index 4182d6a6..5c0f1045 100644
--- a/src/BiliLite.UWP/Pages/LiveDetailPage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/LiveDetailPage.xaml.cs
@@ -323,10 +323,23 @@ await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
if (e.NewState.IsFullscreen && !view.IsFullScreenMode)
{
view.TryEnterFullScreenMode();
+
+ if (SettingService.GetValue(SettingConstants.UI.DISPLAY_MODE, 0) <= 0)
+ {
+ var marginOffset = SettingService.GetValue(SettingConstants.UI.TAB_HEIGHT,
+ SettingConstants.UI.DEFAULT_TAB_HEIGHT);
+ this.Margin = new Thickness(0, marginOffset * -1, 0, 0);
+ }
+ else
+ {
+ this.Margin = new Thickness(0, -40, 0, 0);
+ }
}
else if (view.IsFullScreenMode)
{
view.ExitFullScreenMode();
+
+ this.Margin = new Thickness(0);
}
});
}
diff --git a/src/BiliLite.UWP/Pages/Other/FindMorePage.xaml b/src/BiliLite.UWP/Pages/Other/FindMorePage.xaml
index 71280f40..7bcda15d 100644
--- a/src/BiliLite.UWP/Pages/Other/FindMorePage.xaml
+++ b/src/BiliLite.UWP/Pages/Other/FindMorePage.xaml
@@ -7,8 +7,9 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
- xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls" xmlns:modules="using:BiliLite.Modules.Other"
- Background="Transparent">
+ xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
+ xmlns:other="using:BiliLite.Models.Common.Other"
+ Background="Transparent">
@@ -28,17 +29,17 @@
-
+
-
+
-
- 《SPY×FAMILY 間諜家家酒》、《輝夜姬想讓人告白》、《派對咖孔明》、《街角的魔族女孩》
+
+ 《SPY×FAMILY 間諜家家酒》、《輝夜姬想讓人告白》、《派對咖孔明》、《街角的魔族女孩》
@@ -47,6 +48,6 @@
-
+
diff --git a/src/BiliLite.UWP/Pages/Other/FindMorePage.xaml.cs b/src/BiliLite.UWP/Pages/Other/FindMorePage.xaml.cs
index c461ee71..f6c84685 100644
--- a/src/BiliLite.UWP/Pages/Other/FindMorePage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/Other/FindMorePage.xaml.cs
@@ -1,21 +1,12 @@
using BiliLite.Models.Common;
-using BiliLite.Modules.Other;
using BiliLite.Services;
using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
using Windows.System;
-using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Controls.Primitives;
-using Windows.UI.Xaml.Data;
-using Windows.UI.Xaml.Input;
-using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
+using BiliLite.Models.Common.Other;
+using BiliLite.ViewModels.Other;
+using Microsoft.Extensions.DependencyInjection;
// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
@@ -26,36 +17,37 @@ namespace BiliLite.Pages.Other
///
public sealed partial class FindMorePage : BasePage
{
- readonly FindMoreVM findMoreVM;
+ private readonly FindMoreViewModel m_viewModel;
public FindMorePage()
{
+ m_viewModel = App.ServiceProvider.GetRequiredService();
this.InitializeComponent();
- findMoreVM=new FindMoreVM();
}
+
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
- if (e.NavigationMode == NavigationMode.New && findMoreVM.Items == null)
+ if (e.NavigationMode == NavigationMode.New && m_viewModel.Items == null)
{
- findMoreVM.LoadEntrance();
+ m_viewModel.LoadEntrance();
}
}
private async void AdaptiveGridView_ItemClick(object sender, ItemClickEventArgs e)
{
var item = e.ClickedItem as FindMoreEntranceModel;
- if (item.type == 0)
+ if (item.Type == 0)
{
MessageCenter.NavigateToPage(this, new NavigationInfo() {
icon =Symbol.Link,
- title =item.name,
+ title =item.Name,
page=typeof(WebPage),
- parameters=item.link
+ parameters=item.Link
});
}
- else if(item.type == 1)
+ else if(item.Type == 1)
{
- await Launcher.LaunchUriAsync(new Uri(item.link));
+ await Launcher.LaunchUriAsync(new Uri(item.Link));
}
}
diff --git a/src/BiliLite.UWP/Pages/RankPage.xaml.cs b/src/BiliLite.UWP/Pages/RankPage.xaml.cs
index 07ef30e1..33c5466c 100644
--- a/src/BiliLite.UWP/Pages/RankPage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/RankPage.xaml.cs
@@ -1,14 +1,13 @@
using BiliLite.Extensions;
using BiliLite.Models.Common;
-using BiliLite.Modules;
+using BiliLite.Models.Common.Rank;
using BiliLite.Services;
+using BiliLite.ViewModels.Rank;
+using Microsoft.Extensions.DependencyInjection;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Navigation;
-using BiliLite.Models.Common.Rank;
-using BiliLite.ViewModels.Rank;
-using Microsoft.Extensions.DependencyInjection;
// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
@@ -23,20 +22,21 @@ public sealed partial class RankPage : BasePage
public RankPage()
{
m_viewModel = App.ServiceProvider.GetRequiredService();
+ m_viewModel.LoadRankRegion(0);
this.InitializeComponent();
Title = "排行榜";
+
+ NavigationCacheMode = SettingService.GetValue(SettingConstants.UI.CACHE_HOME, true)
+ ? NavigationCacheMode.Required
+ : NavigationCacheMode.Disabled;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
- if (e.NavigationMode == NavigationMode.New)
+ if (e.Parameter != null)
{
- var rid = 0;
- if (e.Parameter != null)
- {
- rid = e.Parameter.ToInt32();
- }
+ int rid = e.Parameter.ToInt32();
m_viewModel.LoadRankRegion(rid);
}
}
diff --git a/src/BiliLite.UWP/Pages/RegionDetailPage.xaml b/src/BiliLite.UWP/Pages/RegionDetailPage.xaml
index 90dcc1e2..688f3086 100644
--- a/src/BiliLite.UWP/Pages/RegionDetailPage.xaml
+++ b/src/BiliLite.UWP/Pages/RegionDetailPage.xaml
@@ -8,16 +8,17 @@
mc:Ignorable="d"
xmlns:controls="using:BiliLite.Controls"
xmlns:convert="using:BiliLite.Converters"
- xmlns:modules="using:BiliLite.Modules"
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:winui="using:Microsoft.UI.Xaml.Controls"
- xmlns:fa="using:FontAwesome5"
+ xmlns:fa="using:FontAwesome5"
+ xmlns:region="using:BiliLite.ViewModels.Region"
+ xmlns:model="using:BiliLite.Models.Common.Region"
Background="Transparent">
-
+
-
+
-
+
@@ -62,7 +63,7 @@
-
+
@@ -75,13 +76,13 @@
-
+
-
- 播放: 弹幕:
- ·
+
+ 播放: 弹幕:
+ ·
@@ -102,7 +103,7 @@
-
+
-
+
@@ -135,13 +136,13 @@
-
+
-
- 播放: 弹幕:
- ·
+
+ 播放: 弹幕:
+ ·
@@ -166,7 +167,7 @@
-
+
diff --git a/src/BiliLite.UWP/Pages/RegionDetailPage.xaml.cs b/src/BiliLite.UWP/Pages/RegionDetailPage.xaml.cs
index e963f6c7..f9ebc288 100644
--- a/src/BiliLite.UWP/Pages/RegionDetailPage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/RegionDetailPage.xaml.cs
@@ -1,11 +1,12 @@
using BiliLite.Models.Common;
-using BiliLite.Modules;
using BiliLite.Pages.Bangumi;
using BiliLite.Services;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
+using BiliLite.Models.Common.Region;
+using BiliLite.ViewModels.Region;
// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
@@ -16,18 +17,18 @@ namespace BiliLite.Pages
///
public sealed partial class RegionDetailPage : BasePage, IRefreshablePage
{
- RegionDetailVM regionDetailVM;
+ RegionDetailViewModel m_viewModel;
OpenRegionInfo regionInfo;
public RegionDetailPage()
{
this.InitializeComponent();
Title = "分区详情";
- regionDetailVM = new RegionDetailVM();
+ m_viewModel = new RegionDetailViewModel();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
- if (e.NavigationMode == NavigationMode.New||regionDetailVM.Regions==null)
+ if (e.NavigationMode == NavigationMode.New||m_viewModel.Regions==null)
{
if (e.Parameter!=null)
{
@@ -37,7 +38,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
{
regionInfo = new OpenRegionInfo();
}
- regionDetailVM.InitRegion(regionInfo.id, regionInfo.tid);
+ m_viewModel.InitRegion(regionInfo.id, regionInfo.tid);
}
}
@@ -47,10 +48,10 @@ private async void pivot_SelectionChanged(object sender, SelectionChangedEventAr
{
return;
}
- if(pivot.SelectedItem is RegionDetailHomeVM)
+ if(pivot.SelectedItem is RegionDetailHomeViewModel)
{
GridOrder.Visibility = Visibility.Collapsed;
- var data = pivot.SelectedItem as RegionDetailHomeVM;
+ var data = pivot.SelectedItem as RegionDetailHomeViewModel;
if (!data.Loading&&data.Banners==null)
{
await data.LoadHome();
@@ -58,7 +59,7 @@ private async void pivot_SelectionChanged(object sender, SelectionChangedEventAr
}
else
{
- var data = pivot.SelectedItem as RegionDetailChildVM;
+ var data = pivot.SelectedItem as RegionDetailChildViewModel;
if (!data.Loading && data.Tasgs == null)
{
await data.LoadHome();
@@ -110,7 +111,7 @@ private void cbTags_SelectionChanged(object sender, SelectionChangedEventArgs e
{
return;
}
- (pivot.SelectedItem as RegionDetailChildVM).Refresh();
+ (pivot.SelectedItem as RegionDetailChildViewModel).Refresh();
}
@@ -120,7 +121,7 @@ private void cbOrder_SelectionChanged(object sender, SelectionChangedEventArgs e
{
return;
}
- (pivot.SelectedItem as RegionDetailChildVM).Refresh();
+ (pivot.SelectedItem as RegionDetailChildViewModel).Refresh();
}
private void AdaptiveGridView_ItemClick(object sender, ItemClickEventArgs e)
@@ -134,8 +135,8 @@ private void AdaptiveGridView_ItemClick(object sender, ItemClickEventArgs e)
{
icon = Symbol.Play,
page = typeof(SeasonDetailPage),
- parameters = data.param,
- title = data.title
+ parameters = data.Param,
+ title = data.Title
});
return;
}
@@ -143,21 +144,21 @@ private void AdaptiveGridView_ItemClick(object sender, ItemClickEventArgs e)
MessageCenter.NavigateToPage(this,new NavigationInfo() {
icon= Symbol.Play,
page=typeof(VideoDetailPage),
- parameters=data.param,
- title=data.title
+ parameters=data.Param,
+ title=data.Title
});
}
private async void BtnOpenBanner_Click(object sender, RoutedEventArgs e)
{
- await MessageCenter.HandelUrl(((sender as HyperlinkButton).DataContext as RegionHomeBannerItemModel).uri);
+ await MessageCenter.HandelUrl(((sender as HyperlinkButton).DataContext as RegionHomeBannerItemModel).Uri);
}
private void AddToWatchLater_Click(object sender, RoutedEventArgs e)
{
var data = (sender as MenuFlyoutItem).DataContext as RegionVideoItemModel;
- Modules.User.WatchLaterVM.Instance.AddToWatchlater(data.param);
+ Modules.User.WatchLaterVM.Instance.AddToWatchlater(data.Param);
}
public async Task Refresh()
@@ -166,7 +167,7 @@ public async Task Refresh()
{
return;
}
- (pivot.SelectedItem as RegionDetailChildVM).Refresh();
+ (pivot.SelectedItem as RegionDetailChildViewModel).Refresh();
}
}
public class RegionDataTemplateSelector : DataTemplateSelector
@@ -177,7 +178,7 @@ public class RegionDataTemplateSelector : DataTemplateSelector
protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
{
- if (item is RegionDetailHomeVM)
+ if (item is RegionDetailHomeViewModel)
{
return HomeTemplate;
}
diff --git a/src/BiliLite.UWP/Pages/SeasonDetailPage.xaml b/src/BiliLite.UWP/Pages/SeasonDetailPage.xaml
index 03461d03..7dec89df 100644
--- a/src/BiliLite.UWP/Pages/SeasonDetailPage.xaml
+++ b/src/BiliLite.UWP/Pages/SeasonDetailPage.xaml
@@ -9,9 +9,9 @@
xmlns:fa="using:FontAwesome5"
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:convert="using:BiliLite.Converters"
- xmlns:modules="using:BiliLite.Modules"
- xmlns:control="using:BiliLite.Controls" xmlns:season="using:BiliLite.Modules.Season"
- xmlns:season1="using:BiliLite.Models.Common.Season"
+ xmlns:control="using:BiliLite.Controls"
+ xmlns:model="using:BiliLite.Models.Common.Season"
+ xmlns:viewModel="using:BiliLite.ViewModels.Season"
Background="Transparent"
SizeChanged="SeasonDetailPage_OnSizeChanged">
@@ -159,7 +159,9 @@
-
+
@@ -213,7 +215,7 @@
-
+
@@ -239,7 +241,7 @@
-
+
@@ -270,7 +272,7 @@
-
+
@@ -308,7 +310,7 @@
-
+
@@ -325,7 +327,7 @@
-
+
@@ -348,7 +350,7 @@
-
+
@@ -363,7 +365,7 @@
-
+
@@ -373,7 +375,7 @@
-
+
@@ -381,35 +383,35 @@
xiaoyaocz
-->
-
-
+
+
-
+
-
+
-
-
+
-
-
+
@@ -430,10 +432,10 @@
-
+
加载更多
-
+
diff --git a/src/BiliLite.UWP/Pages/SeasonDetailPage.xaml.cs b/src/BiliLite.UWP/Pages/SeasonDetailPage.xaml.cs
index 1e263109..1fa7e166 100644
--- a/src/BiliLite.UWP/Pages/SeasonDetailPage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/SeasonDetailPage.xaml.cs
@@ -2,7 +2,6 @@
using BiliLite.Dialogs;
using BiliLite.Models.Requests.Api;
using BiliLite.Modules;
-using BiliLite.Modules.Season;
using Microsoft.UI.Xaml.Controls;
using System;
using System.Collections.Generic;
@@ -37,20 +36,20 @@ public sealed partial class SeasonDetailPage : PlayPage
{
private static readonly ILogger logger = GlobalLogger.FromCurrentType();
- SeasonDetailPageViewModel m_viewModel;
- SeasonReviewVM seasonReviewVM;
+ private readonly SeasonDetailPageViewModel m_viewModel;
+ private readonly SeasonReviewViewModel m_seasonReviewViewModel;
string season_id = "";
string ep_id = "";
bool selectProview = false;
public SeasonDetailPage()
{
+ m_viewModel = App.ServiceProvider.GetRequiredService();
+ m_seasonReviewViewModel = App.ServiceProvider.GetRequiredService();
this.InitializeComponent();
Title = "剧集详情";
this.Loaded += SeasonDetailPage_Loaded;
this.Player = this.player;
NavigationCacheMode = NavigationCacheMode.Enabled;
- m_viewModel = new SeasonDetailPageViewModel();
- seasonReviewVM = new SeasonReviewVM();
DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
dataTransferManager.DataRequested += DataTransferManager_DataRequested;
m_viewModel.DefaultRightInfoWidth = new GridLength(SettingService.GetValue(SettingConstants.UI.RIGHT_DETAIL_WIDTH, 320), GridUnitType.Pixel);
@@ -134,7 +133,7 @@ private async Task InitSeasonDetail()
ChangeTitle(m_viewModel.Detail.Title);
- seasonReviewVM.MediaID = m_viewModel.Detail.MediaId;
+ m_seasonReviewViewModel.MediaID = m_viewModel.Detail.MediaId;
InitializePlayInfo();
await CreateQR();
@@ -276,7 +275,13 @@ private void PlayerControl_FullScreenEvent(object sender, bool e)
{
if (e)
{
- this.Margin = new Thickness(0, SettingService.GetValue(SettingConstants.UI.DISPLAY_MODE, 0) == 0 ? -48 : -48, 0, 0);
+ if (SettingService.GetValue(SettingConstants.UI.DISPLAY_MODE, 0) <= 0)
+ {
+ var marginOffset = SettingService.GetValue(SettingConstants.UI.TAB_HEIGHT,
+ SettingConstants.UI.DEFAULT_TAB_HEIGHT);
+ this.Margin = new Thickness(0, marginOffset * -1, 0, 0);
+ }
+
m_viewModel.DefaultRightInfoWidth = new GridLength(0, GridUnitType.Pixel);
BottomInfo.Height = new GridLength(0, GridUnitType.Pixel);
}
@@ -423,8 +428,8 @@ private void btnOpenIndexWithArea_Click(object sender, RoutedEventArgs e)
title = data.Name,
parameters = new SeasonIndexParameter()
{
- type = (IndexSeasonType)m_viewModel.Detail.Type,
- area = data.Id
+ Type = (IndexSeasonType)m_viewModel.Detail.Type,
+ Area = data.Id
}
});
}
@@ -440,43 +445,43 @@ private void btnOpenIndexWithStyle_Click(object sender, RoutedEventArgs e)
title = data.Name,
parameters = new SeasonIndexParameter()
{
- type = (IndexSeasonType)m_viewModel.Detail.Type,
- style = data.Id
+ Type = (IndexSeasonType)m_viewModel.Detail.Type,
+ Style = data.Id
}
});
}
private async void pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- if (pivot.SelectedIndex == 3 && (seasonReviewVM.Items == null || seasonReviewVM.Items.Count == 0))
+ if (pivot.SelectedIndex == 3 && (m_seasonReviewViewModel.Items == null || m_seasonReviewViewModel.Items.Count == 0))
{
- await seasonReviewVM.GetItems();
+ await m_seasonReviewViewModel.GetItems();
}
}
private void btnReviewLike_Click(object sender, RoutedEventArgs e)
{
- var item = (sender as HyperlinkButton).DataContext as SeasonShortReviewItemModel;
- seasonReviewVM.Like(item);
+ var item = (sender as HyperlinkButton).DataContext as SeasonShortReviewItemViewModel;
+ m_seasonReviewViewModel.Like(item);
}
private void btnReviewDislike_Click(object sender, RoutedEventArgs e)
{
- var item = (sender as HyperlinkButton).DataContext as SeasonShortReviewItemModel;
- seasonReviewVM.Dislike(item);
+ var item = (sender as HyperlinkButton).DataContext as SeasonShortReviewItemViewModel;
+ m_seasonReviewViewModel.Dislike(item);
}
private async void btnSendReview_Click(object sender, RoutedEventArgs e)
{
- if (seasonReviewVM == null || seasonReviewVM.MediaID == 0) return;
+ if (m_seasonReviewViewModel == null || m_seasonReviewViewModel.MediaID == 0) return;
if (!SettingService.Account.Logined && !await Notify.ShowLoginDialog())
{
Notify.ShowMessageToast("请先登录后再操作");
return;
}
- SendReviewDialog sendReviewDialog = new SendReviewDialog(seasonReviewVM.MediaID);
+ SendReviewDialog sendReviewDialog = new SendReviewDialog(m_seasonReviewViewModel.MediaID);
await sendReviewDialog.ShowAsync();
}
diff --git a/src/BiliLite.UWP/Pages/User/FavoriteDetailPage.xaml b/src/BiliLite.UWP/Pages/User/FavoriteDetailPage.xaml
index 782a2c04..9f7b6007 100644
--- a/src/BiliLite.UWP/Pages/User/FavoriteDetailPage.xaml
+++ b/src/BiliLite.UWP/Pages/User/FavoriteDetailPage.xaml
@@ -11,7 +11,7 @@
xmlns:fa="using:FontAwesome5"
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:convert="using:BiliLite.Converters"
- xmlns:model="using:BiliLite.Modules"
+ xmlns:favorites="using:BiliLite.Models.Common.Favorites"
Background="Transparent">
-
+
@@ -36,12 +36,12 @@
-->
-
+
-
- UP:
- 播放: 弹幕:
+
+ UP:
+ 播放: 弹幕:
@@ -57,37 +57,37 @@
-
- 创建者:,共个视频
+
+ 创建者:,共个视频
-
+
-
-
+
+
-
- 全选/反选
-
-
+
+ 全选/反选
+
+
-
+
-
-
+
加载更多
-
+
- 这里还什么都没有呢~
+ 这里还什么都没有呢~
-
+
diff --git a/src/BiliLite.UWP/Pages/User/FavoriteDetailPage.xaml.cs b/src/BiliLite.UWP/Pages/User/FavoriteDetailPage.xaml.cs
index 98f9bf52..da65a965 100644
--- a/src/BiliLite.UWP/Pages/User/FavoriteDetailPage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/User/FavoriteDetailPage.xaml.cs
@@ -1,7 +1,6 @@
using BiliLite.Dialogs;
using BiliLite.Extensions;
using BiliLite.Models.Common;
-using BiliLite.Modules;
using BiliLite.Services;
using System;
using System.Collections.Generic;
@@ -11,7 +10,10 @@
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Navigation;
+using BiliLite.Models.Common.Favorites;
using BiliLite.Models.Common.Video;
+using BiliLite.ViewModels.Favourites;
+using Microsoft.Extensions.DependencyInjection;
// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
@@ -27,25 +29,25 @@ public class FavoriteDetailArgs
///
public sealed partial class FavoriteDetailPage : BasePage, IRefreshablePage
{
- FavoriteDetailVM favoriteDetailVM;
+ private readonly FavoriteDetailViewModel m_viewModel;
public FavoriteDetailPage()
{
+ m_viewModel = App.ServiceProvider.GetRequiredService();
this.InitializeComponent();
Title = "收藏夹详情";
- favoriteDetailVM = new FavoriteDetailVM();
}
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
- if (e.NavigationMode == NavigationMode.New && favoriteDetailVM.FavoriteInfo == null)
+ if (e.NavigationMode == NavigationMode.New && m_viewModel.FavoriteInfo == null)
{
FavoriteDetailArgs args = e.Parameter as FavoriteDetailArgs;
- favoriteDetailVM.Id = args.Id;
- favoriteDetailVM.Type = args.Type;
- favoriteDetailVM.Page = 1;
- favoriteDetailVM.Keyword = "";
- await favoriteDetailVM.LoadFavoriteInfo();
+ m_viewModel.Id = args.Id;
+ m_viewModel.Type = args.Type;
+ m_viewModel.Page = 1;
+ m_viewModel.Keyword = "";
+ await m_viewModel.LoadFavoriteInfo();
}
}
@@ -67,8 +69,8 @@ private void FavoriteInfoVideoItemModelOpen(object sender, FavoriteInfoVideoItem
{
icon = Symbol.Play,
page = typeof(VideoDetailPage),
- title = item.title,
- parameters = item.id,
+ title = item.Title,
+ parameters = item.Id,
dontGoTo = dontGoTo
});
}
@@ -83,7 +85,7 @@ private void Video_ItemPressed(object sender, PointerRoutedEventArgs e)
private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
{
- favoriteDetailVM.Search(searchBox.Text);
+ m_viewModel.Search(searchBox.Text);
}
private void CheckBox_Checked(object sender, RoutedEventArgs e)
@@ -109,7 +111,7 @@ private async void btnDelete_Click(object sender, RoutedEventArgs e)
{
ls.Add(item);
}
- await favoriteDetailVM.Delete(ls);
+ await m_viewModel.Delete(ls);
}
}
@@ -122,9 +124,9 @@ private async void btnMove_Click(object sender, RoutedEventArgs e)
{
ls.Add(item);
}
- CopyOrMoveFavVideoDialog copyOrMoveFavVideoDialog = new CopyOrMoveFavVideoDialog(favoriteDetailVM.Id, favoriteDetailVM.FavoriteInfo.mid, true, ls);
+ CopyOrMoveFavVideoDialog copyOrMoveFavVideoDialog = new CopyOrMoveFavVideoDialog(m_viewModel.Id, m_viewModel.FavoriteInfo.Mid, true, ls);
await copyOrMoveFavVideoDialog.ShowAsync();
- favoriteDetailVM.Refresh();
+ m_viewModel.Refresh();
}
}
@@ -137,7 +139,7 @@ private async void btnCopy_Click(object sender, RoutedEventArgs e)
{
ls.Add(item);
}
- CopyOrMoveFavVideoDialog copyOrMoveFavVideoDialog = new CopyOrMoveFavVideoDialog(favoriteDetailVM.Id, favoriteDetailVM.FavoriteInfo.mid, false, ls);
+ CopyOrMoveFavVideoDialog copyOrMoveFavVideoDialog = new CopyOrMoveFavVideoDialog(m_viewModel.Id, m_viewModel.FavoriteInfo.Mid, false, ls);
await copyOrMoveFavVideoDialog.ShowAsync();
}
}
@@ -149,37 +151,37 @@ private async void btnClean_Click(object sender, RoutedEventArgs e)
return;
}
- await favoriteDetailVM.Clean();
+ await m_viewModel.Clean();
}
private void AddToWatchLater_Click(object sender, RoutedEventArgs e)
{
var data = (sender as MenuFlyoutItem).DataContext as FavoriteInfoVideoItemModel;
- Modules.User.WatchLaterVM.Instance.AddToWatchlater(data.id);
+ Modules.User.WatchLaterVM.Instance.AddToWatchlater(data.Id);
}
private async void PlayAll_Click(object sender, RoutedEventArgs e)
{
- if (favoriteDetailVM.ShowLoadMore)
+ if (m_viewModel.ShowLoadMore)
{
Notify.ShowMessageToast("正在读取全部视频,请稍后");
- while (favoriteDetailVM.ShowLoadMore)
+ while (m_viewModel.ShowLoadMore)
{
- await favoriteDetailVM.LoadFavoriteInfo();
+ await m_viewModel.LoadFavoriteInfo();
}
}
List items = new List();
- foreach (var item in favoriteDetailVM.Videos)
+ foreach (var item in m_viewModel.Videos)
{
- if (item.title != "已失效视频")
+ if (item.Title != "已失效视频")
{
items.Add(new VideoPlaylistItem()
{
- Cover = item.cover,
- Author = item.upper.name,
- Id = item.id,
- Title = item.title
+ Cover = item.Cover,
+ Author = item.Upper.Name,
+ Id = item.Id,
+ Title = item.Title
});
}
@@ -193,29 +195,29 @@ private async void PlayAll_Click(object sender, RoutedEventArgs e)
{
Index = 0,
Playlist = items,
- Title = $"收藏夹:{favoriteDetailVM.FavoriteInfo.title}"
+ Title = $"收藏夹:{m_viewModel.FavoriteInfo.Title}"
}
});
}
public async Task Refresh()
{
- favoriteDetailVM.Refresh();
+ m_viewModel.Refresh();
}
private async void FavItemGridView_OnDragItemsCompleted(ListViewBase sender, DragItemsCompletedEventArgs args)
{
var item = args.Items.FirstOrDefault();
if (!(item is FavoriteInfoVideoItemModel favVideo)) return;
- var endIndex = favoriteDetailVM.Videos.IndexOf(favVideo);
+ var endIndex = m_viewModel.Videos.IndexOf(favVideo);
var targetId = "";
if (endIndex != 0)
{
- var target = favoriteDetailVM.Videos[endIndex - 1];
- targetId = target.id;
+ var target = m_viewModel.Videos[endIndex - 1];
+ targetId = target.Id;
}
- await favoriteDetailVM.Sort(favVideo.id, targetId);
+ await m_viewModel.Sort(favVideo.Id, targetId);
}
}
}
diff --git a/src/BiliLite.UWP/Pages/UserInfoPage.xaml b/src/BiliLite.UWP/Pages/UserInfoPage.xaml
index c1bc0f41..ce265afb 100644
--- a/src/BiliLite.UWP/Pages/UserInfoPage.xaml
+++ b/src/BiliLite.UWP/Pages/UserInfoPage.xaml
@@ -564,12 +564,12 @@
-
+
LV
-
+
diff --git a/src/BiliLite.UWP/Pages/VideoDetailPage.xaml b/src/BiliLite.UWP/Pages/VideoDetailPage.xaml
index 4782835b..f423f9e8 100644
--- a/src/BiliLite.UWP/Pages/VideoDetailPage.xaml
+++ b/src/BiliLite.UWP/Pages/VideoDetailPage.xaml
@@ -44,6 +44,7 @@
+
diff --git a/src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs b/src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs
index 7dfefe91..b7029014 100644
--- a/src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs
@@ -449,14 +449,21 @@ private void PlayerControl_FullScreenEvent(object sender, bool e)
{
if (e)
{
- this.Margin = new Thickness(0, SettingService.GetValue(SettingConstants.UI.DISPLAY_MODE, 0) == 0 ? -48 : -48, 0, 0);
+ if (SettingService.GetValue(SettingConstants.UI.DISPLAY_MODE, 0) <= 0)
+ {
+ var marginOffset = SettingService.GetValue(SettingConstants.UI.TAB_HEIGHT,
+ SettingConstants.UI.DEFAULT_TAB_HEIGHT);
+ this.Margin = new Thickness(0, marginOffset * -1, 0, 0);
+ }
+
m_viewModel.DefaultRightInfoWidth = new GridLength(0, GridUnitType.Pixel);
BottomInfo.Height = new GridLength(0, GridUnitType.Pixel);
}
else
{
this.Margin = new Thickness(0);
- m_viewModel.DefaultRightInfoWidth = new GridLength(SettingService.GetValue(SettingConstants.UI.RIGHT_DETAIL_WIDTH, 320), GridUnitType.Pixel);
+ m_viewModel.DefaultRightInfoWidth = new GridLength(
+ SettingService.GetValue(SettingConstants.UI.RIGHT_DETAIL_WIDTH, 320), GridUnitType.Pixel);
BottomInfo.Height = GridLength.Auto;
}
}
@@ -746,5 +753,10 @@ private void Pivot_OnPreviewKeyDown(object sender, KeyRoutedEventArgs e)
e.OriginalSource.GetType() != typeof(TextBox))
e.Handled = true;
}
+
+ private void BtnCopyAvId_OnClick(object sender, RoutedEventArgs e)
+ {
+ ("av" + m_viewModel.VideoInfo.Aid).SetClipboard();
+ }
}
}
diff --git a/src/BiliLite.UWP/Services/AppHelper.cs b/src/BiliLite.UWP/Services/AppHelper.cs
index 300bdaea..034b62ac 100644
--- a/src/BiliLite.UWP/Services/AppHelper.cs
+++ b/src/BiliLite.UWP/Services/AppHelper.cs
@@ -7,6 +7,7 @@
using Windows.Storage;
using BiliLite.Extensions;
using BiliLite.Models.Common;
+using BiliLite.Models.Common.Home;
namespace BiliLite.Services
{
@@ -14,21 +15,21 @@ public static class AppHelper
{
private static readonly ILogger logger = GlobalLogger.FromCurrentType();
- public static List Regions { get; set; }
+ public static List Regions { get; set; }
private static RegionAPI regionAPI = new RegionAPI();
- public static async Task> GetDefaultRegions()
+ public static async Task> GetDefaultRegions()
{
try
{
var str = await FileIO.ReadTextAsync(
await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/Text/regions.json")));
- return JsonConvert.DeserializeObject>(str);
+ return JsonConvert.DeserializeObject>(str);
}
catch (Exception ex)
{
logger.Log("读取默认分区失败!" + ex.Message, LogType.Error, ex);
- return new List();
+ return new List();
}
}
@@ -42,11 +43,11 @@ public static async Task SetRegions()
var data = results.GetJObject();
if (data["code"].ToInt32() == 0)
{
- var ls = JsonConvert.DeserializeObject>(data["data"].ToString()
+ var ls = JsonConvert.DeserializeObject>(data["data"].ToString()
.Replace("goto", "_goto"));
foreach (var item in ls.Where(x =>
- string.IsNullOrEmpty(x.uri) || x.name == "会员购" || x.name == "漫画" ||
- x.name == "游戏中心" || x.name == "话题中心" || x.name == "音频" || x.name == "原创排行榜")
+ string.IsNullOrEmpty(x.Uri) || x.Name == "会员购" || x.Name == "漫画" ||
+ x.Name == "游戏中心" || x.Name == "话题中心" || x.Name == "音频" || x.Name == "原创排行榜")
.ToList())
{
ls.Remove(item);
diff --git a/src/BiliLite.UWP/Services/DownloadService.cs b/src/BiliLite.UWP/Services/DownloadService.cs
index ff1dbc86..5ff38a92 100644
--- a/src/BiliLite.UWP/Services/DownloadService.cs
+++ b/src/BiliLite.UWP/Services/DownloadService.cs
@@ -335,6 +335,30 @@ private async Task LoadDownloadFromIndex()
m_downloadPageViewModel.DownloadedViewModels = new ObservableCollection(downloadedItems);
}
+ private IEnumerable QueryDownloaded()
+ {
+ var query = m_downloadPageViewModel.Downloadeds.AsEnumerable();
+
+ // 提前处理搜索条件
+ var searchKeyword = m_downloadPageViewModel.SearchKeyword?.ToLower();
+ if (!string.IsNullOrEmpty(searchKeyword))
+ {
+ query = query.Where(x => x.Title.ToLower().Contains(searchKeyword));
+ }
+
+ // 使用 switch 表达式简化排序逻辑
+ query = m_downloadPageViewModel.DownloadedSortMode switch
+ {
+ DownloadedSortMode.TimeDesc => query.OrderByDescending(x => x.UpdateTime),
+ DownloadedSortMode.TimeAsc => query.OrderBy(x => x.UpdateTime),
+ DownloadedSortMode.TitleDesc => query.OrderByDescending(x => x.Title),
+ DownloadedSortMode.TitleAsc => query.OrderBy(x => x.Title),
+ _ => query // 默认不排序
+ };
+
+ return query;
+ }
+
#endregion
#region Public Methods
@@ -428,8 +452,10 @@ public void RefreshDownloaded()
public void SearchDownloaded(string keyword)
{
- var searchResult = m_downloadPageViewModel.Downloadeds
- .Where(x => x.Title.ToLower().Contains(keyword.ToLower())).ToList();
+ m_downloadPageViewModel.SearchKeyword = keyword;
+ m_downloadPageViewModel.IsSearching = !string.IsNullOrEmpty(keyword);
+
+ var searchResult = QueryDownloaded();
m_downloadPageViewModel.DownloadedViewModels.Clear();
m_downloadPageViewModel.DownloadedViewModels.AddRange(searchResult);
}
@@ -807,9 +833,16 @@ public void ClearIndex()
m_biliLiteDbContext.DownloadedItems.RemoveRange(m_biliLiteDbContext.DownloadedItems);
}
- #endregion
+ public void SetDownloadedSortMode(DownloadedSortMode mode)
+ {
+ m_downloadPageViewModel.DownloadedSortMode = mode;
+ m_downloadPageViewModel.DownloadedViewModels.Clear();
+ var query = QueryDownloaded();
+ m_downloadPageViewModel.DownloadedViewModels.AddRange(query);
+ }
+ #endregion
}
-}
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/Services/FrostMasterDanmakuController.cs b/src/BiliLite.UWP/Services/FrostMasterDanmakuController.cs
index d599e744..5339ac4d 100644
--- a/src/BiliLite.UWP/Services/FrostMasterDanmakuController.cs
+++ b/src/BiliLite.UWP/Services/FrostMasterDanmakuController.cs
@@ -6,7 +6,6 @@
using Windows.UI.Xaml.Controls;
using Atelier39;
using AutoMapper;
-using BiliLite.Models.Common;
using BiliLite.Models.Common.Danmaku;
using BiliLite.Services.Interfaces;
using BiliLite.ViewModels.Video;
@@ -115,23 +114,7 @@ public override void SetSpeed(int speed)
public override void SetTopMargin(double topMargin)
{
base.SetTopMargin(topMargin);
- if (SettingService.GetValue(SettingConstants.UI.DISPLAY_MODE, 0) > 0)
- {
- m_danmakuCanvas.Margin = DanmakuViewModel.Fullscreen ? new Thickness(0, DanmakuViewModel.MarginTop + 16, 0, 0) : new Thickness(0, DanmakuViewModel.MarginTop, 0, 0);
- }
- else
- {
- m_danmakuCanvas.Margin = new Thickness(0, topMargin, 0, 0);
- }
- }
-
- public override void SetFullscreen(bool fullscreen)
- {
- base.SetFullscreen(fullscreen);
- if (SettingService.GetValue(SettingConstants.UI.DISPLAY_MODE, 0) > 0)
- {
- m_danmakuCanvas.Margin = fullscreen ? new Thickness(0, DanmakuViewModel.MarginTop + 16, 0, 0) : new Thickness(0, DanmakuViewModel.MarginTop, 0, 0);
- }
+ m_danmakuCanvas.Margin = new Thickness(0, topMargin, 0, 0);
}
public override void SetOpacity(double opacity)
@@ -196,11 +179,5 @@ public override void UpdateTime(long position)
base.UpdateTime(position);
m_danmakuMaster.UpdateTime((uint)position * 1000);
}
-
- public void SetAssSubtitle(string assContent)
- {
- var subItems = AssParser.GetDanmakuList(assContent);
- m_danmakuMaster.SetSubtitleList(subItems);
- }
}
}
diff --git a/src/BiliLite.UWP/Services/Notification/LiveTileService.cs b/src/BiliLite.UWP/Services/Notification/LiveTileService.cs
new file mode 100644
index 00000000..149ba20b
--- /dev/null
+++ b/src/BiliLite.UWP/Services/Notification/LiveTileService.cs
@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+using System.IO;
+using System.Threading.Tasks;
+using BiliLite.Models.Common.Notifications;
+
+namespace BiliLite.Services.Notification
+{
+ public class LiveTileService
+ {
+ public List TileFurnace = new List();
+
+ public async Task RefreshTile()
+ {
+ TileFurnace.Clear();
+ // TODO: 取热门/动态/推荐数据
+ var sample = new NotificationTile()
+ {
+ Name = "BiliLIte",
+ Description = "",
+ Url = @"Assets/SplashScreen.png",
+ };
+ TileFurnace.Add(sample);
+ }
+ }
+}
diff --git a/src/BiliLite.UWP/Services/NsDanmakuController.cs b/src/BiliLite.UWP/Services/NsDanmakuController.cs
index bb72e099..615210e2 100644
--- a/src/BiliLite.UWP/Services/NsDanmakuController.cs
+++ b/src/BiliLite.UWP/Services/NsDanmakuController.cs
@@ -12,7 +12,6 @@
using BiliLite.ViewModels.Video;
using NSDanmaku.Controls;
using NSDanmaku.Model;
-using BiliLite.Models.Common;
namespace BiliLite.Services
{
@@ -112,23 +111,7 @@ public override void SetSpeed(int speed)
public override void SetTopMargin(double topMargin)
{
base.SetTopMargin(topMargin);
- if (SettingService.GetValue(SettingConstants.UI.DISPLAY_MODE, 0) > 0)
- {
- m_danmakuControl.Margin = DanmakuViewModel.Fullscreen ? new Thickness(0, DanmakuViewModel.MarginTop + 16, 0, 0) : new Thickness(0, DanmakuViewModel.MarginTop, 0, 0);
- }
- else
- {
- m_danmakuControl.Margin = new Thickness(0, topMargin, 0, 0);
- }
- }
-
- public override void SetFullscreen(bool fullscreen)
- {
- base.SetFullscreen(fullscreen);
- if (SettingService.GetValue(SettingConstants.UI.DISPLAY_MODE, 0) > 0)
- {
- m_danmakuControl.Margin = fullscreen ? new Thickness(0, DanmakuViewModel.MarginTop + 16, 0, 0) : new Thickness(0, DanmakuViewModel.MarginTop, 0, 0);
- }
+ m_danmakuControl.Margin = new Thickness(0, topMargin, 0, 0);
}
public override void SetOpacity(double opacity)
diff --git a/src/BiliLite.UWP/Services/ThemeService.cs b/src/BiliLite.UWP/Services/ThemeService.cs
new file mode 100644
index 00000000..c5a65a02
--- /dev/null
+++ b/src/BiliLite.UWP/Services/ThemeService.cs
@@ -0,0 +1,71 @@
+using BiliLite.Extensions;
+using BiliLite.Models.Common;
+using System.Linq;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+
+namespace BiliLite.Services
+{
+ public class ThemeService
+ {
+ private ResourceDictionary m_defaultColorsResource;
+ private ElementTheme m_theme;
+
+ public ThemeService()
+ {
+ m_theme = (ElementTheme)SettingService.GetValue(SettingConstants.UI.THEME, 0);
+ if (m_theme == ElementTheme.Default)
+ {
+ m_theme = (ElementTheme)(App.Current.RequestedTheme + 1);
+ }
+ }
+
+ public void Init() => m_defaultColorsResource = Application.Current.Resources.MergedDictionaries.FirstOrDefault(x => x.Source.AbsoluteUri.Contains("Default"));
+
+ public ResourceDictionary ThemeResource
+ {
+ get
+ {
+ if (m_theme == ElementTheme.Light) return m_defaultColorsResource.ThemeDictionaries["Light"] as ResourceDictionary;
+ return m_defaultColorsResource.ThemeDictionaries["Dark"] as ResourceDictionary;
+ }
+ }
+
+ public void InitTitleBar()
+ {
+ AppExtensions.HandleTitleTheme();
+ }
+
+ public void SetTheme(ElementTheme theme)
+ {
+ m_theme = theme;
+ SettingService.SetValue(SettingConstants.UI.THEME, (int)theme);
+ var rootFrame = Window.Current.Content as Frame;
+ switch (theme)
+ {
+ case ElementTheme.Light:
+ rootFrame.RequestedTheme = ElementTheme.Light;
+ break;
+ case ElementTheme.Dark:
+ rootFrame.RequestedTheme = ElementTheme.Dark;
+ break;
+ default:
+ rootFrame.RequestedTheme = ElementTheme.Default;
+ break;
+ }
+ InitTitleBar();
+ }
+
+ public void SetColor()
+ {
+ //case 3:
+ // // TODO: 切换自定义主题
+ // rootFrame.Resources = Application.Current.Resources.ThemeDictionaries["Pink"] as ResourceDictionary;
+ // break;
+ //case 4:
+ // // TODO: 切换自定义主题
+ // rootFrame.Resources = Application.Current.Resources.ThemeDictionaries["Blue"] as ResourceDictionary;
+ // break;
+ }
+ }
+}
diff --git a/src/BiliLite.UWP/Startup.cs b/src/BiliLite.UWP/Startup.cs
index 1745f0fa..69dc22c7 100644
--- a/src/BiliLite.UWP/Startup.cs
+++ b/src/BiliLite.UWP/Startup.cs
@@ -1,6 +1,7 @@
using BiliLite.Extensions;
using BiliLite.Services;
using BiliLite.Services.Biz;
+using BiliLite.Services.Notification;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@@ -15,6 +16,7 @@ public void ConfigureServices(HostBuilderContext context, IServiceCollection ser
services.AddSingleton();
services.AddTransient();
+ services.AddSingleton();
services.AddMapper();
services.AddViewModels();
services.AddControls();
@@ -32,6 +34,7 @@ public void ConfigureServices(HostBuilderContext context, IServiceCollection ser
services.AddSingleton();
services.AddSingleton();
+ services.AddSingleton();
}
}
}
diff --git a/src/BiliLite.UWP/Themes/Breakpoint.xaml b/src/BiliLite.UWP/Styles/Breakpoint.xaml
similarity index 100%
rename from src/BiliLite.UWP/Themes/Breakpoint.xaml
rename to src/BiliLite.UWP/Styles/Breakpoint.xaml
diff --git a/src/BiliLite.UWP/Themes/Converter.xaml b/src/BiliLite.UWP/Styles/Converter.xaml
similarity index 88%
rename from src/BiliLite.UWP/Themes/Converter.xaml
rename to src/BiliLite.UWP/Styles/Converter.xaml
index 49b1fe3c..e07280f5 100644
--- a/src/BiliLite.UWP/Themes/Converter.xaml
+++ b/src/BiliLite.UWP/Styles/Converter.xaml
@@ -8,4 +8,5 @@
+
diff --git a/src/BiliLite.UWP/Themes/Fonts.xaml b/src/BiliLite.UWP/Styles/Fonts.xaml
similarity index 100%
rename from src/BiliLite.UWP/Themes/Fonts.xaml
rename to src/BiliLite.UWP/Styles/Fonts.xaml
diff --git a/src/BiliLite.UWP/Styles/TabViewStyle.xaml b/src/BiliLite.UWP/Styles/TabViewStyle.xaml
index 2fdb4d6c..4abc4796 100644
--- a/src/BiliLite.UWP/Styles/TabViewStyle.xaml
+++ b/src/BiliLite.UWP/Styles/TabViewStyle.xaml
@@ -24,16 +24,10 @@
-
+
-
+
@@ -74,8 +68,8 @@
-
-
+
-
+
-
+
@@ -189,8 +183,7 @@
-
+
-
-
-
+
@@ -612,7 +600,6 @@
FontSize="10"
Glyph="" />
-
-
-
+
@@ -733,7 +723,6 @@
x:Name="ContentPresenter"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
- contract7NotPresent:CornerRadius="{ThemeResource ControlCornerRadius}"
AutomationProperties.AccessibilityView="Raw"
Background="{TemplateBinding Background}"
BackgroundSizing="{TemplateBinding BackgroundSizing}"
diff --git a/src/BiliLite.UWP/Themes/Blue.xaml b/src/BiliLite.UWP/Themes/Blue.xaml
new file mode 100644
index 00000000..20ffad4f
--- /dev/null
+++ b/src/BiliLite.UWP/Themes/Blue.xaml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+ #0092D0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BiliLite.UWP/Themes/Colors.xaml b/src/BiliLite.UWP/Themes/Colors.xaml
deleted file mode 100644
index bcc590b4..00000000
--- a/src/BiliLite.UWP/Themes/Colors.xaml
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
-
-
-
-
-
-
- #D14E65
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #D14E65
- #CC000000
- #0F000000
- #FFFFFFFF
- #CC000000
- #008ac5
- #989898
- Gray
- #f8f8f8
- #FF808080
-
-
- #FFF9F9F9
- #1A333333
- #1A333333
- #1A333333
-
-
-
-
-
-
-
-
-
-
-
- #D14E65
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #D14E65
- #CCFFFFFF
- #19000000
- #FFFFFFFF
- #CC000000
- #008ac5
- #989898
- Gray
- #2d2d2d
- #FF808080
-
-
- #FF282828
- #1ACFCFCF
- #1ACFCFCF
- #1ACFCFCF
-
-
-
-
-
-
-
-
diff --git a/src/BiliLite.UWP/Themes/Default.xaml b/src/BiliLite.UWP/Themes/Default.xaml
new file mode 100644
index 00000000..1c867c10
--- /dev/null
+++ b/src/BiliLite.UWP/Themes/Default.xaml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #CC000000
+ #0F000000
+ #FFFFFFFF
+ #CC000000
+ #008ac5
+ #989898
+ Gray
+ #f8f8f8
+ #FF808080
+
+
+ #FFF9F9F9
+ #1A333333
+ #1A333333
+ #1A333333
+
+
+
+
+
+ #CCFFFFFF
+ #19000000
+ #FFFFFFFF
+ #CC000000
+ #008ac5
+ #989898
+ Gray
+ #2d2d2d
+ #FF808080
+
+
+ #FF282828
+ #1ACFCFCF
+ #1ACFCFCF
+ #1ACFCFCF
+
+
+
+
+
+
+
diff --git a/src/BiliLite.UWP/Themes/Pink.xaml b/src/BiliLite.UWP/Themes/Pink.xaml
new file mode 100644
index 00000000..f6698c9d
--- /dev/null
+++ b/src/BiliLite.UWP/Themes/Pink.xaml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+ #D14E65
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BiliLite.UWP/ViewModels/Common/MainPageViewModel.cs b/src/BiliLite.UWP/ViewModels/Common/MainPageViewModel.cs
index 21741414..3a391917 100644
--- a/src/BiliLite.UWP/ViewModels/Common/MainPageViewModel.cs
+++ b/src/BiliLite.UWP/ViewModels/Common/MainPageViewModel.cs
@@ -32,5 +32,10 @@ public class MainPageViewModel : BaseViewModel
: SettingService.GetValue(
SettingConstants.UI.TAB_ITEM_MIN_WIDTH,
SettingConstants.UI.DEFAULT_TAB_ITEM_MIN_WIDTH);
+
+ [DoNotNotify]
+ public double TabHeight => SettingService.GetValue(
+ SettingConstants.UI.TAB_HEIGHT,
+ SettingConstants.UI.DEFAULT_TAB_HEIGHT);
}
}
diff --git a/src/BiliLite.UWP/ViewModels/Download/DownloadPageViewModel.cs b/src/BiliLite.UWP/ViewModels/Download/DownloadPageViewModel.cs
index 8888bf25..bd712b72 100644
--- a/src/BiliLite.UWP/ViewModels/Download/DownloadPageViewModel.cs
+++ b/src/BiliLite.UWP/ViewModels/Download/DownloadPageViewModel.cs
@@ -9,6 +9,7 @@
using System.Threading;
using Windows.Networking.BackgroundTransfer;
using AutoMapper;
+using BiliLite.Models.Common;
namespace BiliLite.ViewModels.Download
{
@@ -60,6 +61,8 @@ public DownloadPageViewModel(IMapper mapper)
[DoNotNotify]
public List Downloadeds { get; set; }
+ public bool IsSearching { get; set; }
+
public bool LoadingDownloaded { get; set; } = true;
public double DiskTotal { get; set; }
@@ -75,6 +78,12 @@ public DownloadPageViewModel(IMapper mapper)
[DependsOn(nameof(TotalDownloadedCount), nameof(LoadedDownloadedCount))]
public int LoadingDownloadedPercent => (int)((LoadedDownloadedCount * 1f / TotalDownloadedCount * 1f) * 100);
+ [DoNotNotify]
+ public DownloadedSortMode DownloadedSortMode { get; set; }
+
+ [DoNotNotify]
+ public string SearchKeyword { get; set; }
+
#endregion
}
}
diff --git a/src/BiliLite.UWP/ViewModels/Favourites/FavoriteDetailViewModel.cs b/src/BiliLite.UWP/ViewModels/Favourites/FavoriteDetailViewModel.cs
new file mode 100644
index 00000000..a54faa5c
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Favourites/FavoriteDetailViewModel.cs
@@ -0,0 +1,364 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Input;
+using Windows.UI.Xaml.Controls;
+using BiliLite.Extensions;
+using BiliLite.Models;
+using BiliLite.Models.Attributes;
+using BiliLite.Models.Common.Favorites;
+using BiliLite.Models.Exceptions;
+using BiliLite.Models.Requests.Api.User;
+using BiliLite.Modules;
+using BiliLite.Services;
+using BiliLite.ViewModels.Common;
+using PropertyChanged;
+
+namespace BiliLite.ViewModels.Favourites
+{
+ [RegisterTransientViewModel]
+ public class FavoriteDetailViewModel : BaseViewModel
+ {
+ #region Fields
+
+ private readonly FavoriteApi m_favoriteApi;
+ private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
+
+ #endregion
+
+ #region Constructors
+
+ public FavoriteDetailViewModel()
+ {
+ m_favoriteApi = new FavoriteApi();
+ RefreshCommand = new RelayCommand(Refresh);
+ LoadMoreCommand = new RelayCommand(LoadMore);
+ CollectCommand = new RelayCommand(DoCollect);
+ CancelCollectCommand = new RelayCommand(DoCancelCollect);
+ SelectCommand = new RelayCommand(SetSelectMode);
+ }
+
+ #endregion
+
+ #region Properties
+
+ [DoNotNotify]
+ public ICommand CollectCommand { get; private set; }
+
+ [DoNotNotify]
+ public ICommand CancelCollectCommand { get; private set; }
+
+ [DoNotNotify]
+ public ICommand RefreshCommand { get; private set; }
+
+ [DoNotNotify]
+ public ICommand LoadMoreCommand { get; private set; }
+
+ [DoNotNotify]
+ public ICommand SelectCommand { get; private set; }
+
+ [DoNotNotify]
+ public int Page { get; set; } = 1;
+
+ [DoNotNotify]
+ public string Keyword { get; set; } = "";
+
+ [DoNotNotify]
+ public string Id { get; set; }
+
+ [DoNotNotify]
+ public int Type { get; set; }
+
+ public bool Loading { get; set; }
+
+ public FavoriteInfoModel FavoriteInfo { get; set; }
+
+ public ObservableCollection Videos { get; set; }
+
+ public ListViewSelectionMode SelectionMode { get; set; } = ListViewSelectionMode.None;
+
+ public bool IsItemClickEnabled { get; set; } = true;
+
+ public bool Nothing { get; set; }
+
+ public bool ShowLoadMore { get; set; }
+
+ public bool IsSelf { get; set; }
+
+ public bool ShowCollect { get; set; }
+
+ public bool ShowCancelCollect { get; set; }
+
+ #endregion
+
+ #region Private Methods
+
+ private void SetSelectMode(object data)
+ {
+ if (data == null)
+ {
+ IsItemClickEnabled = true;
+ SelectionMode = ListViewSelectionMode.None;
+ }
+ else
+ {
+ IsItemClickEnabled = false;
+ SelectionMode = ListViewSelectionMode.Multiple;
+ }
+ }
+
+ private void LoadFavoriteInfoCore(ApiDataModel data)
+ {
+ if (Page == 1)
+ {
+ FavoriteInfo = data.data.Info;
+ IsSelf = FavoriteInfo.Mid == SettingService.Account.UserID.ToString();
+ if (!IsSelf)
+ {
+ ShowCollect = FavoriteInfo.FavState != 1;
+ ShowCancelCollect = !ShowCollect;
+ }
+
+ if (data.data.Medias == null || data.data.Medias.Count == 0)
+ {
+ Nothing = true;
+ return;
+ }
+
+ Videos = new ObservableCollection(data.data.Medias);
+ }
+ else
+ {
+ if (data.data.Medias != null)
+ {
+ foreach (var item in data.data.Medias)
+ {
+ Videos.Add(item);
+ }
+ }
+ }
+
+ if (Videos.Count != FavoriteInfo.MediaCount)
+ {
+ ShowLoadMore = true;
+ Page++;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ public async Task LoadFavoriteInfo()
+ {
+ try
+ {
+ ShowLoadMore = false;
+ Loading = true;
+ Nothing = false;
+ var api = m_favoriteApi.FavoriteInfo(Id, Keyword, Page);
+ if (Type == 21)
+ {
+ api = m_favoriteApi.FavoriteSeasonInfo(Id, Keyword, Page);
+ }
+ var results = await api.Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ LoadFavoriteInfoCore(data);
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ public async Task Delete(List items)
+ {
+ try
+ {
+ if (!SettingService.Account.Logined && !await Notify.ShowLoginDialog())
+ {
+ Notify.ShowMessageToast("请先登录后再操作");
+ return;
+ }
+ var results = await m_favoriteApi.Delete(Id, items.Select(x => x.Id).ToList()).Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetData();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ foreach (var item in items)
+ {
+ Videos.Remove(item);
+ }
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ }
+
+ public async Task Clean()
+ {
+ try
+ {
+ if (!SettingService.Account.Logined && !await Notify.ShowLoginDialog())
+ {
+ Notify.ShowMessageToast("请先登录后再操作");
+ return;
+ }
+ var results = await m_favoriteApi.Clean(Id).Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetData();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ Refresh();
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ }
+
+ public async void Refresh()
+ {
+ if (Loading)
+ {
+ return;
+ }
+ Page = 1;
+ FavoriteInfo = null;
+ Videos = null;
+ await LoadFavoriteInfo();
+ }
+
+ public async Task Sort(string sourceId, string targetId)
+ {
+ try
+ {
+ var result = await m_favoriteApi.SortResource(Id, sourceId, targetId).Request();
+ if (!result.status) throw new CustomizedErrorException("排序失败" + result.message);
+
+ var data = await result.GetData();
+ if (!data.success) throw new CustomizedErrorException("排序失败" + data.message);
+ Notify.ShowMessageToast("排序成功");
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ }
+
+ public async void LoadMore()
+ {
+ if (Loading)
+ {
+ return;
+ }
+ if (Videos == null || Videos.Count == 0)
+ {
+ return;
+ }
+ await LoadFavoriteInfo();
+ }
+
+ public async void Search(string keyword)
+ {
+ if (Loading)
+ {
+ return;
+ }
+ Keyword = keyword;
+ Page = 1;
+ FavoriteInfo = null;
+ Videos = null;
+ await LoadFavoriteInfo();
+ }
+
+ public async void DoCollect()
+ {
+ if (!SettingService.Account.Logined && !await Notify.ShowLoginDialog())
+ {
+ Notify.ShowMessageToast("请先登录后再操作");
+ return;
+ }
+ try
+ {
+ var results = await m_favoriteApi.CollectFavorite(FavoriteInfo.Id).Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ ShowCancelCollect = true;
+ ShowCollect = false;
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ }
+
+ public async void DoCancelCollect()
+ {
+ if (!SettingService.Account.Logined && !await Notify.ShowLoginDialog())
+ {
+ Notify.ShowMessageToast("请先登录后再操作");
+ return;
+ }
+ try
+ {
+ var results = await m_favoriteApi.CacnelCollectFavorite(FavoriteInfo.Id).Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ ShowCancelCollect = false;
+ ShowCollect = true;
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/src/BiliLite.UWP/ViewModels/Home/AnimePageViewModel.cs b/src/BiliLite.UWP/ViewModels/Home/AnimePageViewModel.cs
index 9ba73c3a..26cc24ac 100644
--- a/src/BiliLite.UWP/ViewModels/Home/AnimePageViewModel.cs
+++ b/src/BiliLite.UWP/ViewModels/Home/AnimePageViewModel.cs
@@ -11,6 +11,7 @@
using BiliLite.Models;
using BiliLite.Models.Common;
using BiliLite.Models.Common.Anime;
+using BiliLite.Models.Common.Season;
using BiliLite.Models.Requests.Api.Home;
using BiliLite.Models.Requests.Api.User;
using BiliLite.Modules;
@@ -108,8 +109,8 @@ public void SetAnimeType(AnimeType animeType)
title="索引",
parameters=new SeasonIndexParameter()
{
- type= IndexSeasonType.Anime,
- area=m_animeType== AnimeType.Bangumi?"-1":"1,6,7"
+ Type= IndexSeasonType.Anime,
+ Area=m_animeType== AnimeType.Bangumi?"-1":"1,6,7"
}
}
},
diff --git a/src/BiliLite.UWP/ViewModels/Home/CinemaHomeFallViewModel.cs b/src/BiliLite.UWP/ViewModels/Home/CinemaHomeFallViewModel.cs
new file mode 100644
index 00000000..08ed688c
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Home/CinemaHomeFallViewModel.cs
@@ -0,0 +1,21 @@
+using System.Collections.ObjectModel;
+using BiliLite.Models.Common.Home;
+using BiliLite.ViewModels.Common;
+using PropertyChanged;
+
+namespace BiliLite.ViewModels.Home
+{
+ public class CinemaHomeFallViewModel : BaseViewModel
+ {
+ [DoNotNotify]
+ public int Wid { get; set; }
+
+ [DoNotNotify]
+ public string Title { get; set; }
+
+ public bool ShowMore { get; set; } = true;
+
+ [DoNotNotify]
+ public ObservableCollection Items { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/ViewModels/Home/CinemaHomeViewModel.cs b/src/BiliLite.UWP/ViewModels/Home/CinemaHomeViewModel.cs
new file mode 100644
index 00000000..5a4dd288
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Home/CinemaHomeViewModel.cs
@@ -0,0 +1,34 @@
+using System.Collections.Generic;
+using BiliLite.Models.Common.Home;
+
+namespace BiliLite.ViewModels.Home
+{
+ public class CinemaHomeViewModel
+ {
+ public List Banners { get; set; }
+
+ public List Falls { get; set; }
+
+ public List Update { get; set; }
+
+ ///
+ /// 记录片 87
+ ///
+ public List Documentary { get; set; }
+
+ ///
+ /// 电影 88
+ ///
+ public List Movie { get; set; }
+
+ ///
+ /// 电视剧 89
+ ///
+ public List Tv { get; set; }
+
+ ///
+ /// 综艺 173
+ ///
+ public List Variety { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/ViewModels/Home/CinemaViewModel.cs b/src/BiliLite.UWP/ViewModels/Home/CinemaViewModel.cs
new file mode 100644
index 00000000..9d894cf8
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Home/CinemaViewModel.cs
@@ -0,0 +1,265 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using Windows.UI.Xaml.Controls;
+using AutoMapper;
+using BiliLite.Extensions;
+using BiliLite.Models;
+using BiliLite.Models.Attributes;
+using BiliLite.Models.Common;
+using BiliLite.Models.Common.Anime;
+using BiliLite.Models.Common.Home;
+using BiliLite.Models.Common.Season;
+using BiliLite.Models.Exceptions;
+using BiliLite.Models.Requests.Api.Home;
+using BiliLite.Models.Requests.Api.User;
+using BiliLite.Modules;
+using BiliLite.Pages.Bangumi;
+using BiliLite.Pages.User;
+using BiliLite.Services;
+using BiliLite.ViewModels.Common;
+using Newtonsoft.Json.Linq;
+
+namespace BiliLite.ViewModels.Home
+{
+ [RegisterTransientViewModel]
+ public class CinemaViewModel : BaseViewModel
+ {
+ #region Fields
+
+ private readonly FollowAPI m_followApi;
+ private readonly CinemaAPI m_cinemaApi;
+ private readonly IMapper m_mapper;
+ private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
+
+ #endregion
+
+ #region Constructors
+
+ public CinemaViewModel(IMapper mapper)
+ {
+ m_mapper = mapper;
+ m_cinemaApi = new CinemaAPI();
+ m_followApi = new FollowAPI();
+ Entrances = new List() {
+ new PageEntranceModel(){
+ Logo="ms-appx:///Assets/Icon/榜单.png",
+ Name="热门榜单",
+ NavigationInfo=new NavigationInfo(){
+ icon= Symbol.FourBars,
+ page=typeof(SeasonRankPage),
+ title="热门榜单",
+ parameters=2
+ }
+ },
+ new PageEntranceModel(){
+ Logo="ms-appx:///Assets/Icon/电影.png",
+ Name="电影索引",
+ NavigationInfo=new NavigationInfo(){
+ icon= Symbol.Filter,
+ page=typeof(AnimeIndexPage),
+ title="电影索引",
+ parameters=new SeasonIndexParameter()
+ {
+ Type= IndexSeasonType.Movie
+ }
+ }
+ },
+ new PageEntranceModel(){
+ Logo="ms-appx:///Assets/Icon/电视剧.png",
+ Name="电视剧索引",
+ NavigationInfo=new NavigationInfo(){
+ icon= Symbol.Filter,
+ page=typeof(AnimeIndexPage),
+ title="电视剧索引",
+ parameters=new SeasonIndexParameter()
+ {
+ Type= IndexSeasonType.TV
+ }
+ }
+ },
+ new PageEntranceModel(){
+ Logo="ms-appx:///Assets/Icon/纪录片.png",
+ Name="纪录片索引",
+ NavigationInfo=new NavigationInfo(){
+ icon= Symbol.Filter,
+ page=typeof(AnimeIndexPage),
+ title="纪录片索引",
+ parameters=new SeasonIndexParameter()
+ {
+ Type= IndexSeasonType.Documentary
+ }
+ }
+ },
+ new PageEntranceModel(){
+ Logo="ms-appx:///Assets/Icon/综艺.png",
+ Name="综艺索引",
+ NavigationInfo=new NavigationInfo(){
+ icon= Symbol.Filter,
+ page=typeof(AnimeIndexPage),
+ title="综艺索引",
+ parameters=new SeasonIndexParameter()
+ {
+ Type= IndexSeasonType.Variety
+ }
+ }
+ },
+ new PageEntranceModel(){
+ Logo="ms-appx:///Assets/Icon/我的.png",
+ Name="我的追剧",
+ NavigationInfo=new NavigationInfo(){
+ icon= Symbol.OutlineStar,
+ page=typeof(FavoritePage),
+ title="我的追剧",
+ parameters=OpenFavoriteType.Cinema
+ }
+ },
+ };
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool ShowFollows { get; set; }
+
+ public bool Loading { get; set; } = true;
+
+ public bool LoadingFollow { get; set; } = true;
+
+ public ObservableCollection Follows { get; set; }
+
+ public CinemaHomeViewModel HomeData { get; set; }
+
+ public List Entrances { get; set; }
+
+ #endregion
+
+ #region Public Methods
+
+ public async void SeasonItemClick(object sender, ItemClickEventArgs e)
+ {
+ var seasonId = e.ClickedItem.GetType().GetProperty(nameof(ISeasonItem.SeasonId)).GetValue(e.ClickedItem, null);
+ var title = e.ClickedItem.GetType().GetProperty(nameof(ISeasonItem.SeasonId))?.GetValue(e.ClickedItem, null) ?? "";
+ if (seasonId != null && seasonId.ToInt32() != 0)
+ {
+ MessageCenter.NavigateToPage(sender, new NavigationInfo()
+ {
+ icon = Symbol.Play,
+ page = typeof(Pages.SeasonDetailPage),
+ parameters = seasonId,
+ title = title.ToString()
+ });
+ }
+ else
+ {
+ var weblink = e.ClickedItem.GetType().GetProperty("link").GetValue(e.ClickedItem, null) ?? "";
+ var result = await MessageCenter.HandelUrl(weblink.ToString());
+ if (!result) Notify.ShowMessageToast("无法打开此链接");
+ }
+ }
+
+ public void LinkItemClick(object sender, ItemClickEventArgs e)
+ {
+ var weblink = e.ClickedItem.GetType().GetProperty("link").GetValue(e.ClickedItem, null);
+ var title = e.ClickedItem.GetType().GetProperty("title").GetValue(e.ClickedItem, null) ?? "";
+ MessageCenter.NavigateToPage(sender, new NavigationInfo()
+ {
+ icon = Symbol.World,
+ page = typeof(Pages.WebPage),
+ parameters = weblink,
+ title = title.ToString()
+ });
+ }
+
+ public async Task GetCinemaHome()
+ {
+ try
+ {
+ Loading = true;
+ var api = m_cinemaApi.CinemaHome();
+
+ var results = await api.Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ HomeData = m_mapper.Map(data.data);
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ public async Task GetFollows()
+ {
+ try
+ {
+ LoadingFollow = true;
+ var results = await m_followApi.MyFollowCinema().Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ Follows = await data.result["follow_list"].ToString()
+ .DeserializeJson>();
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ LoadingFollow = false;
+ }
+ }
+
+ public async Task GetFallMore(CinemaHomeFallViewModel animeFallViewModel)
+ {
+ try
+ {
+ animeFallViewModel.ShowMore = false;
+ var results = await m_cinemaApi.CinemaFallMore(animeFallViewModel.Wid, animeFallViewModel.Items.LastOrDefault().Cursor).Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>();
+ foreach (var item in data)
+ {
+ animeFallViewModel.Items.Add(item);
+ }
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError>(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ animeFallViewModel.ShowMore = true;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/src/BiliLite.UWP/ViewModels/Home/HotViewModel.cs b/src/BiliLite.UWP/ViewModels/Home/HotViewModel.cs
new file mode 100644
index 00000000..89f8fe74
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Home/HotViewModel.cs
@@ -0,0 +1,149 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Input;
+using BiliLite.Extensions;
+using BiliLite.Models.Attributes;
+using BiliLite.Models.Common.Home;
+using BiliLite.Models.Exceptions;
+using BiliLite.Models.Requests.Api.Home;
+using BiliLite.Modules;
+using BiliLite.Pages;
+using BiliLite.Services;
+using BiliLite.ViewModels.Common;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+namespace BiliLite.ViewModels.Home
+{
+ [RegisterTransientViewModel]
+ public class HotViewModel : BaseViewModel
+ {
+ #region Fields
+
+ private readonly HotAPI m_hotApi;
+ private readonly IMainPage m_mainPage;
+ private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
+
+ #endregion
+
+ #region Constructors
+
+ public HotViewModel(IMainPage mainPage)
+ {
+ m_mainPage = mainPage;
+ m_hotApi = new HotAPI();
+ RefreshCommand = new RelayCommand(Refresh);
+ LoadMoreCommand = new RelayCommand(LoadMore);
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool Loading { get; set; } = true;
+
+ public ObservableCollection HotItems { get; set; }
+
+ public List TopItems { get; set; }
+
+ public ICommand RefreshCommand { get; private set; }
+
+ public ICommand LoadMoreCommand { get; private set; }
+
+ #endregion
+
+ #region Private Methods
+
+ private void GetPopularCore(JObject data)
+ {
+ TopItems ??= JsonConvert.DeserializeObject>(data["config"]["top_items"]
+ .ToString());
+
+ var items =
+ JsonConvert.DeserializeObject>(data["data"]
+ .ToString());
+ for (var i = items.Count - 1; i >= 0; i--)
+ {
+ if (items[i].CardGoto != "av")
+ items.Remove(items[i]);
+ }
+
+ if (HotItems == null)
+ {
+ HotItems = items;
+ }
+ else
+ {
+ foreach (var item in items)
+ {
+ HotItems.Add(item);
+ }
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ public async Task GetPopular(string idx = "0", string lastParam = "")
+ {
+ try
+ {
+ Loading = true;
+
+ var results = await m_hotApi.Popular(idx, lastParam).Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = results.GetJObject();
+ if (data["code"].ToInt32() != 0) throw new CustomizedErrorException(data["message"].ToString());
+ GetPopularCore(data);
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error("获取热门数据失败", ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ public async void Refresh()
+ {
+ if (Loading)
+ {
+ return;
+ }
+ TopItems = null;
+ HotItems = null;
+ await GetPopular();
+ }
+
+ public async void LoadMore()
+ {
+ // 当前不在首页,不应继续加载
+ if (!(m_mainPage.CurrentPage is HomePage)) return;
+ if (Loading)
+ {
+ return;
+ }
+ if (HotItems == null || HotItems.Count == 0)
+ {
+ return;
+ }
+ var last = HotItems.LastOrDefault();
+ await GetPopular(last.Idx, last.Param);
+ }
+
+ #endregion
+
+ }
+}
diff --git a/src/BiliLite.UWP/ViewModels/Home/LiveViewModel.cs b/src/BiliLite.UWP/ViewModels/Home/LiveViewModel.cs
new file mode 100644
index 00000000..5f5b5523
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Home/LiveViewModel.cs
@@ -0,0 +1,134 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using BiliLite.Extensions;
+using BiliLite.Models;
+using BiliLite.Models.Attributes;
+using BiliLite.Models.Common.Home;
+using BiliLite.Models.Exceptions;
+using BiliLite.Models.Requests.Api.Home;
+using BiliLite.Modules.Live.LiveCenter;
+using BiliLite.Services;
+using BiliLite.ViewModels.Common;
+using Newtonsoft.Json.Linq;
+
+namespace BiliLite.ViewModels.Home
+{
+ [RegisterTransientViewModel]
+ public class LiveViewModel : BaseViewModel
+ {
+ #region Fields
+
+ private readonly LiveAPI m_liveApi;
+ private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
+
+ #endregion
+
+ #region Constructors
+
+ public LiveViewModel()
+ {
+ m_liveApi = new LiveAPI();
+ LiveAttentionVm = new LiveAttentionVM();
+ }
+
+ #endregion
+
+ #region Properties
+
+ public LiveAttentionVM LiveAttentionVm { get; private set; }
+
+ public bool ShowFollows { get; set; }
+
+ public bool Loading { get; set; }
+
+ public bool LoadingFollow { get; set; } = true;
+
+ public ObservableCollection Banners { get; set; }
+
+ public ObservableCollection Areas { get; set; }
+
+ //public ObservableCollection Follow { get; set; }
+
+ public List Items { get; set; }
+
+ #endregion
+
+ #region Public Methods
+
+ public async Task GetLiveHome()
+ {
+ try
+ {
+ Loading = true;
+ var api = m_liveApi.LiveHome();
+
+ var results = await api.Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ if (data.data["banner"].Any())
+ {
+ Banners = await data.data["banner"][0]["list"].ToString()
+ .DeserializeJson>();
+ }
+
+ if (data.data["area_entrance_v2"].Any())
+ {
+ Areas = await data.data["area_entrance_v2"][0]["list"].ToString()
+ .DeserializeJson>();
+ }
+
+ await GetLiveHomeItems();
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ public async Task GetLiveHomeItems()
+ {
+ try
+ {
+ Loading = true;
+ var api = m_liveApi.LiveHomeItems();
+ var results = await api.Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ var items = await data.data["room_list"].ToString().DeserializeJson>();
+
+ Items = items.Where(x => x.List != null && x.List.Count > 0).ToList();
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/src/BiliLite.UWP/ViewModels/Home/RegionViewModel.cs b/src/BiliLite.UWP/ViewModels/Home/RegionViewModel.cs
new file mode 100644
index 00000000..2cf84e6c
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Home/RegionViewModel.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using BiliLite.Extensions;
+using BiliLite.Models.Attributes;
+using BiliLite.Models.Common.Home;
+using BiliLite.Models.Requests.Api;
+using BiliLite.Services;
+using BiliLite.ViewModels.Common;
+
+namespace BiliLite.ViewModels.Home
+{
+ [RegisterTransientViewModel]
+ public class RegionViewModel : BaseViewModel
+ {
+ #region Fields
+
+ private readonly RegionAPI m_regionApi;
+
+ #endregion
+
+ #region Constructors
+
+ public RegionViewModel()
+ {
+ m_regionApi = new RegionAPI();
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool Loading { get; set; } = true;
+
+ public List Regions { get; set; }
+
+ #endregion
+
+ #region Public Methods
+
+ public async Task GetRegions()
+ {
+ try
+ {
+ Loading = true;
+ if (AppHelper.Regions == null || AppHelper.Regions.Count == 0)
+ {
+ await AppHelper.SetRegions();
+ }
+ Regions = AppHelper.Regions;
+ }
+ catch (Exception ex)
+ {
+ Regions = await AppHelper.GetDefaultRegions();
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs b/src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs
index eefb556e..4817e60d 100644
--- a/src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs
+++ b/src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs
@@ -1314,6 +1314,11 @@ public async Task JoinRedPocketLottery()
}
+ public void CheckClearMessages()
+ {
+ if (Messages.Count >= CleanCount) Messages.RemoveAt(0);
+ }
+
public void Dispose()
{
foreach (var item in LotteryDanmu)
diff --git a/src/BiliLite.UWP/ViewModels/Other/FindMoreViewModel.cs b/src/BiliLite.UWP/ViewModels/Other/FindMoreViewModel.cs
new file mode 100644
index 00000000..53391eb4
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Other/FindMoreViewModel.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using BiliLite.Extensions;
+using BiliLite.Models.Attributes;
+using BiliLite.Models.Common.Other;
+using BiliLite.Models.Requests.Api;
+using BiliLite.ViewModels.Common;
+
+namespace BiliLite.ViewModels.Other
+{
+ [RegisterTransientViewModel]
+ public class FindMoreViewModel : BaseViewModel
+ {
+ private readonly GitApi m_gitApi;
+
+ public FindMoreViewModel()
+ {
+ m_gitApi = new GitApi();
+ }
+
+ public bool Loading { get; set; } = true;
+
+ public List Items { get; set; }
+
+ public async void LoadEntrance()
+ {
+ try
+ {
+ Loading = true;
+ var results = await m_gitApi.FindMoreEntrance().Request();
+ if (results.status)
+ {
+ var data = await results.GetJson>();
+ await Task.Delay(2000);
+ Items = data;
+ }
+ else
+ {
+ Notify.ShowMessageToast(results.message);
+
+ }
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError (ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+ }
+}
diff --git a/src/BiliLite.UWP/ViewModels/Region/IRegionViewModel.cs b/src/BiliLite.UWP/ViewModels/Region/IRegionViewModel.cs
new file mode 100644
index 00000000..c634d596
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Region/IRegionViewModel.cs
@@ -0,0 +1,17 @@
+using System.Windows.Input;
+
+namespace BiliLite.ViewModels.Region
+{
+ public interface IRegionViewModel
+ {
+ ICommand RefreshCommand { get; set; }
+
+ ICommand LoadMoreCommand { get; set; }
+
+ int ID { get; set; }
+
+ string RegionName { get; set; }
+
+ bool Loading { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/ViewModels/Region/RegionDetailChildViewModel.cs b/src/BiliLite.UWP/ViewModels/Region/RegionDetailChildViewModel.cs
new file mode 100644
index 00000000..4885142b
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Region/RegionDetailChildViewModel.cs
@@ -0,0 +1,257 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Threading.Tasks;
+using System.Windows.Input;
+using BiliLite.Extensions;
+using BiliLite.Models;
+using BiliLite.Models.Common.Home;
+using BiliLite.Models.Common.Region;
+using BiliLite.Models.Requests.Api;
+using BiliLite.Modules;
+using BiliLite.ViewModels.Common;
+using BiliLite.ViewModels.Rank;
+using Newtonsoft.Json;
+using PropertyChanged;
+
+namespace BiliLite.ViewModels.Region
+{
+ public class RegionDetailChildViewModel : BaseViewModel, IRegionViewModel
+ {
+ #region Fields
+
+ private RegionChildrenItem m_region;
+ private readonly RegionAPI m_regionApi;
+ private RegionChildOrderModel m_selectOrder;
+ private RegionTagItemModel m_selectTag;
+ private string m_nextId = "";
+ private int m_page = 1;
+
+ #endregion
+
+ #region Constructors
+
+ public RegionDetailChildViewModel(RegionChildrenItem regionItem)
+ {
+ m_regionApi = new RegionAPI();
+ Orders = new List() {
+ //new RegionChildOrderModel("默认排序",""),
+ new RegionChildOrderModel("最新视频","senddate"),
+ new RegionChildOrderModel("最多播放","view"),
+ new RegionChildOrderModel("评论最多","reply"),
+ new RegionChildOrderModel("弹幕最多","danmaku"),
+ new RegionChildOrderModel("最多收藏","favorite")
+ };
+ SelectOrder = Orders[0];
+ m_region = regionItem;
+ ID = regionItem.Tid;
+ RegionName = regionItem.Name;
+ RefreshCommand = new RelayCommand(Refresh);
+ LoadMoreCommand = new RelayCommand(LoadMore);
+ }
+
+ #endregion
+
+ #region Properties
+
+ [DoNotNotify]
+ public ICommand RefreshCommand { get; set; }
+
+ [DoNotNotify]
+ public ICommand LoadMoreCommand { get; set; }
+
+ [DoNotNotify]
+ public string RegionName { get; set; }
+
+ [DoNotNotify]
+ public int ID { get; set; }
+
+ public bool Loading { get; set; }
+
+ public List Orders { get; set; }
+
+ [DoNotNotify]
+ public RegionChildOrderModel SelectOrder
+ {
+ get => m_selectOrder;
+ set
+ {
+ if (value != null)
+ {
+ m_selectOrder = value;
+ }
+ }
+ }
+
+ [DoNotNotify]
+ public RegionTagItemModel SelectTag
+ {
+ get => m_selectTag;
+ set
+ {
+ if (value != null)
+ {
+ m_selectTag = value;
+ }
+
+ }
+ }
+
+ public List Tasgs { get; set; }
+
+ public ObservableCollection Videos { get; set; }
+
+ #endregion
+
+ #region Public Methods
+
+ public async Task LoadHome()
+ {
+ try
+ {
+ Loading = true;
+ var api = m_regionApi.RegionChildDynamic(ID, (SelectTag == null) ? 0 : SelectTag.Tid);
+ if (m_nextId != "")
+ {
+ api = m_regionApi.RegionChildDynamic(ID, m_nextId, (SelectTag == null) ? 0 : SelectTag.Tid);
+ }
+
+ var results = await api.Request();
+ if (results.status)
+ {
+ var data = results.GetJObject();
+ if (data["code"].ToInt32() == 0)
+ {
+ var ls = JsonConvert.DeserializeObject>(data["data"]["new"].ToString());
+ if (m_nextId == "")
+ {
+ var tags = JsonConvert.DeserializeObject>(data["data"]["top_tag"]?.ToString() ?? "[]");
+ tags.Insert(0, new RegionTagItemModel()
+ {
+ Tid = 0,
+ Tname = "全部标签"
+ });
+ if (Tasgs == null || Tasgs.Count == 0)
+ {
+ Tasgs = tags;
+ SelectTag = Tasgs[0];
+ }
+
+ Videos = ls;
+ }
+ else
+ {
+ foreach (var item in ls)
+ {
+ Videos.Add(item);
+ }
+ }
+ m_nextId = data["data"]["cbottom"]?.ToString() ?? "";
+ }
+ else
+ {
+ Notify.ShowMessageToast(data["message"].ToString());
+ }
+ }
+ else
+ {
+ Notify.ShowMessageToast(results.message);
+
+ }
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError>>(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ public async Task LoadList()
+ {
+ try
+ {
+ Loading = true;
+ var api = m_regionApi.RegionChildList(ID, SelectOrder.Order, m_page, SelectTag.Tid);
+ var results = await api.Request();
+ if (results.status)
+ {
+ var data = results.GetJObject();
+ if (data["code"].ToInt32() == 0)
+ {
+ var ls = JsonConvert.DeserializeObject>(data["data"].ToString());
+ if (m_page == 1)
+ {
+ Videos = ls;
+ }
+ else
+ {
+ foreach (var item in ls)
+ {
+ Videos.Add(item);
+ }
+ }
+ m_page++;
+ }
+ else
+ {
+ Notify.ShowMessageToast(data["message"].ToString());
+ }
+ }
+ else
+ {
+ Notify.ShowMessageToast(results.message);
+
+ }
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError>>(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ public async void Refresh()
+ {
+ if (Loading)
+ {
+ return;
+ }
+ if (SelectOrder == null || SelectOrder.Order == "")
+ {
+ m_nextId = "";
+ await LoadHome();
+ }
+ else
+ {
+ m_page = 1;
+ await LoadList();
+ }
+
+ }
+ public async void LoadMore()
+ {
+ if (Loading)
+ {
+ return;
+ }
+ if (SelectOrder == null || SelectOrder.Order == "")
+ {
+ await LoadHome();
+ }
+ else
+ {
+ await LoadList();
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/ViewModels/Region/RegionDetailHomeViewModel.cs b/src/BiliLite.UWP/ViewModels/Region/RegionDetailHomeViewModel.cs
new file mode 100644
index 00000000..11646501
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Region/RegionDetailHomeViewModel.cs
@@ -0,0 +1,149 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Threading.Tasks;
+using System.Windows.Input;
+using BiliLite.Extensions;
+using BiliLite.Models;
+using BiliLite.Models.Common.Home;
+using BiliLite.Models.Common.Region;
+using BiliLite.Models.Exceptions;
+using BiliLite.Models.Requests.Api;
+using BiliLite.Modules;
+using BiliLite.Services;
+using BiliLite.ViewModels.Common;
+using BiliLite.ViewModels.Rank;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using PropertyChanged;
+
+namespace BiliLite.ViewModels.Region
+{
+ public class RegionDetailHomeViewModel : BaseViewModel, IRegionViewModel
+ {
+ #region Fields
+
+ private readonly RegionAPI m_regionApi;
+ private RegionItem m_region;
+ private string m_nextId = "";
+ private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
+
+ #endregion
+
+ #region Constructors
+
+ public RegionDetailHomeViewModel(RegionItem regionItem)
+ {
+ m_regionApi = new RegionAPI();
+ m_region = regionItem;
+ ID = regionItem.Tid;
+ //RegionName = regionItem.name;
+ RefreshCommand = new RelayCommand(Refresh);
+ LoadMoreCommand = new RelayCommand(LoadMore);
+ }
+
+ #endregion
+
+ #region Properties
+
+ [DoNotNotify]
+ public ICommand RefreshCommand { get; set; }
+
+ [DoNotNotify]
+ public ICommand LoadMoreCommand { get; set; }
+
+ [DoNotNotify]
+ public int ID { get; set; }
+
+ [DoNotNotify]
+ public string RegionName { get; set; } = "推荐";
+
+ public bool Loading { get; set; }
+
+ public List Banners { get; set; }
+
+ public ObservableCollection Videos { get; set; }
+
+ #endregion
+
+ #region Private Methods
+
+ private void LoadHomeCore(JObject data)
+ {
+ if (data["code"].ToInt32() != 0) throw new CustomizedErrorException(data["message"].ToString());
+ var ls = JsonConvert.DeserializeObject>(
+ data["data"]["new"].ToString());
+ if (m_nextId == "")
+ {
+ var recommend =
+ JsonConvert.DeserializeObject>(
+ data["data"]["recommend"]?.ToString() ?? "[]");
+ foreach (var item in recommend)
+ {
+ ls.Insert(0, item);
+ }
+
+ Banners = JsonConvert.DeserializeObject>(
+ data["data"]["banner"]["top"].ToString());
+ Videos = ls;
+ }
+ else
+ {
+ foreach (var item in ls)
+ {
+ Videos.Add(item);
+ }
+ }
+
+ m_nextId = data["data"]["cbottom"].ToString();
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ public async Task LoadHome()
+ {
+ try
+ {
+ Loading = true;
+ var api = m_regionApi.RegionDynamic(ID);
+ if (m_nextId != "")
+ {
+ api = m_regionApi.RegionDynamic(ID, m_nextId);
+ }
+ var results = await api.Request();
+
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = results.GetJObject();
+ LoadHomeCore(data);
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError>>(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ public async void Refresh()
+ {
+ m_nextId = "";
+ await LoadHome();
+ }
+ public async void LoadMore()
+ {
+ await LoadHome();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/ViewModels/Region/RegionDetailViewModel.cs b/src/BiliLite.UWP/ViewModels/Region/RegionDetailViewModel.cs
new file mode 100644
index 00000000..3596fb70
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Region/RegionDetailViewModel.cs
@@ -0,0 +1,41 @@
+using System.Collections.ObjectModel;
+using System.Linq;
+using BiliLite.Models.Attributes;
+using BiliLite.Services;
+using BiliLite.ViewModels.Common;
+
+namespace BiliLite.ViewModels.Region
+{
+ [RegisterTransientViewModel]
+ public class RegionDetailViewModel : BaseViewModel
+ {
+ public RegionDetailViewModel()
+ {
+
+ }
+
+ public ObservableCollection Regions { get; set; }
+
+ public IRegionViewModel SelectRegion { get; set; }
+
+ public void InitRegion(int id, int tid)
+ {
+ var ls = new ObservableCollection();
+ var region = AppHelper.Regions.FirstOrDefault(x => x.Tid == id);
+ ls.Add(new RegionDetailHomeViewModel(region));
+ Regions = ls;
+ foreach (var item in region.Children)
+ {
+ ls.Add(new RegionDetailChildViewModel(item));
+ }
+ if (tid == 0)
+ {
+ SelectRegion = Regions[0];
+ }
+ else
+ {
+ SelectRegion = Regions.FirstOrDefault(x => x.ID == tid);
+ }
+ }
+ }
+}
diff --git a/src/BiliLite.UWP/ViewModels/Search/SearchVideoViewModel.cs b/src/BiliLite.UWP/ViewModels/Search/SearchVideoViewModel.cs
index b7dfda72..a60fb0bb 100644
--- a/src/BiliLite.UWP/ViewModels/Search/SearchVideoViewModel.cs
+++ b/src/BiliLite.UWP/ViewModels/Search/SearchVideoViewModel.cs
@@ -48,9 +48,9 @@ public SearchVideoViewModel()
RegionFilters = new List() {
new SearchFilterItem("全部分区","0"),
};
- foreach (var item in AppHelper.Regions.Where(x => x.children != null && x.children.Count != 0))
+ foreach (var item in AppHelper.Regions.Where(x => x.Children != null && x.Children.Count != 0))
{
- RegionFilters.Add(new SearchFilterItem(item.name, item.tid.ToString()));
+ RegionFilters.Add(new SearchFilterItem(item.Name, item.Tid.ToString()));
}
SelectRegion = RegionFilters[0];
}
diff --git a/src/BiliLite.UWP/ViewModels/Season/AnimeTimelineViewModel.cs b/src/BiliLite.UWP/ViewModels/Season/AnimeTimelineViewModel.cs
new file mode 100644
index 00000000..669436c7
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Season/AnimeTimelineViewModel.cs
@@ -0,0 +1,107 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using BiliLite.Extensions;
+using BiliLite.Models;
+using BiliLite.Models.Attributes;
+using BiliLite.Models.Common;
+using BiliLite.Models.Common.Anime;
+using BiliLite.Models.Exceptions;
+using BiliLite.Models.Requests.Api.Home;
+using BiliLite.Services;
+using BiliLite.ViewModels.Common;
+using PropertyChanged;
+
+namespace BiliLite.ViewModels.Season
+{
+ [RegisterTransientViewModel]
+ public class AnimeTimelineViewModel : BaseViewModel
+ {
+ #region Fields
+
+ private readonly AnimeAPI m_animeApi;
+ private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
+
+ #endregion
+
+ #region Constructors
+
+ public AnimeTimelineViewModel()
+ {
+ m_animeApi = new AnimeAPI();
+ AnimeTypeItems = new List()
+ {
+ new AnimeTypeItem()
+ {
+ Name="番剧",
+ AnimeType= AnimeType.Bangumi
+ },
+ new AnimeTypeItem()
+ {
+ Name="国创",
+ AnimeType= AnimeType.GuoChuang
+ }
+ };
+ }
+
+ #endregion
+
+ #region Properties
+
+ [DoNotNotify]
+ public AnimeType AnimeType { get; set; }
+
+ public bool Loading { get; set; } = true;
+
+ public List AnimeTypeItems { get; set; }
+
+ public AnimeTypeItem SelectAnimeType { get; set; }
+
+ public AnimeTimelineModel Today { get; set; }
+
+ public List Timelines { get; set; }
+
+ #endregion
+
+ #region Public Methods
+
+ public void Init(AnimeType type)
+ {
+ SelectAnimeType = AnimeTypeItems.FirstOrDefault(x => x.AnimeType == type);
+ AnimeType = type;
+ }
+
+ public async Task GetTimeline()
+ {
+ try
+ {
+ Loading = true;
+ var api = m_animeApi.Timeline((int)AnimeType);
+
+ var results = await api.Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>>();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ Timelines = data.data;
+ Today = data.data.FirstOrDefault(x => x.IsToday);
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/src/BiliLite.UWP/ViewModels/Season/SeasonDetailPageViewModel.cs b/src/BiliLite.UWP/ViewModels/Season/SeasonDetailPageViewModel.cs
index 4bd0df62..5b916bb3 100644
--- a/src/BiliLite.UWP/ViewModels/Season/SeasonDetailPageViewModel.cs
+++ b/src/BiliLite.UWP/ViewModels/Season/SeasonDetailPageViewModel.cs
@@ -3,6 +3,7 @@
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Input;
+using Windows.UI;
using Windows.UI.Xaml;
using AutoMapper;
using BiliLite.Extensions;
@@ -18,9 +19,12 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PropertyChanged;
+using Windows.UI.Xaml.Media;
+using BiliLite.Models.Attributes;
namespace BiliLite.ViewModels.Season
{
+ [RegisterTransientViewModel]
public class SeasonDetailPageViewModel : BaseViewModel
{
#region Fields
@@ -30,13 +34,15 @@ public class SeasonDetailPageViewModel : BaseViewModel
private readonly FollowAPI m_followApi;
private readonly IMapper m_mapper;
private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
+ private readonly ThemeService m_themeService;
#endregion
#region Constructors
public SeasonDetailPageViewModel()
{
- m_mapper = App.ServiceProvider.GetService();
+ m_mapper = App.ServiceProvider.GetRequiredService();
+ m_themeService = App.ServiceProvider.GetRequiredService();
m_seasonApi = new SeasonApi();
m_playerApi = new PlayerAPI();
m_followApi = new FollowAPI();
@@ -116,6 +122,19 @@ public GridLength RightInfoWidth
}
}
+ [DependsOn(nameof(PageHeight), nameof(PageWidth))]
+ public Brush RightInfoBackground
+ {
+ get
+ {
+ if (PageWidth < 1000)
+ {
+ return (Brush)m_themeService.ThemeResource["PlayerControlAcrylicBrush"];
+ }
+ return new SolidColorBrush(Colors.Transparent);
+ }
+ }
+
[DependsOn(nameof(PageHeight), nameof(PageWidth))]
public double RightInfoHeight
{
diff --git a/src/BiliLite.UWP/ViewModels/Season/SeasonIndexViewModel.cs b/src/BiliLite.UWP/ViewModels/Season/SeasonIndexViewModel.cs
new file mode 100644
index 00000000..e5e09b3b
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Season/SeasonIndexViewModel.cs
@@ -0,0 +1,244 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Input;
+using BiliLite.Extensions;
+using BiliLite.Models.Attributes;
+using BiliLite.Models.Common.Season;
+using BiliLite.Models.Exceptions;
+using BiliLite.Models.Requests.Api;
+using BiliLite.Modules;
+using BiliLite.Services;
+using BiliLite.ViewModels.Common;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using PropertyChanged;
+
+namespace BiliLite.ViewModels.Season
+{
+ [RegisterTransientViewModel]
+ public class SeasonIndexViewModel : BaseViewModel
+ {
+ #region Fields
+
+ private readonly SeasonIndexAPI m_seasonIndexApi;
+ private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
+ private bool m_canLoadMore = true;
+
+ #endregion
+
+ #region Constructors
+
+ public SeasonIndexViewModel()
+ {
+ m_seasonIndexApi = new SeasonIndexAPI();
+ RefreshCommand = new RelayCommand(Refresh);
+ LoadMoreCommand = new RelayCommand(LoadMore);
+ }
+
+ #endregion
+
+ #region Properties
+
+ [DoNotNotify]
+ public ICommand RefreshCommand { get; private set; }
+
+ [DoNotNotify]
+ public ICommand LoadMoreCommand { get; private set; }
+
+ [DoNotNotify]
+ public SeasonIndexParameter Parameter { get; set; }
+
+ public bool Loading { get; set; } = true;
+
+ public bool ConditionsLoading { get; set; } = true;
+
+ public ObservableCollection Conditions { get; set; }
+
+ public ObservableCollection Result { get; set; }
+
+ public int Page { get; set; }
+
+ #endregion
+
+ #region Private Methods
+
+ private void LoadConditionsCore(JObject data)
+ {
+ var items =
+ JsonConvert.DeserializeObject>(
+ data["data"]["filter"].ToString());
+ foreach (var item in items)
+ {
+ item.Current = item.Field switch
+ {
+ "style_id" => item.Values.FirstOrDefault(x => x.Keyword == Parameter.Style),
+ "area" => item.Values.FirstOrDefault(x => x.Keyword == Parameter.Area),
+ "pub_date" => item.Values.FirstOrDefault(x => x.Keyword == Parameter.Year),
+ "season_month" => item.Values.FirstOrDefault(x => x.Keyword == Parameter.Month),
+ _ => item.Values.FirstOrDefault()
+ };
+ }
+
+ var orders = new List();
+
+ foreach (var item in data["data"]["order"])
+ {
+ orders.Add(new SeasonIndexConditionFilterItemModel()
+ {
+ Keyword = item["field"].ToString(),
+ Name = item["name"].ToString()
+ });
+ }
+
+ items.Insert(0, new SeasonIndexConditionFilterModel()
+ {
+ Name = "排序",
+ Values = orders,
+ Field = "order",
+ Current = orders.FirstOrDefault(x => x.Name == Parameter.Order) ?? orders[0],
+ });
+ Conditions = items;
+ }
+
+ private void LoadResultCore(List items)
+ {
+ if (items != null && items.Count != 0)
+ {
+ if (Page == 1)
+ {
+ Result = new ObservableCollection(items);
+ }
+ else
+ {
+ foreach (var item in items)
+ {
+ Result.Add(item);
+ }
+ }
+
+ Page++;
+ }
+ else
+ {
+ m_canLoadMore = false;
+ Notify.ShowMessageToast("加载完了");
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ public async Task LoadConditions()
+ {
+ try
+ {
+ ConditionsLoading = true;
+ var results = await m_seasonIndexApi.Condition((int)Parameter.Type).Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = results.GetJObject();
+ if (data["code"].ToInt32() != 0) throw new CustomizedErrorException(data["message"].ToString());
+ LoadConditionsCore(data);
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ ConditionsLoading = false;
+ }
+ }
+
+ public async Task LoadResult()
+ {
+ try
+ {
+ if (Loading) return;
+
+ if (Page == 1)
+ {
+ m_canLoadMore = true;
+ Result = null;
+ }
+ else
+ {
+ if (!m_canLoadMore)
+ {
+ Loading = false;
+ return;
+ }
+ }
+ Loading = true;
+ var con = "";
+ foreach (var item in Conditions)
+ {
+ con += $"&{item.Field}={Uri.EscapeDataString(item.Current.Keyword)}";
+ }
+ con += $"&sort=0";
+ var results = await m_seasonIndexApi.Result(Page, (int)Parameter.Type, con).Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = results.GetJObject();
+ if (data["code"].ToInt32() != 0) throw new CustomizedErrorException(data["message"].ToString());
+ var items = JsonConvert.DeserializeObject>(
+ data["data"]["list"]?.ToString() ?? "[]");
+ LoadResultCore(items);
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ public async void Refresh()
+ {
+ if (Loading)
+ {
+ return;
+ }
+ Page = 1;
+ if (Conditions == null)
+ {
+ await LoadConditions();
+ }
+ if (Conditions != null)
+ {
+ await LoadResult();
+ }
+ }
+
+ public async void LoadMore()
+ {
+ if (Loading)
+ {
+ return;
+ }
+ if (Conditions == null || Conditions.Count == 0 || Result == null || Result.Count == 0)
+ {
+ return;
+ }
+ await LoadResult();
+ }
+
+ #endregion
+ }
+}
diff --git a/src/BiliLite.UWP/ViewModels/Season/SeasonRankDataViewModel.cs b/src/BiliLite.UWP/ViewModels/Season/SeasonRankDataViewModel.cs
new file mode 100644
index 00000000..1aebac2c
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Season/SeasonRankDataViewModel.cs
@@ -0,0 +1,17 @@
+using System.Collections.Generic;
+using BiliLite.Models.Common.Season;
+using BiliLite.ViewModels.Common;
+using PropertyChanged;
+
+namespace BiliLite.ViewModels.Season;
+
+public class SeasonRankDataViewModel : BaseViewModel
+{
+ [DoNotNotify]
+ public string Name { get; set; }
+
+ [DoNotNotify]
+ public int Type { get; set; }
+
+ public List Items { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/ViewModels/Season/SeasonRankViewModel.cs b/src/BiliLite.UWP/ViewModels/Season/SeasonRankViewModel.cs
new file mode 100644
index 00000000..e0c09369
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Season/SeasonRankViewModel.cs
@@ -0,0 +1,116 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using BiliLite.Extensions;
+using BiliLite.Models;
+using BiliLite.Models.Attributes;
+using BiliLite.Models.Common.Season;
+using BiliLite.Models.Exceptions;
+using BiliLite.Models.Requests.Api;
+using BiliLite.Services;
+using BiliLite.ViewModels.Common;
+using Newtonsoft.Json.Linq;
+
+namespace BiliLite.ViewModels.Season
+{
+ [RegisterTransientViewModel]
+ public class SeasonRankViewModel : BaseViewModel
+ {
+ #region Fields
+
+ private readonly RankAPI m_rankApi;
+ private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
+
+ #endregion
+
+ #region Constructors
+
+ public SeasonRankViewModel()
+ {
+ m_rankApi = new RankAPI();
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool Loading { get; set; } = true;
+
+ public SeasonRankDataViewModel Current { get; set; }
+
+ public List RegionItems { get; set; }
+
+ #endregion
+
+ #region Public Methods
+
+ public void LoadRankRegion(int type = 1)
+ {
+ RegionItems = new List()
+ {
+ new SeasonRankDataViewModel()
+ {
+ Name="热门番剧",
+ Type=1
+ },
+ new SeasonRankDataViewModel()
+ {
+ Name="热门国创",
+ Type=4
+ },
+ new SeasonRankDataViewModel()
+ {
+ Name="热门电影",
+ Type=2
+ },
+ new SeasonRankDataViewModel()
+ {
+ Name="热门纪录片",
+ Type=3
+ },
+ new SeasonRankDataViewModel()
+ {
+ Name="热门电视剧",
+ Type=5
+ },
+ new SeasonRankDataViewModel()
+ {
+ Name="热门综艺",
+ Type=7
+ },
+ };
+ Current = RegionItems.FirstOrDefault(x => x.Type.Equals(type));
+ }
+
+ public async Task LoadRankDetail(SeasonRankDataViewModel region)
+ {
+ try
+ {
+ Loading = true;
+ var results = await m_rankApi.SeasonRank(region.Type).Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ var result = await data.data["list"].ToString().DeserializeJson>();
+ region.Items = result;
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/src/BiliLite.UWP/ViewModels/Season/SeasonReviewViewModel.cs b/src/BiliLite.UWP/ViewModels/Season/SeasonReviewViewModel.cs
new file mode 100644
index 00000000..7dcfc642
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Season/SeasonReviewViewModel.cs
@@ -0,0 +1,239 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Threading.Tasks;
+using System.Windows.Input;
+using AutoMapper;
+using BiliLite.Extensions;
+using BiliLite.Models;
+using BiliLite.Models.Attributes;
+using BiliLite.Models.Common.Season;
+using BiliLite.Models.Exceptions;
+using BiliLite.Models.Requests.Api;
+using BiliLite.Modules;
+using BiliLite.Services;
+using BiliLite.ViewModels.Common;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using PropertyChanged;
+
+namespace BiliLite.ViewModels.Season
+{
+ [RegisterTransientViewModel]
+ public class SeasonReviewViewModel : BaseViewModel
+ {
+ #region Fields
+
+ readonly SeasonApi m_seasonApi;
+ private readonly IMapper m_mapper;
+ private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
+
+ #endregion
+
+ #region Constructors
+
+ public SeasonReviewViewModel(IMapper mapper)
+ {
+ m_mapper = mapper;
+ Items = new ObservableCollection();
+ m_seasonApi = new SeasonApi();
+ RefreshCommand = new RelayCommand(Refresh);
+ LoadMoreCommand = new RelayCommand(LoadMore);
+ }
+
+ #endregion
+
+ #region Properties
+
+ [DoNotNotify]
+ public ICommand RefreshCommand { get; private set; }
+
+ [DoNotNotify]
+ public ICommand LoadMoreCommand { get; private set; }
+
+ [DoNotNotify]
+ public ObservableCollection Items { get; set; }
+
+ [DoNotNotify]
+ public int MediaID { get; set; }
+
+ public bool Loading { get; set; }
+
+ public bool CanLoadMore { get; set; }
+
+ [DoNotNotify]
+ public string Next { get; set; } = "";
+
+ #endregion
+
+ #region Private Methods
+
+ private void GetItemsCore(JObject data)
+ {
+ var items = JsonConvert.DeserializeObject>(data["data"]["list"]
+ .ToString());
+ if (items == null) return;
+ var dataItems = m_mapper.Map>(items);
+ Items.AddRange(dataItems);
+ //Items = new IncrementalLoadingCollection(new LiveRecommendItemSource(items, SortType), 30);
+ if (Items.Count >= data["data"]["total"].ToInt32()) return;
+ Next = data["data"]["next"].ToString();
+ CanLoadMore = true;
+ }
+
+ private void LikeCore(SeasonShortReviewItemViewModel item, ApiDataModel data)
+ {
+ item.Stat.Liked = data.data["status"].ToInt32();
+ if (item.Stat.Liked == 1)
+ {
+ item.Stat.Likes += 1;
+ }
+ else
+ {
+ item.Stat.Likes -= 1;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ public async Task GetItems()
+ {
+ try
+ {
+ if (MediaID == 0) { return; }
+ Loading = true;
+ CanLoadMore = false;
+ var results = await m_seasonApi.ShortReview(MediaID, Next).Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = results.GetJObject();
+ if (data["code"].ToInt32() != 0) throw new CustomizedErrorException(data["message"].ToString());
+ GetItemsCore(data);
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ finally
+ {
+ Loading = false;
+ }
+ }
+
+ public async void Refresh()
+ {
+ if (Loading)
+ {
+ return;
+ }
+ Items.Clear();
+ Next = "";
+ await GetItems();
+ }
+ public async void LoadMore()
+ {
+ if (Loading)
+ {
+ return;
+ }
+ await GetItems();
+ }
+
+ public async void Like(SeasonShortReviewItemViewModel item)
+ {
+ if (!SettingService.Account.Logined && !await Notify.ShowLoginDialog())
+ {
+ Notify.ShowMessageToast("请先登录后再操作");
+ return;
+ }
+ try
+ {
+ var api = m_seasonApi.LikeReview(MediaID, item.ReviewId, ReviewType.Short);
+ var results = await api.Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ LikeCore(item, data);
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+ }
+
+ public async void Dislike(SeasonShortReviewItemViewModel item)
+ {
+ if (!SettingService.Account.Logined && !await Notify.ShowLoginDialog())
+ {
+ Notify.ShowMessageToast("请先登录后再操作");
+ return;
+ }
+ try
+ {
+ var api = m_seasonApi.DislikeReview(MediaID, item.ReviewId, ReviewType.Short);
+ var results = await api.Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ item.Stat.Disliked = data.data["status"].ToInt32();
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ }
+
+ }
+
+ public async Task SendShortReview(string content, bool share, int score)
+ {
+ if (!SettingService.Account.Logined && !await Notify.ShowLoginDialog())
+ {
+ Notify.ShowMessageToast("请先登录后再操作");
+ return false;
+ }
+ try
+ {
+ var api = m_seasonApi.SendShortReview(MediaID, content, share, score);
+ var results = await api.Request();
+ if (!results.status) throw new CustomizedErrorException(results.message);
+ var data = await results.GetJson>();
+ if (!data.success) throw new CustomizedErrorException(data.message);
+ Notify.ShowMessageToast("发表成功");
+ return true;
+ }
+ catch (CustomizedErrorException ex)
+ {
+ Notify.ShowMessageToast(ex.Message);
+ _logger.Error(ex.Message, ex);
+ return false;
+ }
+ catch (Exception ex)
+ {
+ var handel = HandelError(ex);
+ Notify.ShowMessageToast(handel.message);
+ return false;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/src/BiliLite.UWP/ViewModels/Season/SeasonShortReviewItemStatViewModel.cs b/src/BiliLite.UWP/ViewModels/Season/SeasonShortReviewItemStatViewModel.cs
new file mode 100644
index 00000000..a85071c1
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Season/SeasonShortReviewItemStatViewModel.cs
@@ -0,0 +1,21 @@
+using BiliLite.ViewModels.Common;
+
+namespace BiliLite.ViewModels.Season;
+
+public class SeasonShortReviewItemStatViewModel : BaseViewModel
+{
+ ///
+ /// 是否已经点踩👎
+ ///
+ public int Disliked { get; set; }
+
+ ///
+ /// 是否已经点赞👍
+ ///
+ public int Liked { get; set; }
+
+ ///
+ /// 点赞数量
+ ///
+ public int Likes { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/ViewModels/Season/SeasonShortReviewItemViewModel.cs b/src/BiliLite.UWP/ViewModels/Season/SeasonShortReviewItemViewModel.cs
new file mode 100644
index 00000000..dcb7b40e
--- /dev/null
+++ b/src/BiliLite.UWP/ViewModels/Season/SeasonShortReviewItemViewModel.cs
@@ -0,0 +1,27 @@
+using BiliLite.Models.Common.Season;
+
+namespace BiliLite.ViewModels.Season;
+
+public class SeasonShortReviewItemViewModel
+{
+ public long Ctime { get; set; }
+
+ public long Mid { get; set; }
+
+ public int ReviewId { get; set; }
+
+ public string Content { get; set; }
+
+ public string Progress { get; set; }
+
+ public int Score { get; set; }
+
+ ///
+ /// 评分,转为5分制
+ ///
+ public int Score5 => Score / 2;
+
+ public SeasonShortReviewItemAuthorModel Author { get; set; }
+
+ public SeasonShortReviewItemStatViewModel Stat { get; set; }
+}
\ No newline at end of file
diff --git a/src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs b/src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs
index 6ad9810c..39b4e1ac 100644
--- a/src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs
+++ b/src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs
@@ -39,6 +39,7 @@ public class VideoDetailPageViewModel : BaseViewModel
readonly PlayerAPI PlayerAPI;
readonly FollowAPI followAPI;
private readonly IMapper m_mapper;
+ private readonly ThemeService m_themeService;
#endregion
@@ -46,7 +47,8 @@ public class VideoDetailPageViewModel : BaseViewModel
public VideoDetailPageViewModel()
{
- m_mapper = App.ServiceProvider.GetService();
+ m_mapper = App.ServiceProvider.GetRequiredService();
+ m_themeService = App.ServiceProvider.GetRequiredService();
videoAPI = new VideoAPI();
favoriteAPI = new FavoriteApi();
PlayerAPI = new PlayerAPI();
@@ -152,7 +154,7 @@ public Brush RightInfoBackground
{
if (PageWidth < 1000)
{
- return (Brush)Application.Current.Resources["AcrylicInAppFillColorDefaultBrush"];
+ return (Brush)m_themeService.ThemeResource["PlayerControlAcrylicBrush"];
}
return new SolidColorBrush(Colors.Transparent);