public ApplicationContainer()
{
var builder = new ContainerBuilder();
//builder.RegisterModule<WhiteboxProfilingModule>();
//default to InstancePerDependency, i.e., they it will make a new
//one each time someone asks for one
builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly());
builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
.Where(t => t.GetInterfaces().Contains(typeof(ICommand))).InstancePerLifetimeScope();
builder.Register(c => LocalizationManager).SingleInstance();
if (Settings.Default.MruProjects==null)
{
Settings.Default.MruProjects = new MostRecentPathsList();
}
builder.RegisterInstance(Settings.Default.MruProjects).SingleInstance();
//this is to prevent some problems we were getting while waiting for a browser to navigate and being forced to call Application.DoEvents().
//HtmlThumbnailer & ConfigurationDialog, at least, use this.
builder.Register(c => new NavigationIsolator()).InstancePerLifetimeScope();
builder.Register<HtmlThumbNailer>(c => new HtmlThumbNailer(c.Resolve<NavigationIsolator>())).SingleInstance();
builder.Register<BookThumbNailer>(c => new BookThumbNailer(c.Resolve<HtmlThumbNailer>())).SingleInstance();
_container = builder.Build();
Application.ApplicationExit += OnApplicationExit;
}