Divelements Community
Customer discussion of all Divelements products

SandDoc and PRISM

Latest post 03-08-2010 8:19 by IanD. 17 replies.
  • 03-05-2010 15:40 In reply to

    Re: SandDoc and PRISM

    I'm currently implementing a Region Adaptre based on Karthiks template. One thing that is stuck in my head. If I for example load ModulaA and register ViewA with a region, where the RegionManager creates a TabWindow for the view-usercontrol. Then the user closes the tabwindow. Then on a later time he wants to open it again (for example by selecting from a menu). How can I recreate the View LoadModule("ModulaA") doesn't do anything the second time it is run, probably as the ModuleA still exist in the PRIS Module Manager.

    In general how do you handle this closing and reopening of a views?

  • 03-05-2010 15:51 In reply to

    Re: SandDoc and PRISM

    Hi,
    I'm currently impelenting region adapters based on Karthiks template.
    One thing that is stuck in my head:

    This is an example module:
    public class ModuleMap : IModule
        {
            private readonly IUnityContainer m_container;

            public ModuleMap(IUnityContainer container)
            {
                  m_container = container;
            }

            #region IModule Members
            public void Initialize()
            {
                SetView();
            }
            #endregion

            private void SetView()
            {
                var regionManager = m_container.Resolve<IRegionManager>();
                var view = m_container.Resolve<ViewMap>();
                regionManager.AddToRegion(RegionNames.Map, view);
            }
    }

    When this is run the first time using LoadModule("ModuleMap"), everything works fine and the view is displayed as expected in the region. Now if the user closes the TabWindow containing the view and then wants to reopen it (for example from a menu), how do you do that as LoadMoudule("ModuleMap") doesnnt instantiate a new ModuleMap probably as it still exist in the MoudleManager.

    In general how do you handle such closing and reopening of TabWindows with views using PRISM?

  • 03-08-2010 8:19 In reply to

    • IanD
    • Top 200 Contributor
    • Joined on 11-13-2009
    • Posts 8

    Re: SandDoc and PRISM

    throstur62:
    When this is run the first time using LoadModule("ModuleMap"), everything works fine and the view is displayed as expected in the region. Now if the user closes the TabWindow containing the view and then wants to reopen it (for example from a menu), how do you do that as LoadMoudule("ModuleMap") doesnnt instantiate a new ModuleMap probably as it still exist in the MoudleManager.

    In general how do you handle such closing and reopening of TabWindows with views using PRISM?

    Throstur62,

    I use a Factory pattern that resolves a particuliar module depending on certain conditions using the Unity Container, I then call the modules initialise method, so a simple example would be:

    IModule mod = _container.Resolve<MyModule>();

    mod.Initialise();

     

    Hope that helps

    Ian

     

     

     

Page 2 of 2 (18 items) < Previous 1 2 | RSS
Copyright © 2008 Divelements Limited
Powered by Community Server (Commercial Edition), by Telligent Systems