Browse Source

Merge pull request #5727 from worldbeater/master

feature: Disable ReactiveUI Platform Registrations
pull/5729/head
Jumar Macato 6 years ago
committed by GitHub
parent
commit
072077b636
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      build/ReactiveUI.props
  2. 18
      src/Avalonia.ReactiveUI/AppBuilderExtensions.cs

2
build/ReactiveUI.props

@ -1,5 +1,5 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<PackageReference Include="ReactiveUI" Version="12.1.1" /> <PackageReference Include="ReactiveUI" Version="13.2.10" />
</ItemGroup> </ItemGroup>
</Project> </Project>

18
src/Avalonia.ReactiveUI/AppBuilderExtensions.cs

@ -9,18 +9,22 @@ namespace Avalonia.ReactiveUI
{ {
/// <summary> /// <summary>
/// Initializes ReactiveUI framework to use with Avalonia. Registers Avalonia /// Initializes ReactiveUI framework to use with Avalonia. Registers Avalonia
/// scheduler and Avalonia activation for view fetcher. Always remember to /// scheduler, an activation for view fetcher, a template binding hook. Remember
/// call this method if you are using ReactiveUI in your application. /// to call this method if you are using ReactiveUI in your application.
/// </summary> /// </summary>
public static TAppBuilder UseReactiveUI<TAppBuilder>(this TAppBuilder builder) public static TAppBuilder UseReactiveUI<TAppBuilder>(this TAppBuilder builder)
where TAppBuilder : AppBuilderBase<TAppBuilder>, new() where TAppBuilder : AppBuilderBase<TAppBuilder>, new() =>
{ builder.AfterPlatformServicesSetup(_ => Locator.RegisterResolverCallbackChanged(() =>
return builder.AfterPlatformServicesSetup(_ =>
{ {
if (Locator.CurrentMutable is null)
{
return;
}
PlatformRegistrationManager.SetRegistrationNamespaces(RegistrationNamespace.Avalonia);
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance; RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
Locator.CurrentMutable.RegisterConstant(new AvaloniaActivationForViewFetcher(), typeof(IActivationForViewFetcher)); Locator.CurrentMutable.RegisterConstant(new AvaloniaActivationForViewFetcher(), typeof(IActivationForViewFetcher));
Locator.CurrentMutable.RegisterConstant(new AutoDataTemplateBindingHook(), typeof(IPropertyBindingHook)); Locator.CurrentMutable.RegisterConstant(new AutoDataTemplateBindingHook(), typeof(IPropertyBindingHook));
}); }));
}
} }
} }

Loading…
Cancel
Save