Document directory
- 1. Plug-in Container Management
- 2. algorithm assembler that can be automatically assembled
- 3. debug output
- 4. databases and data services
- 2. Interface System with automatic skin replacement
- 3. Relational Data Visualization controls
- 4. Statistical Chart controls
- 5. Geographical controls
- 1. Reflection Acceleration
- 2. Self-assembly menu
- 3. network communication library
- 4. serialization,. NET Remoting, etc.
I. Summary
To do well, you must first sharpen your tools. The tool can come from or be created by others. The first project I took into the lab was to develop an industrial software. Its system itself was really simple compared to the real commercial software. However, it is really appropriate to say that "the university is not suitable for software". The interaction of the whole system is complicated, design redundancy and maintenance are very difficult. After the project is completed, the entire system will be stored in the hard disk and there will be no more questions. Although I only developed one module, I still feel heartbroken.
I hope to have a mature and simple desktop framework to solve most desktop development problems: interface display, database, plug-in architecture, debugging output, and network connection. At the same time, we try to reduce the coupling between multiple developers. For this reason, I have learned about SharpDevelop and other open-source software, but its design is still too complicated for me. What is more important is code reuse. Why can't I provide services for another project and minimize the workload of integration? As a result, I have invested in the development of the first plug-in desktop framework class library from the last semester.
Today, as a base-class library, it provides services for three project software, namely XMOVE, data mining software in the lab, and Simulation Demonstration Program of LTE soft base stations.
The following is one of the software implemented based on XFrmWork-XMOVE Studio:
Next, we will briefly introduce the functions and implementations of this collection.
Ii. Basic Structure
XFrmWork is based on the wpf interface technology and. NET Framework 4.0. Plug-in structure design. The main framework contains five class libraries. Their names and functions are shown in:
The vast majority of UI controls adopt the MVVM structure, and use data binding to achieve interface and logical separation. All external open-source controls are abstracted by interfaces, so other controls with the same function can be used at any time without any changes to the upper-Layer Code.
At the same time, the framework is adding other class libraries, including the XFrmWork. MultiMedia library dedicated to MultiMedia functions, which is not described here because it has not been developed.
Iii. Introduction to system features-basic functions 1. Plug-in Container Management
To minimize the workload of component integration, the system adopts a plug-in tree-like design scheme. All functions are connected to the system through an assembled plug-in. It is very convenient to use. You only need to add the attribute identifier on the corresponding class.
The plug-in structure is similar to the Key-Value Pair: the Key is the interface required by the plug-in, and the value is the dictionary of the corresponding plug-in name. The manager can insert and delete data in the plug-in dictionary at any time (with security risks. For the specific implementation of the plug-in system, refer to my blog series.
The following is a list of plug-ins formed after the plug-ins are searched in the relevant directory:
You can learn in detail the keys and values of all plug-in dictionary in the current system ("plug-in interface List"), and provide the plug-in loading policies and details.
2. algorithm assembler that can be automatically assembled
In the field of scientific research and computing, the common problems are complex and diverse. Therefore, it is difficult to configure and operate on the GUI. However, I have borrowed the concept of Labview. Any complicated algorithm can be divided into different modules for assembly. Therefore, we only need to design different algorithm modules and define their interfaces. You can assemble and configure modules based on different problems to solve complicated problems.
A module can be understood as a "box" with an input/output interface. A box may contain multiple inputs or outputs. Execution can be performed only when all input values are met, but cannot be output to other boxes. Multiple boxes can be assembled as algorithm networks in complex forms to achieve automated processing. At the same time, different algorithms may be coupled and layered. The algorithm Management System layers and groups modules. Different groups have no interaction between modules, so they can be executed in parallel. Algorithms of the same group are sequentially executed from the first layer to the lower layer, similar to pipelines. In this blog post, I have detailed its implementation:
For example, the data statistics output module and the time series analysis module are divided into one group, but the modules at different layers first perform the Data Statistics Output and transmit the results to the time series analysis. In another group, the calculation methods A and B are both C inputs. The processing of A and B is completed in parallel during the runtime. When both tasks are completed, they are passed to the calculation method C, continue. It is worth noting that different groups are parallel and their execution does not interfere with each other.
3. debug output
Debugging is convenient for developers and users. Usually we use the debugging tool provided by VS. However, after software Release, an interface output tool is required.
I have used the log4.net component for debugging and output components. I will not go into details here. The following figure shows the implementation result:
It is worth mentioning that the component can display different colors according to different information levels (such as Debug, Info, or Error) to prompt users. These data can be easily saved as files or transmitted to the specified email address.
4. databases and data services
As the core of the software system, the author has developed multiple data-related modules.
From data in basic data 1 where gender is fselect data
Click search. The system will automatically parse the LINQ statement and execute the search function.
Iv. Introduction to system features-graphics and Visualization
1. AvalonDock-based class VS interface Layout System
Complex Software generally requires a customizable layout system. This framework uses the WPF version of AvalonDock open-source software. You can modify the layout at any time, drag and drop any component, and support different resolutions, it is even displayed on different monitors. At the same time, the system can save or load the saved layout.
2. Interface System with automatic skin replacement
The Dynamic Resources of WPF make it possible to achieve "dynamic skin replacement" that was almost impossible in the winform era. You can select the topic management menu in the upper-right corner of the software and select the Interface Effects of different styles.
3. Relational Data Visualization controls
In the data mining subproject, the relationship between data needs to be dynamically displayed and analyzed. Therefore, I designed a visualization control dedicated to displaying relational data, which has the following features:
- Link point styles and line styles can be dynamically defined through xaml or C # Code definition, which is obtained by the system during runtime reflection.
- 2D and 3D Effects
- Users can search, locate, zoom in and drag different points and canvases, and scale down the canvas
- The distribution algorithm supports multiple algorithms, such as random scatter and FDA (force-guided ).
- The layout can be dynamically displayed to display the network formation process.
Demonstrate Weibo user network (using star layout)
4. Statistical Chart controls
To facilitate statistics display, I used the open-source chart control WPFWisifire. At the same time, the interface isolation method is used to simplify the control implementation. Only a set of KeyValuePair sequences need to be passed during use to achieve the drawing. Supports columnar, linear, radar, and other types of charts. Shows the annual number of registered scientific research projects in China:
5. Geographical controls
Geographic graphics can help users analyze data more intuitively, so I use the open-source control GMap. Net to implement the map function. You can also use interfaces to isolate specific implementations, such as automatic locating, creating paths, adding, deleting, and modifying landmarks.
5. Other features and functions 1. Reflection acceleration features
To achieve better scalability, the author uses a large number of reflection in the program. to speed up, the author uses some techniques to improve the reflection performance, thus optimizing the user experience.
2. Self-assembly menu
The menu above the system is automatically assembled according to the plug-in interface, as shown in:
3. network communication library
By re-encapsulating basic functions such as socket, the author provides communication functions to facilitate upper-layer calls.
4. serialization,. NET Remoting, etc.
The author uses a number of technologies, so that the upper layer does not need to consider the serialization details of data storage. You only need to call a function to complete the process. For cross-process calls, the system uses. NET Remoting and other technologies. I will not go into detail here.
Vi. Summary
XFrmWork is the first complete class library set I implemented in. NET development. Frankly speaking, the great gods in the blog have already used or developed architecture systems that are much better than XFrmWork. But it is suitable for my own system. Driven by the needs of different projects, my team has promoted continuous upgrades. This also allows me to learn more. I will bid my brains for the search speed of its plug-ins, and absorb the architectural essence of various open-source software. In fact, it is enough for me to have such a platform. If it can be brought into my work, it must be the happiest thing.
Opening up all source code has no value. I will continue to share my development experience with you on the basis of "plug-in system loading" and "self-assembly module. Welcome to your attention.