WPF-based web application development method and device, computer device and storage medium
By registering identifier objects in WPF forms, web applications can directly call WPF functions, solving the code migration and upgrade problems of traditional WPF desktop applications, achieving efficient web application development and rapid response capabilities, and improving user experience and development efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-23
- Publication Date
- 2026-03-24
AI Technical Summary
In the traditional financial sector, the development of WPF desktop applications requires code migration and frequent code upgrades, which affects user experience and operational efficiency, and also requires a large investment of human and material resources in a rapidly changing market environment.
By establishing preset objects, deploying functional modules and bridging information, creating WPF forms and registering identity objects, web applications can directly call the functions of WPF forms, realizing bridging and asynchronous interaction between WPF and web applications.
No need to consider C# development; directly develop new projects or optimize existing projects within web applications, improving development efficiency and speed, supporting asynchronous deployment, reducing the impact of client installations and upgrades, and enhancing support for production environments.
Smart Images

Figure CN115686596B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of development, and particularly relates to a WPF-based Web application development method and device, computer equipment and a storage medium. BACKGROUND
[0002] In the traditional financial field, the software for managing business used by traders is mostly in the form of desktop application. In most desktop application fields, WPF (Windows Presentation Foundation) occupies a certain market, but WPF uses c# as the development language, which determines that its size will have certain requirements. Not only do the developers need to have a certain entry threshold, but in the rapidly changing financial market, companies often need to invest a lot of manpower, material resources and financial resources to cope with changes and needs. Moreover, when encountering a scenario in which a project needs to use a certain module instance of another project, if the desktop program solution is always used, it means that code migration needs to be done and incorporated into the new project. In addition, some urgent bug problems in the production environment will be encountered. In the past support, the software needs to be deployed to the user's computer, or they need to manually upgrade the new version, which greatly affects the operation process and user experience. SUMMARY
[0003] The main purpose of the present application is to provide a WPF-based Web application development method and device, computer equipment and a storage medium, aiming to solve the problem of code migration when developing a project in a desktop program.
[0004] To achieve the above purpose, the present application provides a WPF-based Web application development method, comprising the following steps:
[0005] A preset object is established, and a plurality of different function modules and corresponding attribute information are deployed in the preset object, wherein the attribute information includes bridge information of WPF and Web application;
[0006] A plurality of WPF windows are created, and the attribute information of the preset object is copied to each WPF window;
[0007] According to the attribute information, an identification object corresponding to the preset object is registered in each WPF window, wherein each identification object has a unique corresponding mark corresponding to the WPF window corresponding thereto;
[0008] Send attribute information of each of the identification objects to the Web application, and register in the Web application according to the bridge information, so that each of the WPF windows can open the Web application, and the Web application can call the corresponding identification object in each of the WPF windows;
[0009] Obtain a user instruction, and open the Web application in the WPF window according to the user instruction;
[0010] Receive a calling instruction input by a user through the Web application, obtain a corresponding function module according to the calling instruction, and execute a function corresponding to the function module.
[0011] Further, after the step of creating a plurality of WPF windows and copying attribute information of the preset object to each of the WPF windows, the step includes:
[0012] Detect a cache amount of the current WPF window;
[0013] Compare the cache amount with a preset value;
[0014] If the cache amount of the current WPF window reaches the preset value, empty the cache of the WPF window according to a preset emptying cache algorithm.
[0015] Further, the step of obtaining a user instruction and opening the Web application in the WPF window according to the user instruction includes:
[0016] Obtain Web page information input by a user, and calculate a data amount of the Web page information;
[0017] Determine whether the data amount exceeds a preset threshold value;
[0018] If not, directly open the Web application in the WPF window;
[0019] If yes, obtain pre-rendered Web page information according to the Web page information, pre-render the Web application by using Webpack technology according to the pre-rendered Web page information, and open the Web application in the WPF window.
[0020] Further, after the step of obtaining a user instruction and opening the Web application in the WPF window according to the user instruction, the step includes:
[0021] Obtain a first coordinate of a mouse cursor relative to a screen plane coordinate system and a second coordinate of the mouse cursor relative to a plane coordinate system of any one of the WPF windows used to open the Web application, and take a ratio of the first coordinate to the second coordinate as a coordinate conversion relationship.
[0022] acquiring a third coordinate of the mouse click position in a screen plane coordinate system;
[0023] converting the third coordinate and positions of the WPF windows relative to the screen plane coordinate system according to the coordinate conversion relationship;
[0024] displaying the WPF windows in a preset display range of a zoom control according to the conversion result.
[0025] Further, the step of receiving a calling instruction of user input through the Web application, and acquiring a corresponding function module according to the calling instruction, and executing a function corresponding to the function module, comprises:
[0026] splitting each function module to form a micro-service component corresponding to each function module; wherein the micro-service component can be used independently;
[0027] acquiring a corresponding micro-service component according to the calling instruction, and executing a function corresponding to the micro-service component.
[0028] Further, the step of receiving a calling instruction of user input through the Web application, and acquiring a corresponding function module according to the calling instruction, and executing a function corresponding to the function module, comprises:
[0029] receiving a calling instruction of user input through the Web application;
[0030] determining a function type according to the calling instruction;
[0031] detecting whether a function unit of the same function type exists in a preset function library in the WPF window according to the function type;
[0032] if it exists, calling the function unit in the function library, and executing a function corresponding to the function unit.
[0033] Further, the step of registering an identification object corresponding to the preset object in each WPF window according to the attribute information, wherein each identification object has a unique mark corresponding to the WPF window to which it corresponds, comprises:
[0034] acquiring a current time, and generating a time stamp according to the current time;
[0035] generating the identification object corresponding to each WPF window according to the attribute information and the time stamp;
[0036] Each of the identification objects communicates with the Web application and informs the name of the preset object.
[0037] The application further provides a WPF-based Web application development device, which comprises:
[0038] A building unit is configured to build a preset object, wherein the preset object is deployed with a plurality of different functional modules and corresponding attribute information, and the attribute information comprises bridge information between WPF and the Web application.
[0039] A creating unit is configured to create a plurality of WPF windows and copy the attribute information of the preset object to each of the WPF windows.
[0040] A registering unit is configured to register an identification object corresponding to the preset object in each of the WPF windows according to the attribute information, wherein each of the identification objects is provided with a unique corresponding mark corresponding to the WPF window.
[0041] A sending unit is configured to send the attribute information of each of the identification objects to the Web application and register in the Web application according to the bridge information, so that each of the WPF windows can open the Web application, and the Web application can call the identification object corresponding to each of the WPF windows.
[0042] A first obtaining unit is configured to obtain a user instruction and open the Web application in the WPF window according to the user instruction.
[0043] A receiving unit is configured to receive a calling instruction input by a user through the Web application, obtain a corresponding functional module according to the calling instruction, and execute a function corresponding to the functional module.
[0044] The application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to realize the steps of the WPF-based Web application development method.
[0045] The application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the steps of the WPF-based Web application development method.
[0046] The WPF-based web application development method, device, computer device and storage medium provided by the present application create multiple WPF windows, register an identification object in the WPF windows, so that the web application can directly call the preset object to execute the function in WPF, so that the WPF can operate the web application. Through the present application, when developing a new web application project or optimizing the original web application, c# development is not required, only web application development is required, and code migration is not required. BRIEF DESCRIPTION OF DRAWINGS
[0047] Figure 1 is a WPF-based web application development method step schematic diagram in an embodiment of the present application;
[0048] Figure 2 is a WPF-based web application development device structure block diagram in an embodiment of the present application;
[0049] Figure 3 is a structure schematic block diagram of a computer device of an embodiment of the present application.
[0050] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical scheme and advantages of the present application more clear, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
[0052] Referring to Figure 1 An embodiment of the present application provides a WPF-based web application development method, comprising the following steps:
[0053] Step S1, a preset object is established, and the preset object is deployed with multiple different function modules and corresponding attribute information, wherein the attribute information includes bridge information of WPF and web application;
[0054] Step S2, multiple WPF windows are created, and the attribute information of the preset object is copied to each WPF window;
[0055] Step S3, according to the attribute information, an identification object corresponding to the preset object is registered in each WPF window, wherein each identification object has a unique corresponding mark corresponding to the WPF window corresponding thereto;
[0056] Step S4, the attribute information of each of the identified objects is sent to the Web application, and is registered in the Web application according to the bridge information, so that each of the WPF windows can open the Web application, and the Web application can call the corresponding identified object in each of the WPF windows.
[0057] Step S5, a user instruction is obtained, and the WPF window opens the Web application according to the user instruction.
[0058] Step S6, the Web application receives a calling instruction input by a user, and obtains a corresponding function module according to the calling instruction, and executes a function corresponding to the function module.
[0059] In the embodiment, as described in step S1, a preset object is established, which can be an object of PTWWebBrowser, and includes various functions needed to be used, and the functions are developed and set, i.e., the preset object is deployed with various function modules, and each of the function modules has corresponding attribute information, such as bridge information (bridge function RegisterJSObject) of WPF and Web application, life cycle processing LifeHandler, etc.
[0060] As described in steps S2-S3, when needed, a plurality of WPF windows are created in WPF, and then the attribute information of the preset object is copied to the WPF windows, and the identified objects are registered according to the attribute information. In the embodiment, in order to avoid the problem that when a plurality of WPF windows open the same Web application, only the first window is bound, and the rest of the windows cannot be operated through boundObject, a plurality of WPF windows are created, the attribute information of the preset object is copied to each of the WPF windows, and the identified objects are registered in each of the WPF windows according to the attribute information. The identified objects correspond to the preset object, and are also deployed with various function modules, and each of the identified objects has a mark corresponding to the WPF window. For example, for a WPF window, a boundObject with a mark of "_" and a time stamp is registered as the unique identified object, and the marks of the identified objects of each of the WPF windows are different.
[0061] As described above in steps S4-S6, the attribute information of each identification object is sent to the Web application, so that the name of the identification object (boundObject) can be obtained as an identifier, i.e., the name can be used to determine a one-to-one correspondence between the name and the corresponding identification object. Then, according to the above bridge information, asynchronous registration is performed in the Web, so that the WPF and the Web can be bridged and further interact with each other. In this way, the Web can directly call the above preset object to execute each function in the WPF. Each WPF window can open the Web application, and the Web application can also call the identification object to execute the functions corresponding to each function module in the identification object. For example, the existing interactive interface of the WPF (desktop program) can be called, such as the right-click menu, pop-up window, message box, error prompt box, etc., or system resources can be called, such as the system user folder, log writing, etc., or system hardware can be called, such as the printer, two-dimensional code scanner, etc. The WPF can also execute JavaScript scripts through getBrowser(), so that the Web application can be opened in the WPF window to realize the operation on the Web. During the development of a project or use, the corresponding user instruction for opening the Web can be input in the front-end interface. After receiving the user instruction, the WPF window opens the Web application according to the user instruction. After opening, the user can input a calling instruction for calling a function module. At this time, the Web application receives the calling instruction, obtains the corresponding function module according to the calling instruction, and then executes the function corresponding to the function module.
[0062] In this embodiment, a plurality of WPF windows are created, and an identification object is registered in the WPF window, so that the Web application can directly call the preset object to execute the functions in the WPF. In this way, the WPF can operate the Web application. Through the present application, when a new Web application project is developed or the original Web application is optimized, c# development does not need to be considered, and only the Web application development needs to be completed, without code migration. Through the combination of WPF and Web, the C# framework is mixed with the Web, so that the robustness of the framework and the rapid response ability of the function can be achieved at the same time, and the technology stack has a larger application range. The front-end development is combined with the front-end engineering, the function point development is completed in a relatively short time, the project development ability and speed are improved, and because the WPF and the Web are combined, asynchronous publishing and remote publishing can be realized. The user does not need to reinstall or upgrade the client to see the effect. Through the Web technology, the publishing can be performed independently of the client without affecting the publishing process of the client. At the same time, because of the remote publishing, the defects in the production environment can be directly repaired in the remote end, which greatly enhances the support.
[0063] In one embodiment, after the above step S2 of creating a plurality of WPF windows and copying the attribute information of the preset object to each WPF window, the method further comprises:
[0064] Step S2A, detecting the current cache amount of the WPF window;
[0065] Step S2B, comparing the cache amount with a preset value;
[0066] Step S2C, if the cache amount of the current WPF window reaches the preset value, emptying the cache of the WPF window according to a preset emptying cache algorithm.
[0067] In this embodiment, when the WPF window opens the Web application, the Web application increases the cache amount of the WPF window, and when the cache amount increases to 2550mb, the WPF window crashes, causing a white screen. Therefore, the embodiment adds the emptying cache algorithm of the BrowserSubprocess to solve the above white screen problem. The BrowserSubprocess is a process for managing the cache of the WPF window. In order to avoid frequent emptying of the cache, the current cache amount of the WPF window is first detected, and when the cache amount reaches the preset value, the cache of the WPF window is emptied according to the above emptying cache algorithm.
[0068] In one embodiment, the step S5 of opening the Web application in the WPF window according to the user instruction includes:
[0069] Step S51, obtaining the Web page information input by the user and calculating the data amount of the Web page information;
[0070] Step S52, judging whether the data amount exceeds a preset threshold value;
[0071] Step S53, if not, directly opening the Web application in the WPF window;
[0072] Step S54, if yes, obtaining the pre-rendered Web page information according to the Web page information, pre-rendering the Web application by using the Webpack technology according to the pre-rendered Web page information, and opening the Web application in the WPF window.
[0073] In the embodiment, the opening speed of the WPF window opening the web application page varies with the size, that is, the opening speed varies with the opened web page and the data amount of the called function module, and the larger the data amount is, the longer the opening time is. The time consumed by opening the WPF window itself is less, for example, the WPF consumes less than one second to open its own function, and the web application needs five seconds to open, so that the WPF window consumes five seconds to open the web application page. In order to improve the opening speed of the WPF window opening the web application, the Webpack technology is applied to the web development to perform the pre-rendering function on the web application. Specifically, the above-mentioned web page information includes the information of calling the function module, and the data amount corresponding to the information includes the data amount of opening the page and calling the corresponding function module. When the WPF window is used to open the web, it can be determined whether the data amount corresponding to the web page information exceeds the preset threshold value. If not, it means that the data amount is small and the time consumed is short, and the Webpack technology is not needed to perform the pre-rendering. If the data amount exceeds the preset threshold value, it means that the data amount is large and the opening is time-consuming, and the Webpack technology is needed to perform the pre-rendering, and then the WPF window is used to open the above-mentioned web application, so as to improve the speed of the WPF window opening the web application. In this way, the entire web application can be opened in the WPF window in less than one second.
[0074] In one embodiment, the step of obtaining the user instruction and opening the web application in the WPF window according to the user instruction after step S5 includes:
[0075] Step S5, obtaining a first coordinate of a mouse cursor relative to a screen plane coordinate system and a second coordinate of the mouse cursor relative to a plane coordinate system of any WPF window used to open the web application, and taking the ratio of the first coordinate to the second coordinate as a coordinate conversion relationship;
[0076] Step S5A, obtaining a third coordinate of the mouse click position in the screen plane coordinate system;
[0077] Step S5B, converting the third coordinate and the positions of the WPF windows relative to the screen plane coordinate system according to the coordinate conversion relationship;
[0078] Step S5C, determining the display range of the preset zoom control according to the conversion result, and displaying the WPF windows in the display range.
[0079] In the embodiment, when multiple WPF windows open the same web application, multiple WPF windows can be scaled simultaneously by a mouse. First, a first coordinate of a mouse cursor relative to a screen plane coordinate system and a second coordinate of the mouse cursor relative to a plane coordinate system of any WPF window used to open the web application are obtained, the screen plane coordinate system can be a plane coordinate system with a center point of a screen interface as an origin, and the WPF window plane coordinate system can be a plane coordinate system with a center point of the WPF window as an origin. Then, a ratio of the first coordinate to the second coordinate is taken as a coordinate conversion relationship, which can also be obtained by user input. Then, a user can determine a display position by clicking the mouse, at which time a coordinate of the mouse click position in the screen coordinate system is obtained, and coordinates of the mouse click position relative to the screen plane coordinate system and positions of the WPF windows relative to the screen plane coordinate system are converted according to the coordinate conversion relationship. Then, a display range of a preset zoom control is determined according to the conversion result, the zoom control is a preset zoom tool, and the WPF windows can be collectively scaled by the zoom control. Then, the WPF windows are displayed in the display range with the mouse click position as a display center point. In this way, the WPF windows can be scaled simultaneously by the mouse through the zoom control.
[0080] In an embodiment, the step S6 of receiving a calling instruction of user input through the web application, obtaining a corresponding function module according to the calling instruction, and executing a function corresponding to the function module includes:
[0081] In an embodiment, the step S61 of splitting each function module to form a micro-service component corresponding to each function module includes:
[0082] In an embodiment, the step S62 of obtaining a corresponding micro-service component according to the calling instruction and executing a function corresponding to the micro-service component includes:
[0083] In the embodiment, the different function modules are split into individual micro-service components that can be used independently. When different functions are implemented according to the calling instruction, only direct reference or incorporation is required, without the need for splitting and reconstruction. The micro-service components can be installed and used as needed, which eliminates the need for developers to split independent modules.
[0084] In an embodiment, the step S6 of receiving a calling instruction of user input through the web application, obtaining a corresponding function module according to the calling instruction, and executing a function corresponding to the function module includes:
[0085] Step S61, receiving a calling instruction input by a user through the Web application;
[0086] Step S62, determining a function type according to the calling instruction;
[0087] Step S63, detecting whether a function unit of the same function type exists in a preset function library in the WPF window according to the function type;
[0088] Step S64, if the function unit exists, calling the function unit in the function library and executing a function corresponding to the function unit.
[0089] In the embodiment, when the Web application also needs interactive functions similar to WPF, a function library is encapsulated in the WPF window in advance, when the functions needed by the Web application have corresponding function units in the function library, the function units in the function library can be called to complete the functions through the communication interaction of the above boundObject, and the function units in the above function library include permission, internationalization, skin changing, interface communication and the like.
[0090] In an embodiment, the step S3 of registering an identification object corresponding to the preset object in each WPF window according to the attribute information, wherein each identification object has a unique mark corresponding to the WPF window corresponding thereto, comprises:
[0091] Step S31, acquiring a current time and generating a time stamp according to the current time;
[0092] Step S32, generating the identification object corresponding to each WPF window according to the attribute information and the time stamp;
[0093] Step S33, each identification object communicates with the Web application and informs the name of the preset object.
[0094] In the embodiment, the time stamp is generated according to the current time, the time stamp has uniqueness, so that the generated identification object also has uniqueness, the identification object communicates with the Web application and informs the name of the identification object, a JavaScript object (namely, the boundObject) is registered in a specified window using the RegisterJsObject method, each identification object of the WPF window has a unique mark corresponding to the WPF window, so that when the attribute of the identification object is sent to the Web, each WPF window can correspond to a respective WPF window, so that each WPF window belongs to its own boundObject, avoiding that the Web application only binds one WPF window.
[0095] Referring to Figure 2The application provides a WPF-based web application development device, comprising:
[0096] A establishing unit 10 is configured to establish a preset object, wherein the preset object is deployed with a plurality of different function modules and corresponding attribute information, and the attribute information comprises bridge information of WPF and web application;
[0097] A creating unit 20 is configured to create a plurality of WPF windows and copy attribute information of the preset object to each WPF window;
[0098] A registering unit 30 is configured to register an identification object corresponding to the preset object in each WPF window according to the attribute information, wherein each identification object is provided with a unique corresponding mark of the WPF window corresponding thereto;
[0099] A sending unit 40 is configured to send attribute information of each identification object to the web application and register in the web application according to the bridge information, so that each WPF window can open the web application and the web application can call the identification object corresponding to each WPF window;
[0100] A first obtaining unit 50 is configured to obtain a user instruction and open the web application in the WPF window according to the user instruction;
[0101] A receiving unit 60 is configured to receive a calling instruction input by a user through the web application, obtain a corresponding function module according to the calling instruction, and execute a function corresponding to the function module.
[0102] In an embodiment, the WPF-based web application development device further comprises:
[0103] A detecting unit is configured to detect a cache amount of the current WPF window;
[0104] A comparing unit is configured to compare the cache amount with a preset value;
[0105] An emptying unit is configured to empty the cache of the WPF window according to a preset emptying cache algorithm if the cache of the current WPF window reaches the preset value.
[0106] In an embodiment, the obtaining unit 50 comprises:
[0107] An obtaining subunit is configured to obtain web page information input by a user and calculate a data amount of the web page information;
[0108] A judging subunit is configured to judge whether the data amount exceeds a preset threshold value;
[0109] opening sub-unit, configured to open the Web application in the WPF window directly if no;
[0110] rendering sub-unit, configured to acquire pre-rendered Web page information according to the Web page information if yes, and pre-render the Web application by using Webpack technology according to the pre-rendered Web page information, and open the Web application in the WPF window.
[0111] In an embodiment, the WPF-based Web application development apparatus described above further comprises:
[0112] a second acquiring unit, configured to acquire a first coordinate of a mouse cursor relative to a screen plane coordinate system and a second coordinate of the mouse cursor relative to a plane coordinate system of any WPF window used to open the Web application, and take a ratio of the first coordinate to the second coordinate as a coordinate conversion relationship;
[0113] a third acquiring unit, configured to acquire a third coordinate of a mouse click position in the screen plane coordinate system;
[0114] a converting unit, configured to convert the third coordinate and a position of each WPF window relative to the screen plane coordinate system according to the coordinate conversion relationship;
[0115] a displaying unit, configured to determine a display range of a preset zoom control according to a conversion result, and display each WPF window in the display range.
[0116] In an embodiment, the receiving unit 60 described above comprises:
[0117] a splitting sub-unit, configured to split each function module to form a micro-service component corresponding to each function module; the micro-service component can be used independently;
[0118] an executing sub-unit, configured to acquire a corresponding micro-service component according to the calling instruction, and execute a function corresponding to the micro-service component.
[0119] In an embodiment, the receiving unit 60 described above comprises:
[0120] a receiving sub-unit, configured to receive a calling instruction input by a user through the Web application;
[0121] a determining sub-unit, configured to determine a function type according to the calling instruction;
[0122] a detecting sub-unit, configured to detect whether a function unit of the same function type exists in a preset function library in the WPF window according to the function type;
[0123] The calling sub-unit is configured to call the function unit in the function library and execute the function corresponding to the function unit if the function unit exists.
[0124] In an embodiment, the registration unit 30 comprises:
[0125] The first generating sub-unit is configured to acquire a current time and generate a time stamp according to the current time.
[0126] The second generating sub-unit is configured to generate the identification object corresponding to each WPF window according to the attribute information and the time stamp.
[0127] The communication sub-unit is configured to communicate each identification object with the Web application and inform the name of the preset object.
[0128] In the embodiment, the specific implementation of each unit and sub-unit is described above in the method embodiment, and will not be described here.
[0129] Referring to Figure 3 , the embodiment of the application further provides a computer device, which can be a server, and the internal structure thereof can be as shown in Figure 3 . The computer device comprises a processor, a memory, a network interface and a database connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium. The database of the computer device is configured to store preset objects, WPF windows and the like. The network interface of the computer device is configured to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement a WPF-based Web application development method.
[0130] Those skilled in the art can understand Figure 3 that the structure shown in the embodiment is only a block diagram of part of the structure related to the scheme of the application, and does not constitute a limitation on the computer device to which the scheme of the application is applied.
[0131] The embodiment of the application further provides a computer readable storage medium, which stores a computer program. The computer program is executed by the processor to implement a WPF-based Web application development method.
[0132] To sum up, the WPF-based web application development method, device, computer equipment and storage medium provided in the embodiments of the present application establish a preset object, the preset object is deployed with a plurality of different function modules and corresponding attribute information, wherein the attribute information includes the bridging information of WPF and web application; a plurality of WPF windows are created, and the attribute information of the preset object is copied to each WPF window; according to the attribute information, an identification object corresponding to the preset object is registered in each WPF window, wherein each identification object has a unique corresponding mark corresponding to the WPF window; the attribute information of each identification object is sent to the web application, and is registered in the web application according to the bridging information, so that each WPF window can open the web application, and the web application can call the identification object corresponding to each WPF window; a user instruction is obtained, and the WPF window is opened according to the user instruction; the calling instruction input by the user is received through the web application, the corresponding function module is obtained according to the calling instruction, and the function corresponding to the function module is executed. Through the WPF-based web application development method, device, computer equipment and storage medium provided in the present application, a plurality of WPF windows are created, and an identification object is registered in the WPF window, so that the web application can directly call the preset object to execute the function in the WPF, so that the WPF can operate the web application. Through the present application, when developing a new web application project or optimizing the original web application, c# development is not required, only web application development is required, and code migration is not required.
[0133] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiment methods can be included. Any reference to memory, storage, databases, or other media in this application and in examples provided herein, unless specifically stated otherwise, can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM), or external cache memory. As an illustration but not limitation, RAM is available in many forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0134] It should be noted that in this document, the terms "comprising", "including", or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, device, article, or method that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, device, article, or method. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, device, article, or method that includes the element.
[0135] The above description is only the preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation using the content of the specification and drawings, or direct or indirect application in other related technical fields, is also included in the patent protection scope of the present application.
Claims
1. A WPF-based web application development method, characterized in that, Includes the following steps: A preset object is established, in which various functional modules and corresponding attribute information are deployed, including bridging information between WPF and the Web application. Create multiple WPF forms and copy the property information of the preset object to each of the WPF forms; Register an identifier object corresponding to the preset object in each of the WPF forms according to the attribute information, wherein each identifier object has a unique tag corresponding to the WPF form it corresponds to; The attribute information of each of the identified objects is sent to the Web application, and the Web application is registered according to the bridging information, so that each of the WPF forms can open the Web application, and the Web application can call the corresponding identified objects in each of the WPF forms; Obtain user instructions and open the Web application on the WPF form according to the user instructions; The web application receives user input invocation commands, obtains corresponding functional modules based on the invocation commands, and executes the functions corresponding to the functional modules. After the step of obtaining user instructions and opening the web application in the WPF form according to the user instructions, the following steps are included: Obtain the first coordinate of the mouse cursor relative to the screen plane coordinate system and the second coordinate of the mouse cursor relative to the plane coordinate system of any of the WPF forms used to open the Web application, and use the ratio of the first coordinate to the second coordinate as the coordinate transformation relationship; Get the third coordinate of the mouse click position in the screen plane coordinate system; The third coordinate and the positions of each WPF window relative to the screen plane coordinate system are transformed according to the coordinate transformation relationship; The display range of the preset scaling control is determined based on the conversion result, and each WPF form is displayed within the display range.
2. The WPF-based web application development method according to claim 1, characterized in that, After the step of creating multiple WPF forms and copying the property information of the preset object to each WPF form, the following is included: Detect the current cache size of the WPF form; Compare the cache size with a preset value; If the cache of the current WPF form reaches a preset value, the cache of the WPF form will be cleared according to the preset cache clearing algorithm.
3. The WPF-based web application development method according to claim 1, characterized in that, The step of obtaining user instructions and opening the web application in the WPF form according to the user instructions includes: Obtain the web page information input by the user and calculate the data volume of the web page information; Determine whether the amount of data exceeds a preset threshold; If not, the web application will be opened directly in the WPF form; If so, then obtain the pre-rendered webpage information based on the webpage information, pre-render the web application using Webpack technology based on the pre-rendered webpage information, and open the web application in the WPF window.
4. The WPF-based web application development method according to claim 1, characterized in that, The steps of receiving a user-input call command through the web application, obtaining the corresponding functional module according to the call command, and executing the function corresponding to the functional module include: Each of the aforementioned functional modules is broken down into microservice components corresponding to each functional module; wherein, each microservice component can be used independently. The corresponding microservice component is obtained according to the calling instruction, and the function corresponding to the microservice component is executed.
5. The WPF-based web application development method according to claim 1, characterized in that, The steps of receiving a user-input call command through the web application, obtaining the corresponding functional module according to the call command, and executing the function corresponding to the functional module include: The web application receives user-input commands. The function type is determined based on the invocation instruction; Based on the function type, detect whether there is a function unit of the same function type in the preset function library of the WPF form; If it exists, call the functional unit in the functional library and execute the function corresponding to the functional unit.
6. The WPF-based web application development method according to claim 1, characterized in that, The step of registering an identifier object corresponding to the preset object in each of the WPF forms according to the attribute information, wherein each identifier object has a unique tag corresponding to its corresponding WPF form, includes: Get the current time and generate a timestamp based on the current time; Based on the attribute information and the timestamp, generate the identifier object corresponding to each WPF form; Each of the identified objects communicates with the web application and informs it of the name of the preset object.
7. A WPF-based web application development apparatus, characterized in that, include: A creation unit is used to create a preset object, which deploys various functional modules and corresponding attribute information, including bridging information between WPF and the Web application. A creation unit is used to create multiple WPF forms and copy the property information of the preset object to each of the WPF forms; The registration unit is used to register an identifier object corresponding to the preset object in each of the WPF forms according to the attribute information, wherein each identifier object has a unique tag corresponding to the WPF form it corresponds to; The sending unit is configured to send the attribute information of each of the identified objects to the Web application, and register them in the Web application according to the bridging information, so that each of the WPF forms can open the Web application, and the Web application can call the corresponding identified objects in each of the WPF forms; The first acquisition unit is used to acquire user instructions and open the Web application on the WPF form according to the user instructions. The receiving unit is configured to receive a call instruction input by the user through the Web application, obtain the corresponding functional module according to the call instruction, and execute the function corresponding to the functional module. The second acquisition unit is used to acquire the first coordinate of the mouse cursor relative to the screen plane coordinate system and the second coordinate of the mouse cursor relative to the plane coordinate system of any of the WPF forms used to open the Web application, and to use the ratio of the first coordinate to the second coordinate as the coordinate transformation relationship. The third acquisition unit is used to acquire the third coordinate of the mouse click position in the screen plane coordinate system; The transformation unit is used to transform the third coordinate and the position of each WPF window relative to the screen plane coordinate system according to the coordinate transformation relationship; The display unit is used to determine the display range of the preset scaling control based on the conversion result, and to display each WPF form within the display range.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the WPF-based web application development method as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the WPF-based web application development method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
User interface realization method
CN103176804A
Implementation method and device of message prompt window, equipment and storage medium
CN111666125A