1

I have Prism Shell application, There is class which primarily focused execuing method on subscribed events. These events are fired from a separate module in my solution.

My class is ApplicationMenuSubscriber which is in my shell application. My shell is boot strapped with MEFBootStrapper. I may not directly want to wire my ApplicationMenuSubscriber inside shell startup, instead i want this class to be picked up automatically by MEF. Is there a way in doing this in Prism

public class ApplicationMenuSubscriber
    {
        private readonly IRegionManager regionManager;
        private readonly IMenuService menuService;
        private readonly IEventAggregator events;

        [ImportingConstructor]
        public ApplicationMenuSubscriber(IRegionManager regionManager, IEventAggregator events, IMenuService menuService)
        {
            this.regionManager = regionManager;
            this.menuService = menuService;
            this.events = events;    

            //subscribe to events
            events.GetEvent<MenuEvent>().Subscribe(MenuFired);
        }

        private void MenuFired(ApplicationEventArgs obj)
        {
            //check
            if (obj.Source == MenuConstants.LOGIN)
            { 
                //log
            }
        }

    }
kuhajeyan
  • 10,727
  • 10
  • 46
  • 71
  • 1
    I'm not sure I totally understand your question, but your shell module can register it's own module maybe and perhaps resolve a service when the module initializes? – Alan May 27 '13 at 10:23
  • @Alan Shell is my application, I was wondering If I still treat my final application as module and load this class inside IModule.Initialize as you suggest. but I havent tried that may be it is one option I will surely give a try – kuhajeyan May 27 '13 at 15:06
  • That is what I do for a few things... for example my dialog service. I have my dialog service in my Wpf.WVVM namespace in a common library, then I just register it in a module in my shell assembly. – Alan May 28 '13 at 01:33

0 Answers0