Making a C#/Winform application cross-platform - should I use AIR, Mono, or something else?
Asked Answered
D

9

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.

Dorotea answered 16/9, 2008 at 14:1 Comment(3)
Let me look into my crystal ball...Darrendarrey
A crystal ball would be nice, but fact-based speculation is cool too.Dorotea
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.Teodoro
B
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#.

Baran answered 22/12, 2008 at 6:6 Comment(2)
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.Dorotea
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...Dorotea
W
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.

Weatherworn answered 16/9, 2008 at 14:5 Comment(8)
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.Dorotea
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.Weatherworn
And about the tools, I mean the debugging/coding tools. The Flash platform sure have superior UIs tools no doubt :-) editing my answers nowWeatherworn
But, if you want to use GtkSharp, you'll be rewriting too! WinForms are supported by Mono, so just use Mono/Winforms as is!Cardiac
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!Dorotea
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 :)Dorotea
@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 :-(Weatherworn
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.Dorotea
B
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#.

Baran answered 22/12, 2008 at 6:6 Comment(2)
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.Dorotea
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...Dorotea
C
3

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

Collimate answered 16/9, 2008 at 14:3 Comment(0)
S
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.

Stipend answered 16/9, 2008 at 14:34 Comment(1)
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.Dorotea
V
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.

Vulcanology answered 16/9, 2008 at 14:3 Comment(3)
You downplay mono way too much.Darrendarrey
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.Roderic
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.Dorotea
D
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.

Daffodil answered 16/9, 2008 at 14:33 Comment(1)
Excuse my ignorance, but does Silverlight run real C# dlls?Dorotea
T
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.

Trisyllable answered 16/9, 2008 at 14:5 Comment(1)
why did this get voted down? Were there changes made to Winforms in .net 3.0 and 3.5?Dorotea
A
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.

Armagnac answered 20/10, 2008 at 18:13 Comment(1)
if you build your paths with System.IO.Path.Combine, it uses a value appropriate to the underlying O/S automatically.Bourbon
R
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.

Rowlandson answered 20/10, 2008 at 18:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.