Monday, 29 April 2024
Web App Development

Converting a Windows C# App to the Web is a Major Endeavor

Website Development, Programming, Optimization. Team of web developers working on computer, building site, programming code. landing web page design template decorated with people characters.

Converting a Windows C# app to the web is a major endeavor, because the central part of the application, specifically the screen control, requires a total re-write.

To say it upfront, my business, Copperhill Technologies, does not offer web design services, and I am not an expert of web application design. We have, however, developed a Windows application using Visual Studio and C#. The product is VisualSizer, a servo motor sizing software for Windows. Since 1993, we have customized the app for various manufacturers in the motion control business, while going through several transitions of Windows (starting with MS-DOS) and programming languages (VisualBasic to C#).

VisualSizer - Servo Motor Sizing Software for WindowsVisualSizer is a generic (manufacturer-independent) servo motor sizing & selection software for the motion control engineer. It includes databases containing various motor/drive/amplifier combinations of different motor manufacturers. It also provides a database editing tool to add, delete, and modify motor data.

However, VisualSizer is not an ordinary database browsing tool where users enter criteria to create search results (meaning mere SQL queries won’t do). VisualSizer lets the user create a mechanical setup (motion axis) that includes the motor and other mechanical devices such as gearboxes, linear actuators, and more. Furthermore, users define a motion profile (speed over time) with VisualSizer.

These days, we have decided to look into a conversion of the software to the Internet (web app) as well as to iOS and Android. The decision about the new development environment was made from a mere management view. The main focus was, naturally, on keeping the unavoidable learning curve to a minimum.

On a side note, my “research” focused merely on solutions that would enable us to re-use existing C# code. The situation would change significantly if we were to start a web app development from scratch.

My initial thinking was, with the most complex portions of the program already developed and tested in C#, it should be a breeze to utilize the capabilities of Microsoft’s Visual Studio or Visual Studio Code and create a web app. And yes, both IDEs are quite capable of doing exactly that, but at this time, I have spent several weeks trying to “decipher” the available documentation.

The result of my “research” is simple:

Converting a Windows C# app to the web is a major endeavor because the central part of the application, specifically the screen control, requires a total re-write. The most shocking conclusion, however: Forget about C#! Even when working with Visual Studio, you cannot avoid the three major web development elements: JavaScript, HTML, and CSS.

As a matter of fact, you will save a significant chunk of time by converting your C# directly into JavaScript rather than working through mostly misleading and insufficient documentation before you can even start coding with Visual Studio.

My Choice for Web App Development

As my previous comments may indicate, we will not use Visual Studio or Visual Studio Code. The main reason is the steep learning curve in combination with documentation written by experts for experts (see my comments on documentation below).

Going with my conclusion that you will need the three crucial web app development components (HTML, JavaScript, CSS) no matter what, the result of my “research” is (yet again) simple:

  1. Adobe Dreamweaver Website Design Software: Dreamweaver is not only a website designer; it is also a code editor that supports JavaScript development.
  2. Wijmo JavaScript/HTML5 UI Components for any Framework: Wijmo is part of GrapeCity’s Developer Solutions. We are currently using their ComponentOne .NET UI controls for our current Windows application.
  3. SharpKit – C# to JavaScript converter: SharpKit is a C# to JavaScript converter tool. It allows you to write C# 4.0 and convert it to JavaScript during compilation. Supports all major libraries including jQuery, ExtJS, ASPNET AJAX.

The Visual Studio Code Documentation Dilemma

Let me start with an example taken out of a colossal work of roughly 800 pages:

“.NET MAUI will support existing MVVM and XAML patterns as well as ones like Model-View-Update (MVU) with C#, which is similar to Apple’s Swift UI, and of course Blazor.” Source: C# 9 and .NET 5 by Mark J. Price

Not feeling well

There are many choices for a C# development environment that also supports web app development with the help of numerous frameworks (each requiring their individual learning curve).

The most popular IDEs (Integrated Development Environments) come from Microsoft. They are:

  • Visual Studio Code – Runs on Windows, MacOS, Linux
  • Visual Studio 2019* – Windows
  • Visual Studio 2019* for Mac

*It must be VS 2019 or newer; older versions won’t do.

The Documentation Dilemma

My view of the documentation dilemma may be oversimplified (in other words, I deliberately ignore some details), yet my point is valid and easy to grasp.

Let’s do some simple math:

Documentation Variants = IDE Choices x Supported OSs x Supported Programming Languages x Web Application Type

Going with the above (shortened) list of IDE choices, there are three.

Visual Studio Code runs on different operating systems, Windows, macOS, and Linux. I assume Linux only as one OS, i.e., I am ignoring its multiple flavors (Alpine, Ubuntu, Fedora, etc.). That makes three supported OSs.

Visual Studio Code supports multiple programming languages. For the sake of keeping it simple, I count only C#, C++, Python, VB, JavaScript, and F#, which makes six (my apologies if I didn’t list your favorite language).

I count as web application types: Windows apps, iOS apps, Android apps, web services, and websites, which makes five.

According to the above formula, there are:

Documentation Variants = 3 IDEs x 3 OSs x 6 Programming Languages x 5 Web Application Types = 270*

*The equation does not include the various programming interfaces such as .NET APIs, ASP.NET Core, Xamarin, MVC, Blazor, and Supercalifragilisticexpialidocious.

The Point

The point is, you can’t expect to find documentation/books that cater exactly to your skills and hardware/software equipment. There are a myriad of great articles, videos, and books, and they may work for you initially, but at some point, you will hit a roadblock. It’s not a matter of “if” but “when.”

Conclusion

I may have found the solution that works best for our development goals, but my statement remains true: Converting a Windows C# app to the web is a major endeavor. I have, however, eliminated a number of potential roadblocks by avoiding months-long studies and research. The web development tools I chose are well established, well designed and well documented, i.e., they are user-friendly. Now, let’s do some coding…