Winform development framework [dynamic DLL read mode]

Source: Internet
Author: User

Several of my friends who used the previous development framework used it in the project also gave me valuable comments. Although there have been no updates recently, I have made some suggestions for my friends, I have carefully reviewed these questions. I have integrated many comments into the system and modified the deficiencies. I wanted to handle the report, however, the results of several solutions are lost. A friend once said that he liked my framework for reading DLL files. I used to think it was quite messy and the code was quite messy, sometimes I think it takes a long time to understand what the code means. At that time, I abandoned this framework because I thought the size of the entire project would grow bigger and bigger, because every form is a class library, then compiled as a DLL file, the program reads and loads these DLL files, so the method of writing them directly in the bamboo program is described in detail here:

Http://www.cnblogs.com/allen0118/archive/2012/05/10/2494112.html

In this way, there is also a problem. The main program's exe is getting bigger and bigger. I think this is the case in theory. So I have been busy recently and reorganized the original framework, there are several major changes:

1. Each form is a class library that implements corresponding interfaces.

2. When you open a form, instead of directly opening the form, you load the DLL file and read the information in the DLL file.

3. The business implemented by each form is still completed in its own class file.

4. You only need to put the generated DLL file in the specified directory for the program to read.

Implement the following services in the newly created Project:

1 using system; 2 using system. collections. generic; 3 using system. text; 4 5 using CP. kernel. base; 6 7 namespace sysusergroup 8 {9 [serializable] 10 public class plugins: ipugins11 {12 private frmusergroup F; 13 public void activate () 14 {15 F. activate (); 16} 17 Public void dispose () 18 {19 F. close (); 20 GC. collect (); 21 GC. suppressfinalize (this); 22} 23 public void hide () 24 {25 F. close (); 26} 27 28 Public String name29 {30 get {return "";} 31} 32 33 Public String guid34 {35 get {return "f2080504b6dc4963bc0963fefa0e1aad ";} 36} 37 38 public string version39 {40 get {return "1.0.0.0";} 41} 42 43 Public String manufacturer44 {45 get {return "manufacturer ";} 46} 47 48 Public String description49 {50 get {return "used to set role information";} 51} 52 53 Public String tcode54 {55 get {return "jszl ";} 56} 57 58 Public String frmurl59 {60 get {return "sysusergroup. DLL ";} 61} 62} 63}

Enter the imported DLL file here:

 1  public void  LoadDLL(string DllName) 2         { 3             try 4             { 5                 if (DllName.Substring(DllName.Length - 4).ToUpper() == ".DLL") 6                 { 7                     DllName = DllName.Replace(".dll", ""); 8                 } 9 10                 if (string.IsNullOrEmpty(DllName))11                     return;12 13                 if (!allenSingleton.DicLoadDll.ContainsKey(DllName))14                 {15                     IPugins objLoadDll;16                     if (allenSingleton.DicPugins.ContainsKey(DllName))17                     {18                         objLoadDll = allenSingleton.DicPugins[DllName];19                     }20                     else21                     {22                         objLoadDll = CPUtility.LoadDll(DllName);23                     }24 25                     if (objLoadDll != null)26                         objLoadDll.Show(dockPanel, DockState.Document);27 28                     allenSingleton.DicLoadDll.Add(DllName, objLoadDll);29                 }30                 else31                 {32                     allenSingleton.DicLoadDll[DllName].Activate();33                 }34             }35             catch (Exception ex)36             {37                 ShowMsg(ex.Message);38             }39 40 41         }42        

Compared with the previous one, this framework does not change data processing and still uses stored procedures to implement business logic. The SQL statements are basically invisible in the program. The layout and style also follow the previous practices, it is still the layout mode of Multi-document, and the overall effect is relatively generous. The main change is the core part. It can be said that the current set of programs is completely different from the previous set of core content, there are also some improvements in coupling. For example, all the loaded forms are DLL:

 

General results:

 

 

Preview the multi-Document Layout mode:

 

 

Let's take a 10-day holiday on May Day, and then take a few days off. We can finally have a good rest. I plan to optimize it when I come back on May Day. I wish you a pleasant stay on May Day!

 

 

 

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.