Chapter 1 has all ended so far, and the first example of Appendix H will be translated as planned ...... I feel that prism will work very well, really. 4. Use prism
Now you have seen most of the features and design methods provided by Prism. Now you should understand how to use Prism to create new applications.ProgramHow convenient it is. This section describes how to create a basic prism application. With these basic content, you can expand the features and design patterns provided by Prism as needed.
[Note]: prism not only allows you to easily create complex applications on the WPF and Silverlight platforms, but also allows you to use existing applications.
A typical prism application should contain a Shell project and several module projects. Shows the activities required to develop a complex prism project.
A typical prism application uses the features and design patterns described above to fully reflect the benefits of the loosely coupled and separated focus design patterns. However, this example only describes a basic prism application that contains shell and a view.
[Note]: references to the prism Library
Prism applications must reference the prism library file. The prism installation package provides the registration file. After registration, you can directlyAdd reference...In the dialog box. If you choose not to register, you need to manually add the reference. Of course, you can also add prism to your project, so that other projects only need to reference this project. Later, you can add some wizard to gradually use the prism type, as if prism now supports signature.
5. Define Shell
The shell of the application defines the basic layout of the program. The shell defines multiple regions where views can be placed. View, just like shell, you can define multiple regions to put the content in it, as shown in. Shell usually sets the style of the entire application.
6. Define bootstrapper
The startup wizard is the connector for applications and services, as well as the MEF framework and unity and Prism library. Each application has an independent startup wizard that inherits fromUnitybootstrapperAndMefbootstrapper, As shown in. You need to use the most appropriate module list. Each application should contain at least one module list and one shell.
Generally, the startup wizard records startup logs toTraceClass. If most applications need to implement their own log systems, they can also be embedded into the startup wizard.
Generally,UnitybootstrapperAndMefbootstrapperIs a prism service. You can disable it or use your own startup wizard.
7. Create a module
The module provides a view and service for some of the functions of the application. Modules are often divided into independent programming sets and developed by different teams. Each module is inherited byImoduleInterface Class. During initialization, these modules register their own views and services and add some of these views to shell. Based on your needs, you will set the attributes and dependencies of these modules.
8. Add model view for Shell
The module uses the shell area to add content. During initialization, the module usesRegionmangerTo locate which views are placed in shell or register multiple view types in the target region.RegionmangerTracks region changes throughout the application. It is a core service initialized by the startup wizard.
The following sections describe the key concepts of prism in detail.