Merge Common to Desktop
This commit is contained in:
parent
26915defe1
commit
e9c6e14965
40 changed files with 447 additions and 282 deletions
|
|
@ -1,23 +0,0 @@
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace InkForge.Common.ReactiveUI;
|
||||
|
||||
public interface IViewModelFactory<T, TCreator>
|
||||
{
|
||||
abstract static ObjectFactory<T> CreateObjectFactory();
|
||||
|
||||
abstract static TCreator GetCreator(ObjectFactory<T> factory, IServiceProvider serviceProvider);
|
||||
}
|
||||
|
||||
public class ViewModelFactory<T, TFactory, TCreator>
|
||||
where TFactory : IViewModelFactory<T, TCreator>
|
||||
where TCreator : Delegate
|
||||
{
|
||||
private static ObjectFactory<T>? s_factory;
|
||||
|
||||
public TCreator CreateFactory(IServiceProvider serviceProvider)
|
||||
{
|
||||
s_factory ??= TFactory.CreateObjectFactory();
|
||||
return TFactory.GetCreator(s_factory, serviceProvider);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue