none
Prism 7.0 Registering Modules Using a Configuration File RRS feed

  • Question

  • I'm trying a hello world program in Prism.WPF 7.0. I m trying to load a module from app.config file. Which is not working. I'm using PrismApplicationsince isUnityBootstrapper Obsolete in Prism.WPF 7.0.

    My app.config as

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
        <section name="modules" type="Prism.Modularity.ModulesConfigurationSection, Prism.Wpf" />
      </configSections>
      <startup>
      </startup>
      <modules>
        <module assemblyFile="ModuleA.dll" moduleType="ModuleA.ModuleAModule, ModuleA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" moduleName="ModuleAModule" startupLoaded="True" />
      </modules>
    </configuration>

    My app.xaml.cs

    internal partial class App : PrismApplication
        {
            //ShellView _tempShellView;
            protected override Window CreateShell()
            {
                var _tempShellView = Container.Resolve<ShellView>();
                var _tempDataContext = Container.Resolve<ShellViewModel>();
                _tempDataContext.ShellWindowClose = new Action(() => _tempShellView.Close());
                _tempShellView.DataContext = _tempDataContext;
                _tempDataContext.Initialize();
    
                return _tempShellView;
            }
    
            protected override void InitializeShell(System.Windows.Window shell)
            {
                shell.Show();
            }
    
            protected override IModuleCatalog CreateModuleCatalog()
            {
                return new ConfigurationModuleCatalog();
                //return  new DirectoryModuleCatalog() {  ModulePath = Environment.CurrentDirectory };
            }
        }

    my ModuleAModule.cs

    public class ModuleAModule : IModule
        {
            IRegionManager _regionManager;
    
            public ModuleAModule(RegionManager regionManager)
            {
                _regionManager = regionManager;
            }
    
            public void Initialize()
            {
                _regionManager.RegisterViewWithRegion("ContentRegion", typeof(ViewA));
            }
        }

    When I try this code with 6.3 it's working onUnityBootstrapper Need help on this Prism.WPF 7.0


    Santhakumar Munuswamy http://www.san2debug.net

    • Moved by Bob Ding Tuesday, April 10, 2018 8:36 AM Redirection
    Tuesday, March 27, 2018 3:39 AM

All replies

  • I'm trying a hello world program in Prism.WPF 7.0. I m trying to load a module from app.config file. Which is not working. I'm using PrismApplicationsince isUnityBootstrapper Obsolete in Prism.WPF 7.0.

    My app.config as.

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
        <section name="modules" type="Prism.Modularity.ModulesConfigurationSection, Prism.Wpf" />
      </configSections>
      <startup>
      </startup>
      <modules>
        <module assemblyFile="ModuleA.dll" moduleType="ModuleA.ModuleAModule, ModuleA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" moduleName="ModuleAModule" startupLoaded="True" />
      </modules>
    </configuration>

    My app.xaml.cs

    internal partial class App : PrismApplication
        {
            //ShellView _tempShellView;
            protected override Window CreateShell()
            {
                var _tempShellView = Container.Resolve<ShellView>();
                var _tempDataContext = Container.Resolve<ShellViewModel>();
                _tempDataContext.ShellWindowClose = new Action(() => _tempShellView.Close());
                _tempShellView.DataContext = _tempDataContext;
                _tempDataContext.Initialize();
    
                return _tempShellView;
            }
    
            protected override void InitializeShell(System.Windows.Window shell)
            {
                shell.Show();
            }
    
            protected override IModuleCatalog CreateModuleCatalog()
            {
                return new ConfigurationModuleCatalog();
                //return  new DirectoryModuleCatalog() {  ModulePath = Environment.CurrentDirectory };
            }
        }

    my ModuleAModule.cs

    public class ModuleAModule : IModule
        {
            IRegionManager _regionManager;
    
            public ModuleAModule(RegionManager regionManager)
            {
                _regionManager = regionManager;
            }
    
            public void Initialize()
            {
                _regionManager.RegisterViewWithRegion("ContentRegion", typeof(ViewA));
            }
        }
    When I try this code with 6.3 it's working onUnityBootstrapper Need help on this Prism.WPF 7.0

    Santhakumar Munuswamy http://www.san2debug.net


    • Edited by Santhakumar Munuswamy Monday, March 26, 2018 3:20 PM updated
    • Moved by Fei Hu Tuesday, March 27, 2018 5:48 AM wpf related
    • Merged by Bob Ding Wednesday, March 28, 2018 1:31 AM same ques
    Monday, March 26, 2018 3:19 PM
  • http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf

    It's where you should post.

    Monday, March 26, 2018 3:42 PM
  • Hello,

    Thank you for your information, please let me know how to remove my post here


    Santhakumar Munuswamy http://www.san2debug.net

    Tuesday, March 27, 2018 3:43 AM
  • here is my github sample code every thing is working fine.
    Tuesday, March 27, 2018 9:44 PM
  • Hi,

    As this thread is related to Prism and support for Prism has moved to Stack Overflow.  

    Please post your query here for proper assistance: https://stackoverflow.com/questions/tagged/prism

    Best Regards,

    Bob


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Bob Ding Wednesday, March 28, 2018 2:26 AM
    Wednesday, March 28, 2018 1:27 AM