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 <Sparkle>(c => { string url; try { var updateTable = new UpdateVersionTable(); url = updateTable.GetAppcastUrl(); } catch (Exception) { url = ""; Logger.WriteEvent("Could not retrieve UpdateVersionTable from the internet"); } var s = new Sparkle(url, Resources.Bloom); s.CustomInstallerArguments = "/qb"; s.DoLaunchAfterUpdate = false; return(s); }).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(); _container = builder.Build(); }