Skip to content

Commit

Permalink
适应 Avalonia-11.1.0-beta1
Browse files Browse the repository at this point in the history
 适应对 ExpressionObserver 的调整
  • Loading branch information
feast107 committed Apr 26, 2024
1 parent 664debf commit 88ed4d7
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Internal;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;

namespace Antelcat.I18N.WPF.SourceGenerators.Generators;
Expand Down
3 changes: 2 additions & 1 deletion src/Antelcat.I18N.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antelcat.I18N.Abstractions"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Antelcat.I18N.Abstractions.Shared", "Antelcat.I18N.Abstractions.Shared\Antelcat.I18N.Abstractions.Shared.shproj", "{F3F24657-983C-46FF-B928-ADD03557C562}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Feast.CodeAnalysis.LiteralGenerator", "..\extern\CodeAnalysis.Extensions\src\Feast.CodeAnalysis.LiteralGenerator\Feast.CodeAnalysis.LiteralGenerator.csproj", "{13AC62C7-D492-40B2-8231-B9A2545D7388}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Feast.CodeAnalysis.LiteralGenerator", "..\extern\CodeAnalysis.Extensions\src\Feast.CodeAnalysis.LiteralGenerator\Feast.CodeAnalysis.LiteralGenerator.csproj", "{13AC62C7-D492-40B2-8231-B9A2545D7388}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -116,6 +116,7 @@ Global
SolutionGuid = {73D6AEFA-1477-4119-9F85-0DA27E35BDB8}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\extern\CodeAnalysis.Extensions\src\Feast.CodeAnalysis.Shared\Feast.CodeAnalysis.Shared.projitems*{13ac62c7-d492-40b2-8231-b9a2545d7388}*SharedItemsImports = 5
Antelcat.I18N.SourceGenerators.Shared\Antelcat.I18N.SourceGenerators.Shared.projitems*{15d71dc2-f53d-42ec-85e4-4982f6e351a5}*SharedItemsImports = 13
Antelcat.I18N.Shared\Antelcat.I18N.Shared.projitems*{28f904c6-3b6d-4140-90ff-62a6bd87b0c6}*SharedItemsImports = 13
Antelcat.I18N.Abstractions.Shared\Antelcat.I18N.Abstractions.Shared.projitems*{2ba15a8e-6c3e-4b33-bff4-d9255202d71d}*SharedItemsImports = 5
Expand Down
10 changes: 5 additions & 5 deletions src/Avalonia/Avalonia/Antelcat.I18N.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
<IsPackable>true</IsPackable>
<LangVersion>preview</LangVersion>

<Version>1.0.1</Version>
<FileVersion>1.0.1</FileVersion>
<AssemblyVersion>1.0.1</AssemblyVersion>
<Version>1.0.2</Version>
<FileVersion>1.0.2</FileVersion>
<AssemblyVersion>1.0.2</AssemblyVersion>

<Authors>Antelcat</Authors>
<Title>Antelcat.I18N.Avalonia</Title>
<PackageId>Antelcat.I18N.Avalonia</PackageId>
<RootNamespace>Antelcat.I18N.Avalonia</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageReleaseNotes>Fix string template using args of none string type</PackageReleaseNotes>
<PackageReleaseNotes>Adapt to avalonia-11.1.0-beta1</PackageReleaseNotes>
<Copyright>Copyright Antelcat. All rights reserved</Copyright>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<PackageTags>dotnet;Avalonia;markup;extension;MVVM;i18n;language;binding;.NET;</PackageTags>
Expand All @@ -34,7 +34,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0"/>
<PackageReference Include="Avalonia" Version="11.1.0-beta1" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 2 additions & 5 deletions src/Avalonia/Avalonia/I18NExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ static I18NExtension()

lock (ResourceProvider.Providers)
{
foreach (var provider in ResourceProvider.Providers)
{
var action = RegisterLanguageSource(provider, true);
updateActions.Add(action);
}
updateActions.AddRange(
ResourceProvider.Providers.Select(provider => RegisterLanguageSource(provider, true)));

ResourceProvider.Providers.CollectionChanged += (_, e) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ public IPropertyAccessor Start(WeakReference<object?> reference, string property

public static void Register(ExpandoObject target)
{
if (Assembly.GetAssembly(typeof(IPropertyAccessorPlugin))
/*if (Assembly.GetAssembly(typeof(IPropertyAccessorPlugin))
.GetType("Avalonia.Data.Core.ExpressionObserver")
.GetField("PropertyAccessors", BindingFlags.Public | BindingFlags.Static)!
.GetValue(null) is IList<IPropertyAccessorPlugin> { } plugins)
{
plugins.Add(new ExpandoObjectPropertyAccessorPlugin(target));
ExpandoAccessor.Source = target;
}
.GetField("PropertyAccessors", BindingFlags.Public | BindingFlags.Static)?
.GetValue(null) is not IList<IPropertyAccessorPlugin> plugins) return;
plugins.Add(new ExpandoObjectPropertyAccessorPlugin(target));*/
BindingPlugins.PropertyAccessors.Add(new ExpandoObjectPropertyAccessorPlugin(target));
ExpandoAccessor.Source = target;
}

private class ExpandoAccessor : IPropertyAccessor
Expand Down
8 changes: 4 additions & 4 deletions src/Avalonia/Demo/Antelcat.I18N.Avalonia.Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
<TrimmableAssembly Include="Avalonia.Themes.Default" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.5" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.5" />
<PackageReference Include="Avalonia" Version="11.1.0-beta1" />
<PackageReference Include="Avalonia.Desktop" Version="11.1.0-beta1" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.5" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.5" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.0-beta1" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.1.0-beta1" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="FluentAvaloniaUI" Version="2.0.4" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/WPF/Library/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ public MainWindow()
InitializeComponent();
DataContext = new ViewModel();
}

}
}

0 comments on commit 88ed4d7

Please sign in to comment.