Silverlight-Caliburn application framework 1
Silverlight-Caliburn application framework 2
Silverlight-Caliburn application framework 3
Silverlight-Caliburn application framework 4
Silverlight-Caliburn application framework 5
Silverlight-Caliburn application framework 6
In the previous article, we had a preemptible impression on cailburn. In this article, we will take a look at the Caliburn framework.
The Caliburn framework supports the MVC, MVP, mvvm, commands, and app controller modes to support uidesign. In this way, it provides a solution to common UI architecture problems,
This also reduces the use of dependency injection containers.
The Caliburn framework provides several important features:
Action: Caliburn extends the capabilities of SL that cannot be bound to a method. It provides gesture, additional events, and other persistent APIs for some related classes. This method is bound to remove MVP and mvvm.CodeIn addition, the Caliburn action mechanism can pass parameters to the method from the UI and bind the returned results to the UI. It also provides a filter mechanism for the decoration method, these filters can be disabled, collapsed, and hidden to affect the UI. Caliburn can also execute asynchronous methods and callbacks, and the framework itself has processed the thread.
Command: command can solve the problem that Server Load balancer does not support command before. Command is built on action and can naturally share some features, such as supporting multiple input parameters, filters, and asynchronous execution, in this example, the parent command can not only execute multiple sub-commands, but also affect the sub-commands in multiple ways.
APP model: Caliburn supports MVP-based and mvvm-based UI architecture through the ipersenter interface. It activates, disables, and closes various UI components through presenter, presentermanager, and multipresenter.
Convention: as mentioned in Article 1st, Caliburn defines some basic specifications for obtaining corresponding views and binding actions. You can also customize this part by yourself.
Testability: Caliburn provides rich support for test data binding, and defines an interface for verifying the change notification of an object, the Caliburn binding check can accurately tell you the problem and related error information.
Utilities: Caliburn provides a wide range of classes and extension methods. The most popular among them is the execute static class.
The above mainly describes several features of cailburn. This part is my translation from the official website. It is also the first time to translate technical documents. If you have any incorrect understanding, please correct me! In fact, I can also see that the translation content is also focused, because the two main points I pay attention to are action and command. For other parts, if you are interested, you can go to the official website to learn about them.
In this article, let's take a look at the configuration of the Silverlight application Caliburn framework. After creating a project, add the DLL first:
Caliburn. Core. dll,
Caliburn. presenationframework. dll,
Microsoft. Practices. servicelocation. dll
This is described in detail in Article 1, mainly in the following section:
Now we need to configure in APP. CS
First, reference the namespace
UsingCaliburn. core;
UsingCaliburn. presentationframework;
Modify application_startup now
Private VoidApplication_startup (ObjectSender, startupeventargs E)
{
Caliburnframework. configurecore (). withpresentationframework (). Start ();
This. Rootvisual =NewMainpage ();
}
This line of code configures the core framework and various features in calibrun to the application Program . At this time, the program can be compiled, you can also inherit from the caliburnapplication class as demonstrated in the first article. This is the simplest configuration method. In addition, there are many methods to customize the configuration, because in essence, caliburn is a collection of a series of UI services, so any service can be configured separately, but this situation is relatively small, caliburn is mainly used to expand the dependency injection container. The preceding example shows Caliburn's simple configuration through di container by default. It can also be configured through the iservicelocator interface, this is not my concern. If necessary, please refer to the relevant documentation.