欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Wpf Prism.Unity 7

程序员文章站 2022-09-27 18:18:45
Prism.Unity 中UnityBootStrapper已经不用了,可以继承PrismApplication 1.Install-package Prism.Unity -v 7.2.0.1367 2. 3. ......

prism.unity 中unitybootstrapper已经不用了,可以继承prismapplication

1.install-package prism.unity -v 7.2.0.1367

2.

<prism:prismapplication x:class="wpfapplication2.app"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:wpfapplication2"
             xmlns:prism="http://prismlibrary.com/">
    <prism:prismapplication.resources>
         
    </prism:prismapplication.resources>
</prism:prismapplication>

3.

using prism.unity;
using system;
using system.collections.generic;
using system.configuration;
using system.data;
using system.linq;
using system.threading.tasks;
using system.windows;
using prism.ioc;
using commonservicelocator;
using prism.modularity;

namespace wpfapplication2
{
    /// <summary>
    /// app.xaml 的交互逻辑
    /// </summary>
    public partial class app:prismapplication
    {
        protected override void registertypes(icontainerregistry containerregistry)
        {
           
        }

        protected override window createshell()
        {
            return servicelocator.current.getinstance<mainwindow>();
        }

        protected override imodulecatalog createmodulecatalog()
        {
            return base.createmodulecatalog();
        }

        protected override void initializemodules()
        {
            base.initializemodules();
        }
    }
}