Wpf Prism.Unity 7

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();
        }
    }
}

 

posted @ 2019-09-09 17:59  FredGrit  阅读(860)  评论(0编辑  收藏  举报