Initial test of composite UI Application Block

Source: Internet
Author: User
Test composite UI Application Block
The composite UI Application Block is mainly used to create an aggregated Smart Client solution. A client can be built from a group of functional blocks.
1. General steps for creating an application using composite UI
Create Shell
Create a module
Create a reference to services
Create and display smartparts
Developed with MVC and workitems
Create a customized service
Publish and subscribe to events
Use workitems
Show uielements
Register commands

The first attempt is to create only shell and use workitem and controller.
1. Create a winform application, add a main form form1, add the main menu in the form, and add menu items A and B. Generate click events for menu item A and item B respectively. Add deckworkspace to the form
2. modify the program class as a non-static class and inherit formshellapplication <workitem, form1>. In program, the beforeshellcreated and aftershellcreated methods and methods respectively call base. beforeshellcreated () and base. aftershellcreated (). You can add your own code after calling the base class method. Add new program (). Run ();
3. create custom controls view1 and view2. These two custom controls will be added to the deckworkspace of the main form. Add [smartpart] to the class name
4. Create myworkitem

Public class myworkitem: workitem
{
Private view1 _ view1;
Public void showview1 (iworkspace workspace)
{
If (_ view1 = NULL)
_ View1 = This. Items. addnew <view1> ("view1 ");
Workspace. Show (this. _ view1 );
}

Private view2 _ view2;
Public void showview2 (iworkspace workspace)
{
If (_ view2 = NULL)
_ View2 = This. Items. addnew <view2> ("view2 ");
Workspace. Show (this. _ view2 );
}
}

5. Create mycontroller

Public class mycontroller: Controller
{
Private workitem rootworkitem
{
Get {return base. workitem ;}
}

Private myworkitem _ myworkitem;
Public void showview1 (iworkspace workspace)
{
If (_ myworkitem = NULL)
_ Myworkitem = rootworkitem. Items. addnew <myworkitem> ();
_ Myworkitem. showview1 (workspace );
}

Public void showview2 (iworkspace workspace)
{
If (_ myworkitem = NULL)
_ Myworkitem = rootworkitem. Items. addnew <myworkitem> ();
_ Myworkitem. showview2 (workspace );
}
}

6. Inject mycontroller into form1
Private mycontroller controller;
[Createnew]
Public mycontroller Controller
{
Set {controller = value ;}
}

7. Add
Controller. showview1 (this. deckworkspace1 );
Controller. showview2 (this. deckworkspace1 );

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.