naps2/NAPS2.Lib.Common/NinjectOperationFactory.cs
Ben Olden-Cooligan b62100fb07 Remove unused usings
No longer keeping System, System.Collections.Generic, System.Linq
2019-07-14 11:26:56 -04:00

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;
}
}
}