6

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.

Community
  • 1
  • 1
Dan Rosenstark
  • 68,471
  • 58
  • 283
  • 421
  • Let me look into my crystal ball... – GEOCHET Sep 16 '08 at 14:02
  • 1
    A crystal ball would be nice, but fact-based speculation is cool too. – Dan Rosenstark Sep 16 '08 at 15:42
  • 2
    Coming back with some of the more recent solutions that didn't exist a decade ago: Eto.Forms for winforms, Avalonia for WPF, Blazor for a C# web app. ASP.Net still works, but I feel it's losing ground. Gtk# is a little more obscure and not native C# but works as well. Silverlight had a harsh death. Just for future readers. – person27 Dec 05 '19 at 05:29

9 Answers9

6

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
  • 61,017
  • 25
  • 133
  • 162
  • 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. – Dan Rosenstark Sep 16 '08 at 15:43
  • 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 Sep 16 '08 at 15:47
  • 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 Sep 16 '08 at 15:48
  • 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 Sep 17 '08 at 14:14
  • 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! – Dan Rosenstark Sep 18 '08 at 17:29
  • 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 :) – Dan Rosenstark Sep 18 '08 at 17:30
  • @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 Sep 18 '08 at 20:16
  • 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. – Dan Rosenstark Sep 22 '08 at 17:59
4

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 Diril
  • 1,687
  • 1
  • 19
  • 27
  • 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. – Dan Rosenstark Dec 22 '08 at 14:11
  • 1
    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... – Dan Rosenstark Aug 02 '09 at 13:50
3

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

Łukasz Sowa
  • 1,287
  • 2
  • 11
  • 14
3

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
  • 172,459
  • 74
  • 246
  • 311
  • 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. – Dan Rosenstark Aug 02 '09 at 13:55
1

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
  • 2,352
  • 4
  • 26
  • 42
  • You downplay mono way too much. – GEOCHET Sep 16 '08 at 14:04
  • 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 Sep 16 '08 at 14:29
  • 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. – Dan Rosenstark Dec 18 '08 at 19:19
1

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
  • 4,635
  • 4
  • 32
  • 31
0

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 Nov 20 '09 at 06:53
0

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
  • 12,373
  • 15
  • 63
  • 98
0

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.

Paul van Brenk
  • 7,450
  • 2
  • 33
  • 38