1

I would like to rewrite an application that currently works as a Windows GUI in C#. The problem is, it works well on Windows, but is not adapted for Mac and Linux because of GUI issues with Mono.

So my idea, was to continue with C# (needed because of an essential sub program that needs to run C# and cannot be ported) and try to rewrite it as a web application that any user on Windows, Mac or Linux could access easily and make it work.

It is also important that my application remains working "out-of-the-box" because it aims high accessibility.

I've looked for solutions like :

  • KayakHTTP but it does not support POST data ! (needed for a web GUI)
  • XSP2 from Mono and make an ASP.NET MVC web app, but will it really work with my web app to make an out-of-the-box application ?

Alternatively, do you have any other idea for me to have a C# web app working out of the box for the end users ? The only thing needed would be to install Mono on Mac and Linux.

Thank you very much for your help.

EDIT 1 : I realize that I have not explained all aspects correctly. In fact, there are 2 applications in my project :

  • The CORE application which is written in C# and is too big to be ported or rewritten and thus must use Mono for running on Mac and Linux
  • My GUI application using Windows Forms which is written in C# too and controls the CORE application

My goal is to convert my GUI application into a web app application so there's no more the Windows Forms GUI hassle on Mac and Linux.

OlivierB
  • 455
  • 2
  • 6
  • 18
  • 1
    It just might be less work to build 3 guis. Gives you an incentive to keep it simple... –  Mar 10 '12 at 17:30
  • I don't get your point. There are decent browsers on all three mentioned OSes. A web app shouldn't even require anything installed on the client side (except maybe for some fancy stuff flash or silverlight or java runtime). And the server side (the non client part) is most of the time far less problematic. – Sascha Mar 10 '12 at 18:17
  • I edited my post, in fact there is a CORE application that I can't modify and must deal with because it's too big to be changed in anyway. This CORE app is controlled by my GUI app which needs to be ran on all OSes. – OlivierB Mar 10 '12 at 18:35

2 Answers2

1

Is it necessary for your core application to run on the client?

If NOT, then the best approach is to rewrite everything as a web (ASP.NET) application which is going to run on a Windows server. Users on all your target platforms will then access this app through a web browser.

If YES, then a web app is not a good idea. You really don't want to require a web server on your clients. You have two possibilities:

  • Take a look at the GUI toolkits available for mono and select one that is available on all your target platforms to avoid having different front ends for each of your platforms.
  • To ensure best user experience on all platforms you should choose the native GUI toolkit for each of the platforms and write a different front end for them: either using Mono or using a native development environment as long as your core application has an interface that can be accessed from it (e.g. command line or similar).
Damir Arh
  • 17,637
  • 2
  • 45
  • 83
  • Thanks for your answer. After reading the Mono page for GUI Toolkits, if I understand well, I can just continue to use System.Windows.Forms while making sure that it will be supported using something like Mono Migration Analyser ? Also, I would really like to use only one GUI toolkit to keep development time and effort low. – OlivierB Mar 10 '12 at 19:24
  • @virrea Exactly. If you're not using third party controls depending on native calls there is a great chance that your WinForms UI is going to work on Mono. If not you might need some effort and changes to port it. I know of at least one successful port of a WinForms app to Mono. [Here] (http://www.mono-project.com/Winforms_Samples) are also a couple of WinForms apps that work on Mono. – Damir Arh Mar 11 '12 at 05:11
  • Thanks I will have a look on these samples and try them out on each platform. – OlivierB Mar 12 '12 at 11:47
0

This is a duplicate question, but I don't have time to find the duplicate.

Briefly, the answer is: don't do this. You cannot translate a desktop application to a web application on a one to one basis: the two paradigms are too different.

I recommend instead refactoring your current application to remove all dependencies on the GUI. Then, write a totally new web application to meet the requirements, and have the web application call the code you refactored out of the desktop application.

Be aware of the big, hidden difference between the two platforms: the web application will be running on a server. It will be used by multiple users at the same time, and by multiple threads at the same time. While you are refactoring, be certain to note any code that would be sensitive to the difference. For instance, code that uses static member fields now could work in the desktop application because there is only one user at a time. In a web application, that static will be shared across all users and all threads.

This may not be what you had in mind.

John Saunders
  • 160,644
  • 26
  • 247
  • 397