当前位置:网站首页>Prism framework

Prism framework

2022-06-26 03:44:00 yuyue5945

Prism Framework application - Basic knowledge

Prism Frame concept

prism was the code name for the guidance formally known as the Composite Application Guidance for WPF and Silverlight. For brevity and conciseness, and due to customer demand, this guidance is now referred to simply as Prism.

Prism Used to develop multiple interfaces 、 Rich data and interactive features WPF and Silverlight The specific presentation and business logic of the application .

Prism The purpose of the framework application is

  • Decoupling between modules
  • UI Decouple from background development
  • Reduce functional coupling at the beginning of programming

Prism Frame details

Frame diagram

 Frame structure

Introduction to framework module

Modoules:Modules Is able to independently develop 、 test 、 Deployed functional units ,Modules Modules that can be designed to implement specific business logic ( Such as Profile Management), It can also be designed as a module to implement a common infrastructure or service ( Such as Logging、Exception Management)

Module Catalog: stay Prism in ,Module Catalog It is indicated that Load Which? Module, In what order Load these Module.

Shell:Shell It's the host application (host application),modules Will be load To Shell in .Shell Defines the overall layout and structure of the application , And don't care about the boarders Module,Shell It is usually implemented in general application service and infrastructure, The logic of application is realized in the concrete Module in , meanwhile ,Shell It also provides a top-level window for the application .

Views:Views It's a view that shows specific functions in the application , It shows UI、 Define interaction behavior , And through data binding with ViewModel Interact .

Regions:Regions It's the app UI The logical region of , It's very much like a PlaceHolder,Views stay Regions Show , Many kinds of controls can be used as Region:ContentControl、ItemsControl、ListBox、TabControl.Views Can be in Regions Programming or auto rendering ,Prism Also provided Region Navigation support .

Navigation:Prism Support two kinds of navigation :state-based Navigation and view-switching Navigation .

EventAggregator: Components usually communicate with other components or services . So ,Prism Provides
EventAggregator Components , This component implements pub-sub Event mechanism , Allow some components to publish Events , Other components subscribe to events without a reference between the two components .

Dependency Injection container:Prism Use dependency injection pattern to manage dependencies between components ,Prism Designed to use Unity、Mef And so on .

Services:Services It's used to realize non UI The logic of the relevant functions , for example logging、exception management、data access.Services Can be defined in an application or Module in ,Services Usually registered in a dependency injection container , Make it easy for other components to locate this service .

Controllers:Controller Used to control in Region Which one of them View Will be presented , Control this at the same time View Creation and initialization of .

MVVM Related modules

View Model and Presenters:View Model To encapsulate an application UI Logic and its state .

Model:Model Is used to encapsulate data and corresponding validation , And relevant business rules to ensure the consistency and correctness of the data .

Commands:Command Is used to encapsulate application functions ,Prism Provides Delegate Command and CompositeCommand Two classes .

Bootstrapper:Bootstrapper To initialize application level components and services , It is also used to configure and initialize module catalog and Shell Of View and View Model. The function is shown in the figure :

To configure and initialize module catalog and Shell Of View and View Model. The function is shown in the figure :

bootstrapper

原网站

版权声明
本文为[yuyue5945]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202180546225429.html