Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • James Kahler 36 posts 78 karma points
    Jun 25, 2013 @ 17:56
    James Kahler
    0

    FileService events

    I'm trying to add an event when a stylesheet is saved so i created the below class. 

    The contentservice event always fires but the stylesheet one never does. Any one have any ideas, using umbraco 6.1.1. Can't really find much info on the new contentservice api.

     

    public class RegisterEvents : ApplicationEventHandler
        {
            protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
                FileService.SavedStylesheet += FileService_SavedStylesheet;
                ContentService.Saved += ContentService_Saved;
            }
            void FileService_SavedStylesheet(IFileService sender, Core.Events.SaveEventArgs<Core.Models.Stylesheet> e)
            {
                
            }
            void ContentService_Saved(IContentService sender, Core.Events.SaveEventArgs<Core.Models.IContent> e)
            {
                
            }
            
        }
  • Jon Dunfee 199 posts 468 karma points
    Jun 25, 2013 @ 18:38
    Jon Dunfee
    0

    Maybe this would work for you:

    public class RegisterEvents : IApplicationEventHandler
    {
    public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
    {
    FileService.SavedStylesheet += FileService_SavedStylesheet;
    }
    }

    I use this to intercept node related actions, so maybe it would hold true for FileService events as well. 

  • James Kahler 36 posts 78 karma points
    Jun 26, 2013 @ 12:05
    James Kahler
    0

    Thanks for the reply

    Made no difference, if i use the old sytle events umbraco.cms.businesslogic.web.StyleSheet.AfterSave this works fine. Just finding it odd no FileService events will fire?

Please Sign in or register to post replies

Write your reply to:

Draft