To illustrate how we use Blazor to modernize Windows Forms applications, we will use this simple example:
In this scenario, when the button is clicked, the model (Counter) is updated, and the UI automatically reflects the changes.
Upon the successful completion of our Modernization process, the expected outcome will be as follows (the code has been significantly simplified for clarity):
The original Windows Forms code remains essentially unchanged, with only minor modifications to accommodate the distinct characteristics of a desktop application to a server-side application.
Razor components, along with their associated bindings and observers, are automatically generated as part of the modernization process. There's no need for you to create or modify this code manually.
Bindings and observers trigger Razor components to generate HTML dynamically as needed. This HTML is then transmitted to the client, where the DOM is updated in real-time via Streaming Rendering, aiming to provide an experience as close as possible to that of a desktop application.
The following diagram details the execution flow triggered when the button is pressed: