Key prism concepts:

Source: Internet
Author: User
Modules : A module is a function package that can be dynamically developed, tested, and deployed. In many cases, modules are developed and maintained by different teams. A standard prism Program Is created into multiple modules. A module can be used to present specified business relationship functions (such as user data management) and encapsulate all views, services, and data models used to implement these functions. Modules can also be used to encapsulate common infrastructure (Public modules) or services (such as logon and exception management services), which can be reused by multiple applications. Module catalog: In a combined application, modules must be discovered and loaded by the Host Program at runtime. In prism, the Module Directory is used to specify which modules are loaded, when they are loaded, and how to load them along the way. The Module Directory is? The modulemanager and moduleloader components are used to download remote modules, load a collection of modules to the application domain, and then initialize these modules. Prism allows the Module Directory to be implemented in different ways, including in C # Code Is declared in XAML or in a configuration file. You can also implement a custom Module Directory if needed. Shell: shell is the program host for Loading modules (similar to the main framework of the program, which is usually relatively simple. Different views will be loaded to form a complete functional program UI ). Shell defines the overall layout and structure of the program, but usually does not realize the exact modules that he will use. It often implements some common program services or infrastructure, but the functions and content of most programs are implemented in the module. Shell also provides upper-layer windows or visual elements. These windows and elements are then used to accommodate different UI components provided by loaded modules. Views: Views are some UI controls used to encapsulate the UI areas with special features or functions of a program. Views are coordinated by mvvm mode. mvvm is used to provide important separation of UI, Program Representation logic, and data. View is used to encapsulate the UI and define user interaction behaviors. Therefore, the running view is updated or replaced, which is independent of the underlying logic of the application. The view uses data binding to communicate with viewmodel and presenter classes. View models and presenters: View models are some classes that encapsulate the logic and State presented by applications. They are part of the mvvm design model, which encapsulates many application functions. Presenters and view models are a bit like each other. They are used to encapsulate the logic and state of the presentation. They are part of the MVP model. Viewmodel and presenters define properties, commands, and events for controls that can be bound to data in those views. Models: The model class encapsulates application data and business logic. They are used as part of the mvvm and MVP model. The model ensures data consistency and integrity by encapsulating data and any related verification and business rules. (Therefore, it is right to add some business logic in get/set) Commands: Commands allow definition and testing independent of the app UI, which are used to encapsulate the app's functions. (Commands are used to encapsulate application functionality in a way that allows them to be defined and tested independently of the application's UI. retain the original sentence. I think it is better to understand the original sentence than my translation.) In the view model and presenter, commands can be defined as command objects or command methods. Prism provides the delegatecommand class and compositecommand class, which are used to indicate the command sets that are called together. Regions: Regions is a logical placeholder defined in the application UI (in shell or other views), and the view is displayed in it. Regions allows you to update the layout of the application UI without changing the program logic. Many common controls are used as regions, allowing the view to be automatically displayed in the control, like contentcontrol, itemscontrol, ListBox, or tabcontrol. Views can be displayed in Region programmatically or automatically. Prism also supports using regions for navigation. Regions can be located in other components through the regionmanager component. regionmanager uses the regionadapter and regionbehavior components to adjust the view displayed in a regions. Navigation: As a result of user interaction with the program or internal state change of the program, navigation is defined as a process caused by application coordinate change.   Navigation is defined as the process by which an application coordinates Changes to its UI as a result of a user's interaction with the application or Internal application state changes. Prism supports two types of navigation: status-based navigation, which implements a simple navigation scenario when an existing view updates the status; and view-switched navigation, in the application UI, when a new view is created and the old navigation is replaced. View-switching uses URI-based navigation to coordinate with prism regions and allows flexible navigation solutions. Event aggregator: Components in a composite Program often need to communicate with other components and services in the program in a loosely coupled manner. To support this, Prism provides the eventaggregator component to implement the event mechanism in the publish-subscribe mode, which allows the component to publish events and allows other components to subscribe to these events without reference. Eventaggregator is often defined to communicate with other components in different components. Dependency injection container: The dependency injection mode runs through the entire prism and is used to manage dependencies between components. Dependency injection allows the component to implement dependencies at runtime, and it also supports scalability and testing. Prism is designed to work with unity and MEF by using servicelocator, or with any other dependency injection container. Services: Services are components that encapsulate functions unrelated to the UI, such as logs, exception management, and data access. A service can be defined by a module in an application or application. Services are often registered using dependency injection containers so that they (services) can be set and constructed as needed, and used by other service-dependent components. Controllers: Controllers are classes used to set the views displayed in the application's region for construction and initialization. The Controller encapsulates the presentation logic that determines which view to display. The controller uses the prism view toggle navigation mechanism, which provides an extensible URI-based navigation mechanism to set the view in the construction and layout of the regions. The controller mode of the program defines an abstract concept to map these responsibilities. Bootstrapper: The START loader component is used by the program to initialize various prism components and services. It is used to initialize dependency injection containers to register components and servers at any application layer. It is also used to configure and initialize the view and presenter of the Module Directory and shell. Multi-targeting: Prism supports the development of WPF and Silverlight objects. By using the mode of separation performance, like mvvm and MVP mode, you can separate the UI of the program from the program performance and business logic. Viewmodel, presenter, and model classes can be reused in the WPF and Silverlight versions of the same program (many WPF and Silverlight programs share a set of code ). Specific WPF and specific Silverlight views can be defined by encapsulating their respective UIS.

Prism is designed so that you can independently use any of the capabilities and design patterns mentioned above, or use them together, depending on your needs and application solutions. You can use mvvm mode, modularity, regions, commands, or any combination of them without using them all. Of course, if you want to obtain all the advantages of separation of focus and loose coupling, you need to use a lot of capabilities and design patterns in PRISM to coordinate them. The following figure shows a typical PRISM program architecture and explains how these prism capabilities work in a multi-module compound program. Most prism programs are composed of a shell application, which defines the regions used to display the upper-layer view and shared services that can be accessed by the loaded modules. This shell defines a suitable directory to specify which module is loaded at startup or needs to be loaded immediately, depending on the situation. A dependency injection container is also defined, which allows components to implement dependencies at runtime. When the program starts, start the loader and use container to register shared services and components. A separate module encapsulates a portion of all application functions, and then defines views, view models, models, and service components using a design pattern similar to mvvm's separation performance. When a module is loaded, the view defined in the module is displayed in the shell definition regions. After Initialization is complete, the user navigation that uses the status or view-based switch in the application will navigate to To Set visual updates or display the new view in regions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.