Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Persistent Data on Events

$
0
0
Gabriel,
I'm not really sure to what class you are referring as you mention __Event__ in bold, but I'm using __EventAggregator__ class. If I missed a useful class, please point me in the right direction.  Here's my module initialization:
        /// <summary>
        /// Initializes the region manager with the component regions.
        /// </summary>
        public void Initialize()
        {
            this.regionManager.RegisterViewWithRegion(RegionNames.ToolBarRegion, typeof(ToolbarViewModel));
            this.regionManager.RegisterViewWithRegion(RegionNames.DetailRegion, typeof(DetailbarViewModel));
            this.regionManager.RegisterViewWithRegion(RegionNames.ContentRegion, typeof(DirectoryViewModel));
            this.regionManager.RegisterViewWithRegion(RegionNames.HierarchyRegion, typeof(HierarchyViewModel));
            this.regionManager.RegisterViewWithRegion(RegionNames.MainRegion, typeof(MainView));
        }
The classes ToolbarViewModel and DetailViewModel consume the UriChanged event. The DirectoryViewModel publishes it when it has initialized. The problem is that I've found no way to control the initialization of the regions; Prism seems to have it's own logic and reasons as to when each is instantiated. So even though the DirectoryViewModel publishes the new URI when it is initialized, I have found no way to guarantee that ToolbarViewModel or DetailViewModel will be around to see the event. Both of these view models require a URI to initialize, so it's become semi-painful to provide a persistent URI value in addition to the UriChanged event.
I hope that's a little more clear.  Any ideas that streamline this process would be appreciated.  Am I missing some aspect of the architecture?

Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>