Using Windows Forms for Web Apps

DevToolsGuy / Monday, March 9, 2015

What is WinForms?

The .NET Platform provides you with a rich set of libraries to build GUI client applications. The concept of building rapid GUI applications has been borrowed from Visual Basic and it’s called WinForms (Windows Forms) on the .NET Platform. The WinForms API supports RAD (Rapid Application Development) and relies extensively on properties that enable you to tailor the WinForms to your needs. 

In the past, WinForms was specifically used for desktop applications on the Windows Platform, namely Console Applications and GUI/Windows Applications. Console Applications run within the MS-DOS window, while Windows Applications have their own GUI.

But what’s needed to migrate your WinForms to Web apps?

WinForms applications have always been used to develop desktop applications where you want the entire processing burden, including the drawing or graphics applications, data-entry systems, point-of-sale systems, and games to be rested on the client machine.

In this post we'll look at why it is a good idea to migrate your WinForms to Web apps and how this will make your WinForms application available on a browser user interface. Naturally, this includes applications intended to be available publicly through the World Wide Web, such as e-commerce applications.

Developers are focusing more and more on making their applications a service, rather than a product. This means that the web-based app model will become the dominant force in software. Once an OS is in place that can run software (i.e. "content"), the way a browser can display HTML (i.e. "content"), developers will jump on board and never look back.

There is, of course, still money in developing standalone apps. However, developing a web based applications with the currently available technology will only make your life easier down the line (and it'll make you look smart too!).

 

What’s new in WinForms for .Net Framework 3.5

 

  • Client Application Services – Client applications services enable the WinForms application to easily access the ASP.Net login, roles and profile services which is widely used for the Web apps application.
  • Windows Vista Support - WinForms applications work seamlessly on Windows Vista and are upgraded to work seamlessly with Windows Vista
  • Click Once Improvement - Provides the ability to deploy from multiple locations and the ability to add third-party branding. Click Once also offers alternative browser support and XCOPY publishing in some scenarios.
  • Design Time Improvements - Improvements in smart tag stability, Toolbox population and general designer responsiveness and performance. The WinForms design-time error list has been redesigned to provide targeted assistance.

 

The Good, the Bad & the Ugly

If you are thinking about migrating your WinForms to Web Apps, do consider the following points before deciding the approach most appropriate to you:

 

  • An entirely new API.
  • Entirely new update approach.
  • Entirely new look & feel - or work hard to customize the UI to look the same.
  • Lighten the amount of data transferred to the client and presented at any given time to avoid severe latency.
  • Compromise on features list due to the web limitations.
  • Handle security holes created as a result of opening services consumed by client-side AJAX and transferring business logics to the client.

 

With all these points taken into consideration, it can be similar to developing a new web application from scratch, yet there are ways in which you can use the existing WinForms to make new Web Apps. One of the approaches is to use our Infragistics’ WinForms product.

WinForms are not dead!

With the introduction of WPF, there’s been a lot of discussion about whether WinForms are dead. Nonetheless, there is still a huge number of existing legacy applications that are built using WinForms, many of which are hundreds of thousands of lines of code in size. The amount of time required to port them to WPF would be prohibitively large.

Many companies and developers have invested heavily into WinForms over the years. This investment includes:

 

  • Time invested learning the WinForms programming model
  • Time invested developing existing WinForms applications and controls
  • Money invested in buying suites of custom WinForms controls

 

So, WinForms persists, despite having been partially superseded by WPF. Although it does have some flaws and limitations, it’s still perfectly possible to create good quality Windows desktop applications using WinForms.

Making the most of WinForms

At Infragistics, we offer a variety of WinForms controls to help create the best User Experiences (UX) by default and integrate UX throughout the development process. We also provide the WinForms Test Automation which allow Quality Assurance teams to automate user testing with great quality releases.

Some of the sample WinForms application for showcase can be viewed here. We think there’s a future for WinForms building web apps and we’re looking forward to seeing what creations will emerge in the future.