-
-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Avalonia Support #1025
Add Avalonia Support #1025
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1025 +/- ##
==========================================
+ Coverage 75.43% 75.45% +0.01%
==========================================
Files 93 93
Lines 4388 4387 -1
==========================================
Hits 3310 3310
+ Misses 1078 1077 -1
☔ View full report in Codecov by Sentry. |
Can we have something like this, to allow for more flexibility but still ensure the right order? public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(this AppBuilder builder,
Func<TContainer> containerFactory, Action<TContainer> containerConfig, Func<TContainer, IDependencyResolver> dependencyResolverFactory)
{
return builder switch
{
null => throw new ArgumentNullException(nameof(builder)),
_ => builder.UseReactiveUI().AfterPlatformServicesSetup(_ =>
{
ArgumentNullException.ThrowIfNull(containerFactory);
ArgumentNullException.ThrowIfNull(containerConfig);
ArgumentNullException.ThrowIfNull(dependencyResolverFactory);
var container = containerFactory();
Locator.CurrentMutable.RegisterConstant(container, typeof(Container));
var dependencyResolver = dependencyResolverFactory(container);
Locator.SetLocator(dependencyResolver);
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
containerConfig(container);
})
};
} |
I have added as many tests as I could without tripping over the issue of the container having already been built or the AppBuilder already having been built. We will have to find a way to test more at a later date. |
This exists in all the packages in addition to the wrapped versions. Some DI containers will require some additional calls to complete the process when using this method. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What kind of change does this PR introduce?
Feature
Fix for #1024
What is the current behaviour?
Avalonia.ReactiveUI has some support for ReactiveUI within the Avalonia packages, but not extended capabilities.
What is the new behaviour?
ReactiveUI.Avalonia now gives the option to use the components from ReactiveUI and Splat
Extensions will be ReactiveUI.Avalonia.XXXX and where possible be a single dll for all ReactiveUI Avalonia features
What might this PR break?
Avalonia.ReactiveUI will now become ReactiveUI.Avalonia
Please check if the PR fulfils these requirements
Other information: