mirror of
https://github.com/cyanfish/naps2.git
synced 2024-09-11 15:26:55 +03:00
35669502cc
Performance is much better (might save ~20ms on startup), plus more popular in general means potentially easier for others to contribute/use the code.
22 lines
507 B
C#
22 lines
507 B
C#
using Autofac;
|
|
using NAPS2.EtoForms;
|
|
|
|
namespace NAPS2;
|
|
|
|
public class AutofacFormFactory : IFormFactory
|
|
{
|
|
private readonly IComponentContext _container;
|
|
|
|
public AutofacFormFactory(IComponentContext container)
|
|
{
|
|
_container = container;
|
|
}
|
|
|
|
public T Create<T>() where T : IFormBase
|
|
{
|
|
var form = _container.Resolve<T>();
|
|
form.FormFactory = _container.Resolve<IFormFactory>();
|
|
form.Config = _container.Resolve<Naps2Config>();
|
|
return form;
|
|
}
|
|
} |