2

I have a customer who wants an application for his travels where he can update an online DB, he doesn't want to buy a laptop, he wants a tablet or something similar. I have no knowledge nor desire in creating special apps for mobile devices, I want to create a winform just like I always did when it was targeted for pc. Tablet pcs (which from what I understood is just a regular pc?) are still very expensive in my country.

Is there a simple adjustment to make winform app run on a tablet with android or I have to build a special app for it? Any other solution? (I began in writing a web page for it, but it's much easier using winforms)

BornToCode
  • 9,495
  • 9
  • 66
  • 83
  • 2
    The ideal solution here is if you could code the UI as a web application: PHP, JSP, ASP.Net - *anything* that you can run in a web browser. If you can do that - problem solved! – paulsm4 Jun 13 '12 at 07:00
  • To best answer this it would be good to know the target device. But a general safe assumption is that WinForms won't be supported on anything other than an x86 Windows 7 or 8 tablet device. if the app can be made on a web stack then anything with a browser can use it regardless of platform. – Adam Houldsworth Jun 13 '12 at 07:01
  • Basically, if you want Windows 7/Tablet ... then you get to learn WPF and XAML. The best UI for a Windows 7 tablet ... is to code a web application on the server side, that you can run in a browser. Better yet, the *same* application is *automatically* portable to *any* tablet that supports a web browser: WP7, Android and/or iPad. IMHO... – paulsm4 Jun 13 '12 at 07:03
  • @AdamHouldsworth - I can choose the target device, they'll buy it specially for this future app – BornToCode Jun 13 '12 at 07:04
  • 1
    @BornToCode in that case there is a question about how usable a WinForms app will be in a touch-enabled environment. I'm guessing "not very". Recoding the app seems the logical avenue regardless of the device. – Adam Houldsworth Jun 13 '12 at 07:08

2 Answers2

2

Native WinForms applications will not run directly on Android (or any non-Windows platform). You may want to begin by looking into MonoDroid for porting .NET code Android (and Mono in general for porting .NET code to non-Windows platforms).

A successful port across platforms will require that the application be structured in a very de-coupled manner. Core business logic in the abstract part of the application should be easily ported, but concrete implementations (specifically views and data/service access) will require some re-implementation for the different concrete platforms. So the overall architecture needs to be very de-coupled and pluggable.

Is a Windows tablet an option? Using various new technologies at Microsoft (Windows 8, Metro UI, etc.) you could build an application that would target multiple Microsoft-based platforms. This could easily satisfy the requirement of being "a tablet" (if the requirement isn't more specifically "an Android tablet"). However, it won't be the old WinForms style of applications.

In general you'll find that the industry has been steadily moving away from WinForms for, well, this exact reason. It doesn't port to other platforms, and there's a wide variety of platforms in demand today.

David
  • 208,112
  • 36
  • 198
  • 279
  • 1
    If its a Windows 7 or x86 Windows 8 tablet then all old apps will work outside of metro. But the UI support will be rubbish for touch screen, best to redo the app in Metro. – Adam Houldsworth Jun 13 '12 at 07:05
  • 1
    @AdamHouldsworth: Indeed, the best recommendation here is to re-work the application for the technology needs. Clutching to WinForms in an effort to not re-do existing work is going to end up costing more and producing less in the long run. – David Jun 13 '12 at 07:08
  • I totally agree, but lots of old WinForms apps will still technically work given the right OS flavour, just won't be fun to use lol – Adam Houldsworth Jun 13 '12 at 07:09
1

Forget convertion i was in a similar position years ago and i did something easier faster and i think smarter. just make a winform with nice big controls take care of docking scaling anchors etc so that it will look nice and can be used with small smart devices.

Make sure you pass some start program parameters in your app and when a special parameter is passed instead of opening the main typically desktop form of your app open that new one in fullscreen.

Now the tricky parts isnelsewhere. I hade setup a tiny windows 2008 r2 server that allows remote apps to be run on it.

Create a user account that you will allow access to that server and only that app of yours with the specific parameter we talked about. (Ex myapp.exe -remote)

The what ever device he will get you can download the free app like 2x rdp or microsoft rdp in android. Make a new connection to your server (you can use any free ddns you like if you dont have a static ip) and connect with that windows server account you did before.

This account if has been properly setuped will only run your app and will only show that new mini winform you did..

The end user will do a simle click and from his internet connection will do a simple remote desktop that is linited to your app only. (Router configuration is needed once)

That way you will keep maintain just one source code and he will have low bandwidth cost and can continue his work without data loose in case of disconnection.

I use that for years in mobiles tablets and pos systems. Its fast its stable its secure its easy to maintain (nothing on the client side) and you don't waste months of learning wpf or doing xamarin converting.

Vernam7
  • 11
  • 1