mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-06-06 18:08:16 +08:00
Compare commits
6 Commits
331141197d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d958abc1e5 | |||
| 27810e4ca1 | |||
| 0ab36a1ab2 | |||
| 77acd07732 | |||
| 7f557bb2c5 | |||
| ec94bdd36d |
@@ -233,6 +233,9 @@ indent_size = 2
|
||||
[*.json]
|
||||
indent_size = 2
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
# Shell scripts
|
||||
[*.sh]
|
||||
end_of_line = lf
|
||||
|
||||
@@ -35,6 +35,14 @@ on:
|
||||
description: 'macOS arm64 AOT'
|
||||
default: false
|
||||
type: boolean
|
||||
osx-x64:
|
||||
description: 'macOS Intel x64'
|
||||
default: false
|
||||
type: boolean
|
||||
osx-x64-aot:
|
||||
description: 'macOS Intel x64 AOT'
|
||||
default: false
|
||||
type: boolean
|
||||
android-arm64:
|
||||
description: 'Android arm64'
|
||||
default: false
|
||||
@@ -65,6 +73,12 @@ on:
|
||||
osx-arm64-aot:
|
||||
type: boolean
|
||||
default: true
|
||||
osx-x64:
|
||||
type: boolean
|
||||
default: true
|
||||
osx-x64-aot:
|
||||
type: boolean
|
||||
default: true
|
||||
android-arm64:
|
||||
type: boolean
|
||||
default: true
|
||||
@@ -180,6 +194,33 @@ jobs:
|
||||
uses: actions/checkout@v6
|
||||
- name: Publish osx-arm64
|
||||
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-arm64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
|
||||
|
||||
- name: Create .app bundle and DMG (create-dmg)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
APP_DIR="bundle/Semi.Avalonia.Demo.app"
|
||||
MACOS_DIR="${APP_DIR}/Contents/MacOS"
|
||||
mkdir -p "${MACOS_DIR}"
|
||||
cp -R publish/. "${MACOS_DIR}/"
|
||||
chmod +x "${MACOS_DIR}/Semi.Avalonia.Demo.Desktop"
|
||||
cp publish/Info-macOS.plist "${APP_DIR}/Contents/Info.plist"
|
||||
codesign --force --deep --sign - "${APP_DIR}"
|
||||
mkdir -p dmg_stage
|
||||
ditto "${APP_DIR}" "dmg_stage/Semi.Avalonia.Demo.app"
|
||||
brew install create-dmg
|
||||
rm -f Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
|
||||
create-dmg \
|
||||
--volname "Semi Avalonia Demo" \
|
||||
--window-pos 200 120 \
|
||||
--window-size 640 400 \
|
||||
--icon-size 100 \
|
||||
--icon "Semi.Avalonia.Demo.app" 175 185 \
|
||||
--hide-extension "Semi.Avalonia.Demo.app" \
|
||||
--app-drop-link 455 185 \
|
||||
--skip-jenkins \
|
||||
"Semi.Avalonia.Demo.Desktop.osx-arm64.dmg" \
|
||||
"dmg_stage"
|
||||
|
||||
- name: Upload a Build Artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
@@ -188,6 +229,62 @@ jobs:
|
||||
publish
|
||||
!publish/*.pdb
|
||||
|
||||
- name: Upload macOS DMG
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
|
||||
path: Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
|
||||
|
||||
osx-x64:
|
||||
if: ${{inputs.osx-x64}}
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Publish osx-x64
|
||||
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
|
||||
|
||||
- name: Create .app bundle and DMG (create-dmg)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
APP_DIR="bundle/Semi.Avalonia.Demo.app"
|
||||
MACOS_DIR="${APP_DIR}/Contents/MacOS"
|
||||
mkdir -p "${MACOS_DIR}"
|
||||
cp -R publish/. "${MACOS_DIR}/"
|
||||
chmod +x "${MACOS_DIR}/Semi.Avalonia.Demo.Desktop"
|
||||
cp publish/Info-macOS.plist "${APP_DIR}/Contents/Info.plist"
|
||||
codesign --force --deep --sign - "${APP_DIR}"
|
||||
mkdir -p dmg_stage
|
||||
ditto "${APP_DIR}" "dmg_stage/Semi.Avalonia.Demo.app"
|
||||
brew install create-dmg
|
||||
rm -f Semi.Avalonia.Demo.Desktop.osx-x64.dmg
|
||||
create-dmg \
|
||||
--volname "Semi Avalonia Demo" \
|
||||
--window-pos 200 120 \
|
||||
--window-size 640 400 \
|
||||
--icon-size 100 \
|
||||
--icon "Semi.Avalonia.Demo.app" 175 185 \
|
||||
--hide-extension "Semi.Avalonia.Demo.app" \
|
||||
--app-drop-link 455 185 \
|
||||
--skip-jenkins \
|
||||
"Semi.Avalonia.Demo.Desktop.osx-x64.dmg" \
|
||||
"dmg_stage"
|
||||
|
||||
- name: Upload a Build Artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: Semi.Avalonia.Demo.Desktop.osx-x64
|
||||
path: |
|
||||
publish
|
||||
!publish/*.pdb
|
||||
|
||||
- name: Upload macOS DMG (Intel)
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: Semi.Avalonia.Demo.Desktop.osx-x64.dmg
|
||||
path: Semi.Avalonia.Demo.Desktop.osx-x64.dmg
|
||||
|
||||
osx-arm64-aot:
|
||||
if: ${{inputs.osx-arm64-aot}}
|
||||
runs-on: macos-latest
|
||||
@@ -206,6 +303,24 @@ jobs:
|
||||
publish
|
||||
!publish/*.pdb
|
||||
|
||||
osx-x64-aot:
|
||||
if: ${{inputs.osx-x64-aot}}
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Enable Native AOT in .csproj
|
||||
run: sed -i '' 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
|
||||
- name: Publish osx-x64 AOT
|
||||
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-x64 -c Release -o publish
|
||||
- name: Upload a Build Artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: Semi.Avalonia.Demo.Desktop.osx-x64.NativeAOT
|
||||
path: |
|
||||
publish
|
||||
!publish/*.pdb
|
||||
|
||||
android-arm64:
|
||||
if: ${{inputs.android-arm64 }}
|
||||
runs-on: windows-latest
|
||||
|
||||
@@ -58,6 +58,10 @@ jobs:
|
||||
zip -rj Semi.Avalonia.Demo.Desktop.osx-arm64.zip Semi.Avalonia.Demo.Desktop.osx-arm64
|
||||
cd Semi.Avalonia.Demo.Desktop.osx-arm64.NativeAOT
|
||||
zip -r ../Semi.Avalonia.Demo.Desktop.osx-arm64.NativeAOT.zip .
|
||||
cd "${GITHUB_WORKSPACE}"
|
||||
zip -rj Semi.Avalonia.Demo.Desktop.osx-x64.zip Semi.Avalonia.Demo.Desktop.osx-x64
|
||||
cd Semi.Avalonia.Demo.Desktop.osx-x64.NativeAOT
|
||||
zip -r ../Semi.Avalonia.Demo.Desktop.osx-x64.NativeAOT.zip .
|
||||
|
||||
- name: Display structure of zipped files
|
||||
run: ls -R
|
||||
@@ -72,3 +76,5 @@ jobs:
|
||||
nugets/*.nupkg
|
||||
android-arm64/*.apk
|
||||
*.zip
|
||||
Semi.Avalonia.Demo.Desktop.osx-arm64.dmg/Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
|
||||
Semi.Avalonia.Demo.Desktop.osx-x64.dmg/Semi.Avalonia.Demo.Desktop.osx-x64.dmg
|
||||
@@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<CentralPackageVersionOverrideEnabled>true</CentralPackageVersionOverrideEnabled>
|
||||
<AvaloniaVersion>12.0.1</AvaloniaVersion>
|
||||
<AvaloniaVersion>12.0.3</AvaloniaVersion>
|
||||
<DataGridVersion>12.0.0</DataGridVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
+2
-2
@@ -3,6 +3,7 @@
|
||||
<Project Path="demo/Semi.Avalonia.Demo.Android/Semi.Avalonia.Demo.Android.csproj"/>
|
||||
<Project Path="demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj"/>
|
||||
<Project Path="demo/Semi.Avalonia.Demo.Drm/Semi.Avalonia.Demo.Drm.csproj"/>
|
||||
<Project Path="demo/Semi.Avalonia.Demo.Fonts/Semi.Avalonia.Demo.Fonts.csproj"/>
|
||||
<Project Path="demo/Semi.Avalonia.Demo.Web/Semi.Avalonia.Demo.Web.csproj"/>
|
||||
<Project Path="demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj"/>
|
||||
</Folder>
|
||||
@@ -17,11 +18,10 @@
|
||||
<Folder Name="/Solution Items/">
|
||||
<File Path="Directory.Packages.props"/>
|
||||
<File Path="global.json"/>
|
||||
<File Path="Nuget.Config"/>
|
||||
<File Path="NuGet.Config"/>
|
||||
</Folder>
|
||||
<Folder Name="/Solution Items/Demo/">
|
||||
<File Path="demo/Directory.Build.targets"/>
|
||||
<File Path="demo/global.json"/>
|
||||
</Folder>
|
||||
<Folder Name="/Solution Items/Src/">
|
||||
<File Path="src/Directory.Build.props"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<AvaloniaVersion>12.0.2</AvaloniaVersion>
|
||||
<AvaloniaVersion>12.0.3</AvaloniaVersion>
|
||||
<DataGridVersion>12.0.0</DataGridVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Android.Runtime;
|
||||
using Avalonia;
|
||||
using Avalonia.Android;
|
||||
using Semi.Avalonia.Demo.Fonts;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Android;
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Android;
|
||||
|
||||
public static class AvaloniaAppBuilderExtensions
|
||||
{
|
||||
private static string DefaultFontFamily => "avares://Semi.Avalonia.Demo.Android/Assets#Source Han Sans CN";
|
||||
|
||||
public static AppBuilder WithSourceHanSansCNFont(this AppBuilder builder) =>
|
||||
builder.With(new FontManagerOptions
|
||||
{
|
||||
DefaultFamilyName = DefaultFontFamily,
|
||||
FontFallbacks = [new FontFallback { FontFamily = new FontFamily(DefaultFontFamily) }]
|
||||
});
|
||||
}
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Icon.png" Link="Resources\drawable\Icon.png"/>
|
||||
<AvaloniaResource Include="..\Fonts\*" Link="Assets\Fonts\%(Filename)%(Extension)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -31,5 +30,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
|
||||
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Semi.Avalonia.Demo.Desktop</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.avaloniaui.SemiAvaloniaDemo</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Semi Avalonia Demo</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(Version)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(Version)</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.15</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -2,8 +2,10 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Dialogs;
|
||||
using Avalonia.Media;
|
||||
using Semi.Avalonia.Demo.Fonts;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Desktop;
|
||||
#pragma warning disable CA1416, AVALONIA_X11_CSD, AVALONIA_X11_FORCE_CSD
|
||||
|
||||
sealed class Program
|
||||
{
|
||||
@@ -11,24 +13,28 @@ sealed class Program
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
// yet and stuff might break.
|
||||
[STAThread]
|
||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||
.With(new FontManagerOptions
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
FontFallbacks =
|
||||
[
|
||||
new FontFallback
|
||||
var appBuilder = BuildAvaloniaApp();
|
||||
if (!OperatingSystem.IsLinux())
|
||||
appBuilder.With(new FontManagerOptions
|
||||
{
|
||||
FontFamily = new FontFamily("Microsoft YaHei")
|
||||
FontFallbacks = [new FontFallback { FontFamily = new FontFamily("Microsoft YaHei") }]
|
||||
});
|
||||
|
||||
appBuilder.StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
]
|
||||
})
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
{
|
||||
var appBuilder = AppBuilder.Configure<App>()
|
||||
.UseManagedSystemDialogs()
|
||||
.UsePlatformDetect()
|
||||
.With(new Win32PlatformOptions())
|
||||
.With(new X11PlatformOptions { EnableDrawnDecorations = true })
|
||||
.LogToTrace();
|
||||
if (OperatingSystem.IsLinux()) appBuilder.WithSourceHanSansCNFont();
|
||||
return appBuilder;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Version>1.0.0</Version>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationIcon>..\Semi.Avalonia.Demo\Assets\irihi.ico</ApplicationIcon>
|
||||
@@ -28,5 +29,28 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
|
||||
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<UsingTask TaskName="ExpandMacOSPlistVersion" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
|
||||
<ParameterGroup>
|
||||
<InputFile ParameterType="System.String" Required="true"/>
|
||||
<OutputFile ParameterType="System.String" Required="true"/>
|
||||
<AppVersion ParameterType="System.String" Required="true"/>
|
||||
</ParameterGroup>
|
||||
<Task>
|
||||
<Code Type="Fragment" Language="cs"><![CDATA[
|
||||
var token = "$" + "(Version)";
|
||||
System.IO.File.WriteAllText(
|
||||
OutputFile,
|
||||
System.IO.File.ReadAllText(InputFile).Replace(token, AppVersion));
|
||||
]]></Code>
|
||||
</Task>
|
||||
</UsingTask>
|
||||
<Target Name="ExpandMacOSInfoPlist" AfterTargets="Publish">
|
||||
<ExpandMacOSPlistVersion
|
||||
InputFile="$(MSBuildProjectDirectory)/Info-macOS.plist"
|
||||
OutputFile="$(PublishDir)Info-macOS.plist"
|
||||
AppVersion="$(Version)"/>
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
@@ -4,8 +4,10 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using Avalonia;
|
||||
using Avalonia.Dialogs;
|
||||
using Semi.Avalonia.Demo.Fonts;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Drm;
|
||||
#pragma warning disable CA1416, AVALONIA_X11_CSD, AVALONIA_X11_FORCE_CSD
|
||||
|
||||
sealed class Program
|
||||
{
|
||||
@@ -40,7 +42,8 @@ sealed class Program
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UseManagedSystemDialogs()
|
||||
.UsePlatformDetect()
|
||||
.With(new Win32PlatformOptions())
|
||||
.With(new X11PlatformOptions { EnableDrawnDecorations = true })
|
||||
.WithSourceHanSansCNFont()
|
||||
.LogToTrace();
|
||||
|
||||
private static void SilenceConsole()
|
||||
@@ -50,7 +53,6 @@ sealed class Program
|
||||
Console.CursorVisible = false;
|
||||
while (true)
|
||||
Console.ReadKey(true);
|
||||
})
|
||||
{ IsBackground = true }.Start();
|
||||
}) { IsBackground = true }.Start();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationIcon>..\Semi.Avalonia.Demo\Assets\irihi.ico</ApplicationIcon>
|
||||
@@ -29,5 +29,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
|
||||
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Fonts;
|
||||
|
||||
public static class AvaloniaAppBuilderExtensions
|
||||
{
|
||||
public static AppBuilder WithSourceHanSansCNFont(this AppBuilder builder)
|
||||
{
|
||||
const string uri = "avares://Semi.Avalonia.Demo.Fonts/Assets#Source Han Sans CN";
|
||||
return builder.With(new FontManagerOptions
|
||||
{
|
||||
DefaultFamilyName = uri, FontFallbacks = [new FontFallback { FontFamily = new FontFamily(uri) }]
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,16 +0,0 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Web;
|
||||
|
||||
public static class AvaloniaAppBuilderExtensions
|
||||
{
|
||||
private static string DefaultFontFamily => "avares://Semi.Avalonia.Demo.Web/Assets#Source Han Sans CN";
|
||||
|
||||
public static AppBuilder WithSourceHanSansCNFont(this AppBuilder builder) =>
|
||||
builder.With(new FontManagerOptions
|
||||
{
|
||||
DefaultFamilyName = DefaultFontFamily,
|
||||
FontFallbacks = [new FontFallback { FontFamily = new FontFamily(DefaultFontFamily) }]
|
||||
});
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Browser;
|
||||
using Semi.Avalonia.Demo.Fonts;
|
||||
|
||||
[assembly: SupportedOSPlatform("browser")]
|
||||
|
||||
|
||||
@@ -6,15 +6,12 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="..\Fonts\*" Link="Assets\Fonts\%(Filename)%(Extension)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Browser"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
|
||||
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:semi="https://irihi.tech/semi"
|
||||
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||
RequestedThemeVariant="Default"
|
||||
x:DataType="vm:ApplicationViewModel">
|
||||
<Application.Styles>
|
||||
<semi:SemiTheme Locale="zh-CN" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Data.Core.Plugins;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Semi.Avalonia.Demo.ViewModels;
|
||||
using Semi.Avalonia.Demo.Views;
|
||||
@@ -15,22 +15,26 @@ public partial class App : Application
|
||||
#if DEBUG
|
||||
this.AttachDeveloperTools();
|
||||
#endif
|
||||
this.DataContext = new ApplicationViewModel();
|
||||
DataContext = new ApplicationViewModel();
|
||||
if (OperatingSystem.IsLinux())
|
||||
{
|
||||
Resources.Add("DefaultFontFamily", null);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
switch (ApplicationLifetime)
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
case IClassicDesktopStyleApplicationLifetime desktop:
|
||||
// Line below is needed to remove Avalonia data validation.
|
||||
// Without this line you will get duplicate validations from both Avalonia and CT
|
||||
// BindingPlugins.DataValidators.RemoveAt(0);
|
||||
desktop.MainWindow = new MainWindow();
|
||||
break;
|
||||
case ISingleViewApplicationLifetime singleView:
|
||||
singleView.MainView = new MainView();
|
||||
break;
|
||||
desktop.MainWindow = new MainWindow { DataContext = new MainViewModel() };
|
||||
}
|
||||
else if (ApplicationLifetime is IActivityApplicationLifetime applicationLifetime)
|
||||
{
|
||||
applicationLifetime.MainViewFactory = () => new MainView { DataContext = new MainViewModel() };
|
||||
}
|
||||
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
|
||||
{
|
||||
singleViewPlatform.MainView = new MainView { DataContext = new MainViewModel() };
|
||||
}
|
||||
|
||||
this.RegisterFollowSystemTheme();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<ScrollViewer DockPanel.Dock="Right" Width="260">
|
||||
<StackPanel Margin="12" Spacing="8">
|
||||
<TextBlock Text="Configuration" FontWeight="SemiBold" FontSize="16" />
|
||||
<TextBlock Text="Navigation" FontWeight="SemiBold" FontSize="13" />
|
||||
<TextBlock Text="Navigation" FontWeight="SemiBold" FontSize="14" />
|
||||
|
||||
<Button Content="Push Page"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -26,6 +26,20 @@
|
||||
|
||||
<Separator />
|
||||
|
||||
<TextBlock Text="Modal Actions" FontWeight="SemiBold" FontSize="14" />
|
||||
<Button Name="PushModalButton"
|
||||
Content="Push Modal"
|
||||
HorizontalAlignment="Stretch"
|
||||
Click="OnPushModal" />
|
||||
<Button Name="PopModalButton"
|
||||
Content="Pop Modal"
|
||||
HorizontalAlignment="Stretch"
|
||||
Click="OnPopModal" />
|
||||
<Button Name="PopAllModalsButton"
|
||||
Content="Pop All Modals"
|
||||
HorizontalAlignment="Stretch"
|
||||
Click="OnPopAllModals" />
|
||||
|
||||
<TextBlock Text="Options" FontWeight="SemiBold" FontSize="14" />
|
||||
|
||||
<CheckBox Name="HasNavBarCheck"
|
||||
@@ -35,20 +49,38 @@
|
||||
<CheckBox Name="HasBackButtonCheck"
|
||||
Content="Has Back Button"
|
||||
IsChecked="True"
|
||||
IsCheckedChanged="OnHasBackButonChanged" />
|
||||
IsCheckedChanged="OnHasBackButtonChanged" />
|
||||
<CheckBox Name="HasShadowCheck"
|
||||
Content="Has Shadow"
|
||||
IsChecked="True"
|
||||
IsCheckedChanged="OnHasShadowChanged" />
|
||||
<CheckBox Name="large" Content="Large" />
|
||||
|
||||
<Separator />
|
||||
|
||||
<TextBlock Text="Modal Transition" FontWeight="SemiBold" FontSize="14" />
|
||||
<ComboBox Name="TransitionCombo"
|
||||
SelectedIndex="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
SelectionChanged="OnTransitionChanged">
|
||||
<ComboBoxItem Content="Slide from Bottom" />
|
||||
<ComboBoxItem Content="CrossFade" />
|
||||
<ComboBoxItem Content="None" />
|
||||
</ComboBox>
|
||||
|
||||
<Separator />
|
||||
|
||||
<TextBlock Text="Status" FontWeight="SemiBold" FontSize="14" />
|
||||
<TextBlock Name="StatusText"
|
||||
Text="Depth: 1"
|
||||
Opacity="0.7"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock Name="HeaderText"
|
||||
Text="Current: Home"
|
||||
Opacity="0.7"
|
||||
TextWrapping="Wrap" />
|
||||
<ToggleSwitch Content="Large" Name="large" />
|
||||
<TextBlock Name="ModalText"
|
||||
Text="Modals: 0"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
@@ -6,6 +8,7 @@ namespace Semi.Avalonia.Demo.Pages;
|
||||
public partial class NavigationPageDemo : UserControl
|
||||
{
|
||||
private int _pageCount;
|
||||
private int _modalCount;
|
||||
|
||||
public NavigationPageDemo()
|
||||
{
|
||||
@@ -15,7 +18,7 @@ public partial class NavigationPageDemo : UserControl
|
||||
|
||||
private async void OnLoaded(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
await DemoNav.PushAsync(NavigationDemoHelper.MakePage("Home", "Welcome!\nUse the buttons to push and pop pages.", 0), null);
|
||||
await DemoNav.PushAsync(NavigationDemoHelper.MakePage("Home", "Welcome!\nUse the buttons to push and pop pages/modals.", 0), null);
|
||||
UpdateStatus();
|
||||
}
|
||||
|
||||
@@ -42,6 +45,27 @@ public partial class NavigationPageDemo : UserControl
|
||||
UpdateStatus();
|
||||
}
|
||||
|
||||
private async void OnPushModal(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_modalCount++;
|
||||
var modal = NavigationDemoHelper.MakePage($"Modal {_modalCount}", "This page was presented modally.\nTap 'Pop Modal' to dismiss.", _modalCount);
|
||||
await DemoNav.PushModalAsync(modal);
|
||||
UpdateStatus();
|
||||
}
|
||||
|
||||
private async void OnPopModal(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
await DemoNav.PopModalAsync();
|
||||
UpdateStatus();
|
||||
}
|
||||
|
||||
private async void OnPopAllModals(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
await DemoNav.PopAllModalsAsync();
|
||||
_modalCount = 0;
|
||||
UpdateStatus();
|
||||
}
|
||||
|
||||
private void OnHasNavBarChanged(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DemoNav == null)
|
||||
@@ -50,7 +74,7 @@ public partial class NavigationPageDemo : UserControl
|
||||
NavigationPage.SetHasNavigationBar(DemoNav.CurrentPage, HasNavBarCheck.IsChecked == true);
|
||||
}
|
||||
|
||||
private void OnHasBackButonChanged(object? sender, RoutedEventArgs e)
|
||||
private void OnHasBackButtonChanged(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DemoNav == null)
|
||||
return;
|
||||
@@ -58,9 +82,30 @@ public partial class NavigationPageDemo : UserControl
|
||||
NavigationPage.SetHasBackButton(DemoNav.CurrentPage, HasBackButtonCheck.IsChecked == true);
|
||||
}
|
||||
|
||||
private void OnHasShadowChanged(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DemoNav == null)
|
||||
return;
|
||||
if (DemoNav.CurrentPage != null)
|
||||
DemoNav.HasShadow = HasShadowCheck.IsChecked == true;
|
||||
}
|
||||
|
||||
private void OnTransitionChanged(object? sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (DemoNav == null)
|
||||
return;
|
||||
DemoNav.ModalTransition = TransitionCombo.SelectedIndex switch
|
||||
{
|
||||
1 => new CrossFade(TimeSpan.FromMilliseconds(250)),
|
||||
2 => null,
|
||||
_ => new PageSlide(TimeSpan.FromMilliseconds(300), PageSlide.SlideAxis.Vertical)
|
||||
};
|
||||
}
|
||||
|
||||
private void UpdateStatus()
|
||||
{
|
||||
StatusText.Text = $"Depth: {DemoNav.StackDepth}";
|
||||
HeaderText.Text = $"Current: {DemoNav.CurrentPage?.Header ?? "(none)"}";
|
||||
ModalText.Text = $"Modals: {DemoNav.ModalStack.Count}";
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<Style Selector="Border.NavItemHost">
|
||||
<Setter Property="Margin" Value="6,0" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource SemiBorderRadiusSmall}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="Border.NavItemHost.Selected">
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "8.0"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "8.0.0",
|
||||
"version": "10.0.0",
|
||||
"rollForward": "latestMajor",
|
||||
"allowPrerelease": true
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
|
||||
<Version>12.0.1</Version>
|
||||
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.1</PackageReleaseNotes>
|
||||
<Version>12.0.3</Version>
|
||||
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.3</PackageReleaseNotes>
|
||||
<Title>Semi.Avalonia.ColorPicker</Title>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -8,6 +8,26 @@
|
||||
<ControlTheme x:Key="{x:Type NavigationPage}" TargetType="NavigationPage">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BarHeight" Value="{DynamicResource NavigationPageBarMinHeight}" />
|
||||
<Setter Property="PageTransition">
|
||||
<PageSlide Duration="0:0:0.3" Orientation="Horizontal" FillMode="Forward">
|
||||
<PageSlide.SlideInEasing>
|
||||
<SplineEasing X1="0.16" Y1="1" X2="0.3" Y2="1" />
|
||||
</PageSlide.SlideInEasing>
|
||||
<PageSlide.SlideOutEasing>
|
||||
<SplineEasing X1="0.2" Y1="0.85" X2="0.3" Y2="1" />
|
||||
</PageSlide.SlideOutEasing>
|
||||
</PageSlide>
|
||||
</Setter>
|
||||
<Setter Property="ModalTransition">
|
||||
<PageSlide Duration="0:0:0.25" Orientation="Vertical" FillMode="Forward">
|
||||
<PageSlide.SlideInEasing>
|
||||
<SplineEasing X1="0.16" Y1="1" X2="0.3" Y2="1" />
|
||||
</PageSlide.SlideInEasing>
|
||||
<PageSlide.SlideOutEasing>
|
||||
<SplineEasing X1="0.2" Y1="0.85" X2="0.3" Y2="1" />
|
||||
</PageSlide.SlideOutEasing>
|
||||
</PageSlide>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="NavigationPage">
|
||||
<Panel ClipToBounds="True">
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
|
||||
<ControlTheme x:Key="{x:Type WindowDrawnDecorations}" TargetType="WindowDrawnDecorations">
|
||||
<Setter Property="DefaultTitleBarHeight" Value="32" />
|
||||
<Setter Property="DefaultFrameThickness" Value="1" />
|
||||
<Setter Property="DefaultShadowThickness" Value="8" />
|
||||
<Setter Property="DefaultFrameThickness" Value="4" />
|
||||
<!-- <Setter Property="DefaultShadowThickness" Value="8" /> -->
|
||||
<Setter Property="Template">
|
||||
<WindowDrawnDecorationsTemplate>
|
||||
<WindowDrawnDecorationsContent>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
|
||||
<Version>12.0.1</Version>
|
||||
<PackageReleaseNotes>Update to Semi.Avalonia 12.0.1</PackageReleaseNotes>
|
||||
<Version>12.0.3</Version>
|
||||
<PackageReleaseNotes>Update to Semi.Avalonia 12.0.3</PackageReleaseNotes>
|
||||
<Title>Semi.Avalonia</Title>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<SolidColorBrush x:Key="WindowBackground">Transparent</SolidColorBrush>
|
||||
<StaticResource x:Key="WindowBorderBrush" ResourceKey="SemiColorBorder" />
|
||||
<StaticResource x:Key="WindowBorderShadow" ResourceKey="SemiShadowElevated" />
|
||||
<StaticResource x:Key="TitleBarBackground" ResourceKey="SemiColorBackground0" />
|
||||
<SolidColorBrush x:Key="TitleBarBackground">Transparent</SolidColorBrush>
|
||||
|
||||
<StaticResource x:Key="CaptionButtonPointeroverBackground" ResourceKey="SemiColorFill1" />
|
||||
<StaticResource x:Key="CaptionButtonPressedBackground" ResourceKey="SemiColorFill2" />
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<StaticResource x:Key="TitleBarBackground" ResourceKey="SemiColorWindow" />
|
||||
<SolidColorBrush x:Key="WindowBackground">Transparent</SolidColorBrush>
|
||||
<StaticResource x:Key="WindowBorderBrush" ResourceKey="SemiColorWindowText" />
|
||||
<SolidColorBrush x:Key="TitleBarBackground">Transparent</SolidColorBrush>
|
||||
|
||||
<StaticResource x:Key="CaptionButtonPointeroverBackground" ResourceKey="SemiColorHotlight" />
|
||||
<StaticResource x:Key="CaptionButtonPressedBackground" ResourceKey="SemiColorHotlight" />
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<SolidColorBrush x:Key="WindowBackground">Transparent</SolidColorBrush>
|
||||
<StaticResource x:Key="WindowBorderBrush" ResourceKey="SemiColorBorder" />
|
||||
<StaticResource x:Key="WindowBorderShadow" ResourceKey="SemiShadowElevated" />
|
||||
<StaticResource x:Key="TitleBarBackground" ResourceKey="SemiColorBackground0" />
|
||||
<SolidColorBrush x:Key="TitleBarBackground">Transparent</SolidColorBrush>
|
||||
|
||||
<StaticResource x:Key="CaptionButtonPointeroverBackground" ResourceKey="SemiColorFill1" />
|
||||
<StaticResource x:Key="CaptionButtonPressedBackground" ResourceKey="SemiColorFill2" />
|
||||
|
||||
Reference in New Issue
Block a user