WinForms to Web

WinForms to Web: Migrating Desktop Applications, Part 1

Introduction

This is the first part of a series of articles that describes the various migration options of desktop/smart client applications to the web available using Visual WebGui.

To discuss the migration process of legacy desktop applications to the web, you should first be aware of three different types of desktop applications:

  1. WinForms-based desktop application (C#/VB.NET): The UI layer is coded using .NET languages—the business can be .NET, COM+, or any other interop.
  2. VB 6.0-based applications: The UI layer is coded with VB 6.0.
  3. Smart client or other desktop technologies (C++ MFC/ATL, Delphi, Java, and so forth): Any other smart client technology based applications.

This document describes the migration process of WinForms-based desktop applications to the web using Visual WebGui.

WinForms-Based Desktop Applications: Background

Normally, without Visual WebGui the migration process of a WinForms desktop application to the web will require a full re-engineering of the UI layer to fit the web architecture and capabilities.

If you take WinForms migration to ASP.NET, for example, using any AJAX third-party controls to provide a rich UI experience, you will have to consider:

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

The Visual WebGui SDK is fully integrated with Visual Studio and provides the exact same API and set of tools/capabilities that are provided out of the box with WinForms 1.0 and 2.0. This fact enables the native capability of simply copying any existing WinForms source code to a VWG project and providing a fully functional equivalent web application.

The Process

The three basic steps of migration (view a walkthrough tutorial):

  1. Open a new Visual WebGui application.
  2. Copy the code from your WinForms project into this new web application.
  3. Replace any reference to the WinForms API namespace ("System.Windows.Forms") within the code to Visual WebGui API reference ("Gizmox.WebGUI.Forms").

Any standard WinForms application that uses the 58 WinForms out-of-the-box controls will then compile and execute as a plain web application.

The outcome of this short process is an ASP.NET-based solution in terms of deployment and runtime and has the following properties:

  1. Deployment is a copy & paste equivalent to an ASP.NET web site.
  2. Server infrastructure requires an IIS and .NET CLR only.
  3. The application can be consumed from any plain browser—no installation is made on the client.
  4. Minor static and cached footprint on the client— ~200kb of plain JS and HTML code due to the Empty Client concept.
  5. Support for multiple presentation layers with the same code base (DHTML/Silverlight or Smart Client).
  6. Maintain a single layer of code—no need to write or maintain JavaScript, HTML, and services.
  7. Highly secured due to the Empty Client concept.

Considerations & Exceptions

There are three major setbacks you might have during the process that you can quantify in advance and estimate the amount of work that has to be done to migrate your application:

  1. Minor differences between the VWG API and WinForms that are mainly caused by architecture differences.
  2. The amount of third-party controls that are used in your application. This section describes a situation of using some non-WinForms out-of-the-box controls (for example, Infragistics or DevExpress controls, and so on). In those cases, you can select the most suitable solution from the following three options:
    1. Choose a similar control from the WinForms out of the box, adjust your code to use it, and then perform the migration process.
    2. Select an equivalent third-party ASP.NET control (Infragistics, Telerik, DevExpress, and the like) that provides the same functionality, wrap it by a click of a button in VWG, and adjust your code to use it.
    3. Write your own VWG custom control that will perfectly suit your needs and then adjust your code after the migration process to use this control.
  3. Adjustments of a single-user desktop application to a multiuser web environment. This section summarizes some of the major issues of transforming a single-user application to a multiuser application sharing the same CPU, memory space, and other resources.
    1. Thread safety: Because a WinForms application can contain static members that are accessible to a single user, you should now consider one of the following:
      1. Replacing those static members to synchronized multi-thread safe data structures.
      2. Lock critical read/write sections to protect concurrent multi user access.
      3. Remove the statics and find an instance or DB-based solutions.
    2. Memory load: In a desktop application, there might be places when the original consideration of the amount of memory in use was based on the assumption that the executing machine is local. Therefore, many items are loaded to memory simultaneously without limitation. Now, on a shared memory environment, when the server does the heavy lifting, the amount of memory consumed by each user will set the number of concurrent users that can be served by each server.

The following steps are recommended:

  1. Consider loading items to memory on demand (keep only the headers and the identifiers in memory).
  2. Remove any large objects read to memory. For example, don't save binary objects to memory; instead, write the binary to the response stream directly to the client.
  3. Prefer DB-based paging on entire prefaces and memory-based paging. Visual WebGui provides mechanisms to enable it easily.

Summary

Migration of any WinForms application to the web using Visual WebGui has the following advantages:

  1. In three simple steps, you will be able to get very close to a working web application.
  2. The effort you have to make to accomplish a fully functional web application is measurable.
  3. The application can keep using the existing BL and DL layers; only the UI is either migrated automatically or adjusted.

WinForms to Web

VB 6.0 to Web: Migrating Desktop Applications, Part 2

Introduction

This is the second part in a series of articles that describes the various migration options of desktop/smart client applications to the web available using Visual WebGui.

To discuss the migration process of legacy desktop applications to the web, you should first be aware of three different types of desktop applications:

  1. WinForms based desktop application (C#/VB.NET): The UI layer is coded using .NET languages; the business can be .NET, COM+, or any other interop.
  2. VB 6.0-based applications: The UI layer is coded with VB 6.0.
  3. Smart client or other desktop technologies (C++ MFC/ATL, Delphi, Java, and so forth): Any other smart client technology-based applications.

This document describes the migration process of VB 6.0-based desktop applications to the web using Visual WebGui.

VB 6.0 Based Desktop Applications: Background

Because the WinForms development paradigm and API are actually an evolution of VB 6.0, migration to Visual WebGui, which uses the exact same paradigm and API, is most natural.

The Process

VB 6.0-based desktop applications can be transferred to the web using Visual WebGui using three different approaches:

  1. VB 6.0 Project -> WinForms .NET Project -> Visual WebGui .NET Project: Migrate the VB 6.0 using Artinsoft tools and services to a WinForms desktop application and then follow the process of WinForms applications migration as described in the first section of this document.
  2. VB 6.0 UI using VB 6.0 DL/BL -> Visual WebGui UI using VB 6.0 DL/BL: The application will keep using the existing BL/DL layers as COM/COM+ VB 6.0-based components; only the UI is mimicked within a Visual WebGui project using the productive proven tools of WinForms. The VB 6.0 to WinForms wizard of Artinsoft that exists within Visual Studio to make the process partially automatic.
  3. VB 6.0 Project -> Visual WebGui Project: The entire application is mimicked within a Visual WebGui project and .NET using the productive proven tools of WinForms.

The VB 6.0 to WinForms wizard of Artinsoft that exists within Visual Studio makes the process partially automatic.

Considerations & Exceptions

Except for the considerations and exceptions mentioned in the previous section, "WinForms based desktop applications," there are two additional subjects derived from the VB history of the project:

  1. The source project written in VB 6.0 and might use non-Thread-Safe win32 or native API resources—those should be handled as potentially dangerous to the multi user web environment.
  2. Threading Model: Activating COM/COM+ components coded in VB 6.0 is using "Single Thread" or "Single Thread Apartment" threading models. Consider using the "STAThread" attribute decoration above any method that is accessing VB 6.0-based COM/COM+.

Summary

Migration of VB 6.0 applications to the web using Visual WebGui has the following advantages:

  1. The application can keep using the existing BL/DL services—no re-write or re-engineering is required.
  2. UI concepts, design patterns, and practices can be migrated as is.
  3. UI elements and API in VB 6.0 are very similar to WinForms so that migration of the UI to Visual WebGui is quite native.
  4. The effort you have to make to accomplish a fully functional web application is measurable.


Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds