public override void Register(StructureMap.IContainer container, List<SiteRoute> routes, System.Web.Mvc.ViewEngineCollection viewEngines, System.Web.Mvc.ModelBinderDictionary modelBinders, ICollection<Domain.Asset> globalAssets)
        {
            container.Inject(typeof (IThemeSwitcherService),
                             new ThemeSwitcherService(container.GetInstance<IThemeService>(),
                                                      container.GetInstance<IAtomPubService>(),
                                                      container.GetInstance<IAppServiceRepository>()));

            RegisterWidget(container, new CompositeWidget("ThemeSwitcherWidget", "ThemeSwitcher", "Widget")
            {
                Assets = new string[] { "ThemeSwitcher.css", "ThemeSwitcher.js" }.Select(a => new Asset(a)),
                SupportedScopes = SupportedScopes.All,
                AreaHints = new[] { "content" }
            });

            RegisterWidget(container, new CompositeWidget("ThemeWidget", "ThemeSwitcher", "ThemeWidget")
            {
                SupportedScopes = SupportedScopes.All,
            });

            RegisterController<ThemeSwitcherController>(container);

            SetupIncludeInPageArea(container, "Site", "tail", "ThemeSwitcherWidget");
        }
 public override AtomSite.Domain.PluginState Upgrade(StructureMap.IContainer container, string appPath, System.Version previous, System.Version current)
 {
   //fix non named pages to specify group
   if (previous >= ServerApp.Version12 && previous < ServerApp.Version14)
   {
     LogService.Info("Updating non named page includes in configuration to the default site master page, and getting rid of group specifier if there is one");
     var svcRepo = container.GetInstance<IAppServiceRepository>();
     var appSvc = svcRepo.GetService();
     bool changes = false;
     var pages = appSvc.Pages.Where(p => string.IsNullOrEmpty(p.Name));
     foreach (var page in pages)
     {
       page.Name = "Site";
       page.SetProperty<string>("group", null);
       changes = true;
     }
     if (changes)
     {
       LogService.Info("Saving changes to service configuration");
       svcRepo.UpdateService(appSvc);
     }
   }
   return base.Upgrade(container, appPath, previous, current);
 }