protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { _logger = applicationContext.ProfilingLogger.Logger; TGDH.LoadSettingsNode(false); ContentService.Published += ContentService_Published; var contentType = applicationContext.Services.ContentTypeService.GetContentType("globalSettings"); if (contentType != null) { settingsContentTypeId = contentType.Id; } }
private void ContentService_Published(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs <IContent> e) { try { if (settingsContentTypeId != -1) { foreach (var item in e.PublishedEntities) { if (item.ContentTypeId == settingsContentTypeId) { TGDH.LoadSettingsNode(); } } } } catch (Exception ex) { _logger.Warn <SiteSettingEventHandler>("Failed to re-load settings: {0}", () => ex.ToString()); } }