mirror of
https://github.com/cyanfish/naps2.git
synced 2024-11-11 02:45:19 +03:00
b62100fb07
No longer keeping System, System.Collections.Generic, System.Linq
26 lines
658 B
C#
26 lines
658 B
C#
using NAPS2.Operation;
|
|
using NAPS2.Util;
|
|
using Ninject;
|
|
|
|
namespace NAPS2
|
|
{
|
|
public class NinjectOperationFactory : IOperationFactory
|
|
{
|
|
private readonly IKernel kernel;
|
|
private readonly ErrorOutput errorOutput;
|
|
|
|
public NinjectOperationFactory(IKernel kernel, ErrorOutput errorOutput)
|
|
{
|
|
this.kernel = kernel;
|
|
this.errorOutput = errorOutput;
|
|
}
|
|
|
|
public T Create<T>() where T : IOperation
|
|
{
|
|
var op = kernel.Get<T>();
|
|
op.Error += (sender, args) => errorOutput.DisplayError(args.ErrorMessage, args.Exception);
|
|
return op;
|
|
}
|
|
}
|
|
}
|