My toolkit UI Layer base & winform + example

Source: Internet
Author: User

OK. Continue to the previous chapter. After the DB layer and business layer are completed, we will talk about the UI Layer. this part of content is the biggest difference for everyone. some people use Microsoft's standard controls, some use third-party control libraries, and some have their own settings.

Actually nothing. It will be okay if it is easy to use. you only need to think this is easy to use. don't take others too seriously. what you write is customized and can be used easily. A colleague chatted with his former colleagues at the wedding last year. He was also working on a framework. I asked him how he was doing? He said, now they are throwing things out, leaving only the core things. After listening, they seem to be above a level.

While we are still adding features, they have begun to return to the original market, the simplest is the best to use. well, let's continue with this stuff. after the introduction of the base layer of the business layer, the base project file of the UI Layer serves the same purpose, but its role is still very small, but some controls such as enumeration are defined. -1 and figure-2 show that there is nothing else to say. view by yourselfCodeRight

Figure-1

Figure 2

The winform project file on the UI Layer is obviously prepared for the winform software. it encapsulates a set of your own controls. Of course you can do it without having. encapsulation is relatively simple, but some attributes are added, and there are basically no extension methods. -3 and figure-4

Figure-3

Figure 4

The form name and description. If there are other typical forms, you can add them by yourself.

Form name

Description

Frmsheet

It is recommended that all new forms inherit from this

Frmsheetbill

Document form ancestor, used to edit data

Frmsheetlist

List form ancestor, used to display data in batches

Frmsheetlistgrid

List form ancestor, only one Grid Control

Frmsheetlistgridtree

List form ancestor, including Grid Control + tree control

In the encapsulation process, the control operation method is encapsulated in a class file separately, as shown in-5. It is a common method. You can check it directly.

Figure 5

There is an interface, please note. this is the iwinpanelhelper interface. The function of this interface is similar to the webpanel control that was previously posted in the post. It uses the previously mentioned data domain concept. let's take a look at the page shown in-6. how to load and operate this page from only one form to data?

Figure 6

-7. In the initial load event of the page, obtain the menu bar, toolbar, button, and right-click menu of the page. note: No matter whether it exists or not, the datatable object is returned. the last table_panelitem object stores the non-label controls involved in this page. the source data is shown in-8.

Figure-7

These data can be stored in the drop-down menu data source, initial value, mandatory or not, control status, and so on. call the createwinpanel method to register the data (you can also add these controls dynamically) and register the data on this page for future use. after a series of preparation work, let's see how data is loaded to the UI control in the case of modification operations? -9.

Figure-8

Figure-9

Code for retrieving data: item_model.gettabledataareabyname ("billmaster", this. Bid );

UI control Value assignment: This. setwinpanelcontrolvalue ("billmaster", table_billmaster.rows [0]);

Set the control status: This. setwinpanelcontrolstatus ("billmaster", this. editmode)

All three methods have a common parameter, namely, billmaster. when you read the code, you will know. it is equivalent to a identifier. take the UI control assignment method as an example. The function of this method is to assign the data of table_billmaster to the control where the data field is billmaster. the same is true for values, as shown in-10. during the whole process, we cannot see an SQL statement (both configured in XML), and the UI control this. textbox. text (you can control the value one by one ). it can be done in just a few ways, isn't it easy ?!

Figure-10

For all the code, see the frmauthorlist and frmauthorbill files in the Navi. plat. model. Author project file.

There is also a project named Navi. plat. assitools. winform. What is its function? It is a set of things that assists winform development, as shown in-11.

Figure-11

The frmhelpsimple page is a public help.

The frmmessage page displays prompts and progress bars for time-consuming operations.

The frmmsnpopup page is displayed in the lower right corner of the pop-up page like MSN. It is used to prompt information;

Description of the compressed package, as shown in-12

Figure-12

Navi. kernel. uilayer. Base, Universal Class Library at the UI Layer, called by webform and winform at the same time

Navi. kernel. UI. winform, winformui class library project file

Navi. plat. assitools. winform, auxiliary project file of winformui class library, and objects shown in-11

Navi. plat. model. Author, the development platform function system, a real business module

Navi. plat. example. winform, for exampleProgram, Can be directly run, add the naviplat0db_bak110520.bak database file provided in another compressed package, sqlserver2005, directly restore.

As of this post, all winform parts have been uploaded.

My toolset dB Layer

The business layer of my toolset is integrated with the download files provided by this post, which is a complete example.

 

ArticleNavigation

My toolset dB Layer

Business Layer of my toolset

My toolkit UI Layer base & winform + example

My tool set UI Layer Webform ( Including Webpanel & jqueryeasyui Complete code ) + Display Example

 

Code

Http://u.115.com/file/dn45p2qi #
Navi.kernel.uilayer.winform.rar

Extraction code:Dn45p2qi

Http://u.115.com/file/e60lns5s #
Naviplat10db_bak110520.rar

Extraction code:E60lns5s

 

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.