Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
395 views
in Technique[技术] by (71.8m points)

prism - How to implement the new PrismApplication to replace the Bootstrapper class

Since the Bootstrapper Class is obsolete with Prism 7 I would like to change my C# WPF App using the PrismApplication Class.

Does anybody know how to refactor a Prism 6 App using the Bootstrapper : UnityBootstrapper to the new PrismApplication?

I′m asking because the documentation regarding those pre-releases is pretty limited and I am not the best in understanding what I need to do from just looking at the Prism source code.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It depends on what your bootstrapper does, but Prism.Unity.PrismApplication has similar methods to override, so you should be able to copy the code over from the bootstrapper. Probably you only need RegisterTypes and CreateShell. Remember to update App.xaml to change the type of your application...

App.xaml should be something like this:

<prism:PrismApplication x:Class="WpfApp1.App"
                        x:ClassModifier="internal" 
                        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        xmlns:prism="http://prismlibrary.com/"/>

and for completeness' sake, App.xaml.cs:

internal partial class App
{
    protected override void RegisterTypes(IContainerRegistry containerRegistry)
    {
        throw new NotImplementedException();
    }

    protected override Window CreateShell()
    {
        throw new NotImplementedException();
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...