"Translating" WPF Application Modular Development QuickStart (using PRISM+MEF)

Source: Internet
Author: User

Compiling and running a quick start

Need to run this QuickStart sample on VisualStudio 2010

Code Download: Modularitywithmef.zip

Rebuild the solution first

Then press F5 to run the example

Description

In this Quick Start sample solution,

Modularitywithmef.desktop Assembly

Added "Post-build event command line" when build succeeded

IF not EXIST "$ (TargetDir) \directorymodules"

mkdir "$ (TargetDir) \directorymodules"

The meaning of this command is:

If the Directorymodules directory is not in the bin directory of this Assembly

This directory is created

Pre-build Events/post-build Events command line macros see the MSDN Comment:

http://msdn.microsoft.com/zh-cn/library/aa833259 (v=vs.80). aspx

You can view the modification of these command lines in the build event, properties, assemblies

"Post-build event command line" when Moduleb assembly is successfully generated

xcopy "$ (TargetDir) ModularityWithMef.Desktop.ModuleB.dll"

"$ (SolutionDir) modularitywithmef.desktop\bin\$ (configurationname) \directorymodules\"/Y

Meaning is

Copy the DLL generated by itself into the Directorymodules directory

The moduled Assembly also has a similar command line

Other than that

DLLs generated by Modulee and Modulef are copied to the

Modularitywithmef.desktop assembly in the Debug directory

Drill

Run the program

1.

The main window consists of six modules

Each module shows its own initialization state.

When the application loads

The program discovers and initializes module A and module D

When the program starts, by monitoring the directory,

When moduled was discovered, it was initialized.

Can only be loaded when module A is available

Module a relies on module D

Module A is initialized when module D is loaded.

The tracking area at the bottom of the window shows the module initialization information

Attention:

If there is no dependency, the module is loaded without order.

2.

The mouse moves to the module a control and displays a descriptive hint, such as:

3.

The prompt information is:

The state of the current control, whether it is found,

Whether the information is initialized, download time and dependencies, etc.

4.

Click Module B and Module C

Initialization information for two modules will change

Clicking on these two modules will trigger the load events of these two modules

System Discovery module B by monitoring folder

Module C is directly referenced to the system.

These two modules are loaded only when they are needed.

5.

When you click on the module F,

Module E and module F are loaded. Such as

Although module F is first clicked

But for reasons of dependency

The system initializes the module E, then initializes the module F

Http://www.cnblogs.com/liulun/archive/2012/03/19/2405940.html

"Translating" WPF Application Modular Development QuickStart (using PRISM+MEF)

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.