views:

2675

answers:

9

I have an app that I've written in C#/WinForms (my little app). To make it cross-platform, I'm thinking of redoing it in Adobe AIR. Are there any arguments in favor of WinForms as a cross-platform app? Is there a cross-platform future for Winforms (e.g., Mono, etc.)? Suggestions for cross-platform UI development?

By cross-platform I mean, currently, Mac OSX, Windows and Linux.

This question was asked again and answered with better success.

+2  A: 

WinForms are fully supported by Mono, so they are cross-platform.

Łukasz Sowa
+1  A: 

Well I think the only way to for cross-platform reliably with C# is Microsoft Silverlight, but is not really WinForms, and browser-based. Other than that, yes Mono is a chance.

Michael Pliskin
You downplay mono way too much.
Geoffrey Chetwood
And ironically upplay moonlight, since it relys on Mono and isn't finished yet. If you mean cross-platform == Windows and Mac then maybe Silverlight.
Kris Erickson
Interesting! I never thought about it, but you're right... though Silverlight might never have good adoption, it's probably not worse than Adobe AIR right now.
Yar
A: 

I don't think there is a future for WinForms at all. Since it appears to have been a stop-gap solution even in MSFT world ( a very thin wrapper around Win32). And virtually no changes seem to have been made to System.Windows.Forms in both .NET 3.0 and 3.5

</speculation>

I would use Java or Air.

pb
why did this get voted down? Were there changes made to Winforms in .net 3.0 and 3.5?
Yar
+6  A: 

As far as my experience in Flex/AIR/Flash actionscripting goes, Adobe AIR development environment and coding/debugging toolsets are far inferior to the Visual Studio and .NET SDK as of the moment. The UI toolsets are superior though.

But as you already have a working C# code, porting it to ActionScript might requires a redesign due to ActionScript having a different way of thinking/programming, they use different primitive data types, for example, they use just a Number instead of int float double etc. and the debugging tools are quiet lacking compared to VS IMO.

And I heard that Mono's GtkSharp is quiet a decent platform.

But if you don't mind the coding/debugging tooling problems, then AIR is a great platform. I like how Adobe integrates the Flash experience into it e.g. you can start an installation of AIR application via a button click in a flash movieclip, that kind of integration.

chakrit
Sorry, I just changed the question: I need something for Mac, PC and Linux. At the same time, I have found that building UI components and any kind of serious UI work is 20x easier in Flex -- with pure Flash as an option -- than in .Net. But that's an opinion.
Yar
Ah, point well taken. But my point was that you _already_ have working C# code so a port to AIR might be _big_ rewrite compared to just porting it to Mono.
chakrit
And about the tools, I mean the debugging/coding tools. The Flash platform sure have superior UIs tools no doubt :-) editing my answers now
chakrit
But, if you want to use GtkSharp, you'll be rewriting too! WinForms are supported by Mono, so just use Mono/Winforms as is!
sgwill
What I don't understand is IF GtkSharp really works for Mac, or if it needs Gnome. Maybe I'll have to make another question for this. THANKS!
Yar
Also, Chakrit, while I'm here (does anybody read these comments?), let me mention: in ActionScript 3.0, stuff is better. Better data types and also it's QUITE object oriented. But it's not really a typed language, so of course C# has less midnight debugging :)
Yar
@Daniel yah, I stopped writing ActionScript just after AS3 was out... I did write some of it.. but the tooling problems just kills me even with the new flex builder! maybe I'm too addicted to my IDE :-(
chakrit
Chakrit, true that is... I did a small project in Java recently and Eclipse is amazing compared to FlexBuilder for AS3. In Java you can literally write a method name with parameters and it will ask you, "create the method sig with these parameter types?" That frees you up to really write code.
Yar
+1  A: 

If you want to use the .net Framework, Microsoft Silverlight is a good (the only?) choice. The browser does a good job as a shell, but you could also write your own application shell for it. For example, Scott Handelman mentions the NY Times Reader written in Silverlight and hostet on Cocoa on a Mac.

Thomas Danecker
Excuse my ignorance, but does Silverlight run real C# dlls?
Yar
+3  A: 

Why would you go with Air?

Use GTK#, and you have a cross platform forms engine and you get to keep your C# code.

FlySwat
Sorry I overlooked this answer back in September. Now that I did a port to Winforms on Mono in 3 days, it is working 90% for me... now I'm shopping for the rest. GTK# might do it... Thanks again.
Yar
GTK# rocks! man
Sumit Ghosh
A: 

I think that as long as you make sure that the business logic code you write is cross-platform (i.e. using backslashes in paths only works on Windows - forward slashes works on all OS's), then Mono shouldn't have major problems running an unmodified WinForms program. Just make sure you test for graphical glitches.

if you build your paths with System.IO.Path.Combine, it uses a value appropriate to the underlying O/S automatically.
TheoJones
A: 

I asked a similar question last week. I've been using Mono all along, and have had no issues running the applications I compile to IL to run on SuSE linux (I usually run KDE) or windows, however, I've not gone out and got a mac yet to test it on. I will be soon, though, probably with in a couple weeks. But all and all development in Mono has been very good at creating application that will run on multiple platforms.

stephenbayer
An app that runs how? As a command line app?
Yar
+2  A: 

I'm thinking of redoing it in Adobe AIR

Not having spent much time with AIR, my personal opinion is that it is best for bringing a webapp to the desktop and provide a shell to it or run your existing flash/flex project on the desktop.

Btw, if you don't know ActionScript, I mean its details, quirks, etc, don't forget to factor in the time it will take googling for answers.

Are there any arguments in favor of WinForms as a cross-platform app? Is there a cross-platform future for Winforms (e.g., Mono, etc.)?

It's always hard to predict what will happen, but there is at least one project (Plastic SCM) I know of which uses Mono Winforms on Win, Mac and Linux, so it is certainly doable. However, they say they built most of their controls from the ground up (and claim they want to release them as open source, but not sure if or when), so you will need to put in some work to make things look "pretty".

I played with Winforms on non-windows platforms and unfortunately, it isn't exactly "mature" (especially on Mac). So what you get out of the box may or may not be sufficient for your needs.

If you decide a desktop app is not the best way to provide a cross-platform solution, you can always take your business logic written in C# and create either a full-blown webapp with ASP.NET or go with Silverlight, so many other options exist with C#.

Emrah
Thanks for your informed answer, entell. I don't know WHY people think that AIR is "best for bringing a webapp to the desktop." Is there any particular limit to AIR apps? Sad but true, no doubt, your conclusions about non-Windows WinForms. Yes re: silverlight. Thanks for the answer.
Yar
Months later: yes there are serious limits to AIR. For one, it cannot execute arbitrary code, nor manipulate big XML with ease. That's two...
Yar