CN113064591A - WPF page dynamic generation method, system, equipment and medium - Google Patents

WPF page dynamic generation method, system, equipment and medium Download PDF

Info

Publication number
CN113064591A
CN113064591A CN202110196483.7A CN202110196483A CN113064591A CN 113064591 A CN113064591 A CN 113064591A CN 202110196483 A CN202110196483 A CN 202110196483A CN 113064591 A CN113064591 A CN 113064591A
Authority
CN
China
Prior art keywords
file
page
xaml
wpf
script
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110196483.7A
Other languages
Chinese (zh)
Inventor
李有财
陈方平
陈禹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian Nebula Electronics Co Ltd
Original Assignee
Fujian Nebula Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujian Nebula Electronics Co Ltd filed Critical Fujian Nebula Electronics Co Ltd
Priority to CN202110196483.7A priority Critical patent/CN113064591A/en
Publication of CN113064591A publication Critical patent/CN113064591A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a WPF page dynamic generation method, a system, equipment and a medium in the technical field of desktop application program development, wherein the method comprises the following steps: step S10, compiling the logic code and the interface code of the page through WPF, and performing preview operation; step S20, generating a logic script based on the logic code, and generating an interface script based on the interface code; step S30, compiling the logic script into a DLL file through a code manager, and compiling the interface script into an XAML file; the file names of the DLL file and the XAML file are the same; and step S40, after the page is started to run, associating the DLL file and the XAML file by the container control of the WPF based on the file name, executing the DLL file and the associated XAML file, loading the data generated by executing the DLL file to an interface generated by executing the XAML file, and completing the generation of the WPF page. The invention has the advantages that: the WPF page generation efficiency and flexibility are greatly improved.

Description

WPF page dynamic generation method, system, equipment and medium
Technical Field
The invention relates to the technical field of desktop application program development, in particular to a WPF page dynamic generation method, a WPF page dynamic generation system, WPF page dynamic generation equipment and WPF page dynamic generation media.
Background
WPF (Windows Presentation Foundation) is a Windows-based user interface Framework launched by Microsoft, belongs to a part of NET Framework 3.0, provides a uniform programming model, language and Framework, does the work of separation interface designers and developers, and provides a brand-new multimedia interaction user graphical interface.
In the process of WPF page development, since the functions and requirements of the WPF page can change from moment to moment along with the progress of a project, the completed function modules need to be modified from time to time. In order to reduce the workload increased by the change of functions and requirements, the easily-changed part and the difficultly-changed part of the WPF page need to be combed, and the post-modification work mainly aims at the easily-changed part.
Modification of the easily changeable portion, there are conventionally two methods as follows: the method is characterized in that firstly, the changed part is directly hard-coded and interpreted and modified in the main program, but the defects that the whole project cannot be completely recompiled even if the changed part is slightly modified, verification and backup are carried out after the program is updated and iterated, and the modification is not necessarily suitable for other clients, so that the versions are numerous and difficult to maintain are caused; the second method uses script, which is interpreted and executed during the operation of the project, but the efficiency is much lower than that of the compiled language which is directly compiled into the executable code of the computer, and the defects of insufficient powerful function and slow speed exist.
Therefore, how to provide a method, a system, a device and a medium for dynamically generating a WPF page to achieve improvement of efficiency and flexibility of WPF page generation becomes an urgent problem to be solved.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method, a system, a device and a medium for dynamically generating a WPF page, so as to improve the efficiency and the flexibility of WPF page generation.
In a first aspect, the present invention provides a WPF page dynamic generation method, including the following steps:
step S10, writing a logic code and an interface code of a page through WPF, and previewing the page;
step S20, generating a logic script based on the logic code, and generating an interface script based on the interface code;
step S30, compiling the logic script into a DLL file through a code manager, and compiling the interface script into an XAML file; the file names of the DLL file and the XAML file are the same;
and step S40, after the page is started to run, associating the DLL file and the XAML file by the container control of the WPF based on the file name, executing the DLL file and the associated XAML file, loading the data generated by executing the DLL file to an interface generated by executing the XAML file, and completing the generation of the WPF page.
Further, in step S20, the logic script is in C # format, and the interface script is in XAML format.
Further, in the step S30, the DLL file is generated by a system. The XAML file is generated by a system.
Further, in step S40, the executing the DLL file and the associated XAML file specifically includes:
the DLL file is executed by a system.reflection.assembly.unanswered load from method, and the XAML file associated with the DLL file is executed by a system.windows.markup.xaml reader.load method.
In a second aspect, the present invention provides a WPF page dynamic generation system, including the following modules:
the page code compiling module is used for compiling the logic code and the interface code of the page through the WPF and previewing the page;
the script generation module is used for generating a logic script based on the logic codes and generating an interface script based on the interface codes;
the script compiling module is used for compiling the logic script into a DLL file through a code manager and compiling the interface script into an XAML file; the file names of the DLL file and the XAML file are the same;
and the page generation module is used for associating the DLL file and the XAML file based on the file name, executing the DLL file and the associated XAML file, loading data generated by execution of the DLL file to an interface generated by execution of the XAML file and finishing the generation of the WPF page after the page is started and operated.
Further, in the script generation module, the logic script is in a C # format, and the interface script is in an XAML format.
Further, in the script compiling module, the DLL file is generated by a system. The XAML file is generated by a system.
Further, in the page generation module, the executing the DLL file and the associated XAML file specifically includes:
the DLL file is executed by a system.reflection.assembly.unanswered load from method, and the XAML file associated with the DLL file is executed by a system.windows.markup.xaml reader.load method.
In a third aspect, the present invention provides a WPF page dynamic generation apparatus, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement the method of the first aspect.
In a fourth aspect, the present invention provides a WPF page dynamic generation medium, on which a computer program is stored, which when executed by a processor implements the method of the first aspect.
One or more technical solutions provided in the embodiments of the present invention have at least the following technical effects or advantages:
the method comprises the steps of compiling a logic script generated based on a logic code into a DLL file, compiling an interface script generated based on the interface code into an XAML file, executing the DLL file and an associated XAML file after a page is started to operate, loading data generated by executing the DLL file onto an interface generated by executing the XAML file, and completing the generation of the WPF page.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
The invention will be further described with reference to the following examples with reference to the accompanying drawings.
FIG. 1 is a flowchart of a WPF page dynamic generation method of the present invention.
Fig. 2 is a schematic structural diagram of a WPF page dynamic generation system according to the present invention.
Fig. 3 is a schematic structural diagram of a WPF page dynamic generation device according to the present invention.
FIG. 4 is a schematic structural diagram of a WPF page dynamic generation medium according to the present invention.
Detailed Description
The embodiment of the application provides a method, a system, a device and a medium for dynamically generating a WPF page, so that the WPF page generation efficiency and flexibility are improved.
The technical scheme in the embodiment of the application has the following general idea: the method has the advantages that the script is compiled to improve the running efficiency of the script, the whole project does not need to be compiled again, redundant versions cannot be generated, developers do not need to learn a script language additionally, and the WPF page generation efficiency and flexibility are improved.
Example one
The embodiment provides a WPF page dynamic generation method, as shown in fig. 1, including the following steps:
step S10, writing a logic code and an interface (UI) code of a page through WPF, and previewing the page;
step S20, generating a logic script based on the logic code, and generating an interface script based on the interface code;
step S30, compiling the logic script into a DLL file (dynamic link library file) through a code manager, and compiling the interface script into an XAML file; the file names of the DLL file and the XAML file are the same; in concrete real time, a plurality of DLL files and XAML files can be generated at the same time, and each DLL file and each XAML file are associated through a file name;
and step S40, after the page is started to run, associating the DLL file and the XAML file by the container control of the WPF based on the file name, executing the DLL file and the associated XAML file, loading the data generated by executing the DLL file to an interface generated by executing the XAML file, and completing the generation of the WPF page. Only DLL files and XAML files generated following the MVVM mode can make the association of UI displays and logic code.
In step S20, the logic script is in C # format, and the interface script is in XAML format.
In the step S30, the DLL file is generated by a system. The XAML file is generated by a system.
In step S40, the executing the DLL file and the associated XAML file specifically includes:
the DLL file is executed by a system.reflection.assembly.unanswered load from method, and the XAML file associated with the DLL file is executed by a system.windows.markup.xaml reader.load method.
Example two
The embodiment provides a WPF page dynamic generation system, as shown in fig. 2, including the following modules:
the page code writing module is used for writing a logic code and an interface (UI) code of a page through WPF and previewing the page;
the script generation module is used for generating a logic script based on the logic codes and generating an interface script based on the interface codes;
the script compiling module is used for compiling the logic script into a DLL file (dynamic link library file) through a code manager and compiling the interface script into an XAML file; the file names of the DLL file and the XAML file are the same; in concrete real time, a plurality of DLL files and XAML files can be generated at the same time, and each DLL file and each XAML file are associated through a file name;
and the page generation module is used for associating the DLL file and the XAML file based on the file name, executing the DLL file and the associated XAML file, loading data generated by execution of the DLL file to an interface generated by execution of the XAML file and finishing the generation of the WPF page after the page is started and operated. Only DLL files and XAML files generated following the MVVM mode can make the association of UI displays and logic code.
In the script generation module, the logic script is in a C # format, and the interface script is in an XAML format.
In the script compiling module, the DLL file is generated by a System. The XAML file is generated by a system.
In the page generation module, the executing the DLL file and the associated XAML file specifically includes:
the DLL file is executed by a system.reflection.assembly.unanswered load from method, and the XAML file associated with the DLL file is executed by a system.windows.markup.xaml reader.load method.
Based on the same inventive concept, the application provides an electronic device embodiment corresponding to the first embodiment, which is detailed in the third embodiment.
EXAMPLE III
The embodiment provides a WPF page dynamic generation device, as shown in fig. 3, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program, and may implement any one of the embodiments.
Since the electronic device described in this embodiment is a device used for implementing the method in the first embodiment of the present application, based on the method described in the first embodiment of the present application, a specific implementation of the electronic device in this embodiment and various variations thereof can be understood by those skilled in the art, and therefore, how to implement the method in the first embodiment of the present application by the electronic device is not described in detail herein. The equipment used by those skilled in the art to implement the methods in the embodiments of the present application is within the scope of the present application.
Based on the same inventive concept, the application provides a storage medium corresponding to the fourth embodiment, which is described in detail in the fourth embodiment.
Example four
The embodiment provides a WPF page dynamic generation medium, as shown in fig. 4, on which a computer program is stored, and when the computer program is executed by a processor, any one of the embodiments may be implemented.
The technical scheme provided in the embodiment of the application at least has the following technical effects or advantages:
the method comprises the steps of compiling a logic script generated based on a logic code into a DLL file, compiling an interface script generated based on the interface code into an XAML file, executing the DLL file and an associated XAML file after a page is started to operate, loading data generated by executing the DLL file onto an interface generated by executing the XAML file, and completing the generation of the WPF page.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Although specific embodiments of the invention have been described above, it will be understood by those skilled in the art that the specific embodiments described are illustrative only and are not limiting upon the scope of the invention, and that equivalent modifications and variations can be made by those skilled in the art without departing from the spirit of the invention, which is to be limited only by the appended claims.

Claims (10)

1. A WPF page dynamic generation method is characterized in that: the method comprises the following steps:
step S10, writing a logic code and an interface code of a page through WPF, and previewing the page;
step S20, generating a logic script based on the logic code, and generating an interface script based on the interface code;
step S30, compiling the logic script into a DLL file through a code manager, and compiling the interface script into an XAML file; the file names of the DLL file and the XAML file are the same;
and step S40, after the page is started to run, associating the DLL file and the XAML file by the container control of the WPF based on the file name, executing the DLL file and the associated XAML file, loading the data generated by executing the DLL file to an interface generated by executing the XAML file, and completing the generation of the WPF page.
2. The WPF page dynamic generation method of claim 1, wherein: in step S20, the logic script is in C # format, and the interface script is in XAML format.
3. The WPF page dynamic generation method of claim 1, wherein: in the step S30, the DLL file is generated by a system. The XAML file is generated by a system.
4. The WPF page dynamic generation method of claim 1, wherein: in step S40, the executing the DLL file and the associated XAML file specifically includes:
the DLL file is executed by a system.reflection.assembly.unanswered load from method, and the XAML file associated with the DLL file is executed by a system.windows.markup.xaml reader.load method.
5. A WPF page dynamic generation system is characterized in that: the system comprises the following modules:
the page code compiling module is used for compiling the logic code and the interface code of the page through the WPF and previewing the page;
the script generation module is used for generating a logic script based on the logic codes and generating an interface script based on the interface codes;
the script compiling module is used for compiling the logic script into a DLL file through a code manager and compiling the interface script into an XAML file; the file names of the DLL file and the XAML file are the same;
and the page generation module is used for associating the DLL file and the XAML file based on the file name, executing the DLL file and the associated XAML file, loading data generated by execution of the DLL file to an interface generated by execution of the XAML file and finishing the generation of the WPF page after the page is started and operated.
6. The WPF page dynamic generation system of claim 5, wherein: in the script generation module, the logic script is in a C # format, and the interface script is in an XAML format.
7. The WPF page dynamic generation system of claim 5, wherein: in the script compiling module, the DLL file is generated by a System. The XAML file is generated by a system.
8. The WPF page dynamic generation system of claim 5, wherein: in the page generation module, the executing the DLL file and the associated XAML file specifically includes:
the DLL file is executed by a system.reflection.assembly.unanswered load from method, and the XAML file associated with the DLL file is executed by a system.windows.markup.xaml reader.load method.
9. WPF page dynamic generation device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any one of claims 1 to 4 when executing the program.
10. A WPF page dynamic generation medium having stored thereon a computer program, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1 to 4.
CN202110196483.7A 2021-02-22 2021-02-22 WPF page dynamic generation method, system, equipment and medium Pending CN113064591A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110196483.7A CN113064591A (en) 2021-02-22 2021-02-22 WPF page dynamic generation method, system, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110196483.7A CN113064591A (en) 2021-02-22 2021-02-22 WPF page dynamic generation method, system, equipment and medium

Publications (1)

Publication Number Publication Date
CN113064591A true CN113064591A (en) 2021-07-02

Family

ID=76558815

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110196483.7A Pending CN113064591A (en) 2021-02-22 2021-02-22 WPF page dynamic generation method, system, equipment and medium

Country Status (1)

Country Link
CN (1) CN113064591A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115269058A (en) * 2022-09-29 2022-11-01 广州市保伦电子有限公司 WPF resource loading method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060136890A1 (en) * 2004-12-16 2006-06-22 Microsoft Corporation Method and apparatus for providing DLL compatibility
CN104090765A (en) * 2014-07-16 2014-10-08 福建天晴数码有限公司 Method and device for switching from mobile game to webgame
CN107092507A (en) * 2017-04-18 2017-08-25 杭州云永网络科技有限公司 Skin change method, the apparatus and system of application program

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060136890A1 (en) * 2004-12-16 2006-06-22 Microsoft Corporation Method and apparatus for providing DLL compatibility
CN104090765A (en) * 2014-07-16 2014-10-08 福建天晴数码有限公司 Method and device for switching from mobile game to webgame
CN107092507A (en) * 2017-04-18 2017-08-25 杭州云永网络科技有限公司 Skin change method, the apparatus and system of application program

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
符斌 等: "触控式航海模拟器人机交互系统优化设计", 舰船科学技术 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115269058A (en) * 2022-09-29 2022-11-01 广州市保伦电子有限公司 WPF resource loading method and device
CN115269058B (en) * 2022-09-29 2023-01-24 广州市保伦电子有限公司 WPF resource loading method and device

Similar Documents

Publication Publication Date Title
US8429619B2 (en) Executable high-level trace file generation system
RU2390830C2 (en) Division of test automation into stack levels
WO2021057252A1 (en) Service processing flow configuration method and apparatus, and service request processing method and apparatus
JPH04178833A (en) Method for supporting software reuse
US11561890B2 (en) Automated videogame testing
CN110599341A (en) Transaction calling method and system
CN113064591A (en) WPF page dynamic generation method, system, equipment and medium
JP6984565B2 (en) Information processing equipment and programs
CN111971655B (en) Native runtime techniques for hypertext markup language graphics content
CN112036142A (en) Real-time report generation method and system based on data configuration
CN111596923B (en) Haxe static link library construction method and device and electronic equipment
CN104750482A (en) Method for constructing dynamic script execution engine based on MapReduce
KR20190075508A (en) Computing system and method for automatically generating embedded software on virtualized system
CN114518875A (en) Graphical programming system and programming method thereof
JP2012048329A (en) Object oriented program generating device, method therefor and program
CN112445607A (en) Method and device for executing method function by application program
JP2002116911A (en) Automatic generation device for object-oriented program
CN110134405B (en) Method and device for flexibly uploading data to manufacturing execution system
CN113590166B (en) Application program updating method and device and computer readable storage medium
JP2011165051A (en) Development support device, method and program
JP5589722B2 (en) Transition inspection program creation device, transition inspection program creation method, and transition inspection program creation program
CN116185422A (en) CAA secondary development method and system based on VsCode
KR101877841B1 (en) Method for Developing Add-in Program in Aveva Marine CAD System
CN113485726A (en) Application environment delivery method and device
CN111008120A (en) Simulation calculation performance test method and device of GPU

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination