使C#/ Winform应用程序跨平台 - 我应该使用AIR,Mono还是其他东西?

时间:2022-10-19 22:37:34

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?

我有一个用C#/ WinForms(我的小应用程序)编写的应用程序。为了使它跨平台,我正在考虑在Adobe AIR中重做它。有没有任何论据支持WinForms作为跨平台应用程序? Winforms是否存在跨平台的未来(例如,Mono等)?跨平台UI开发的建议?

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

跨平台我的意思是,目前,Mac OSX,Windows和Linux。

This question was asked again and answered with better success.

这个问题再次被问到并得到了更好的回答。

9 个解决方案

#1


5  

I'm thinking of redoing it in Adobe AIR

我正在考虑在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.

我没有花太多时间使用AIR,我个人认为最好是将webapp引入桌面并为其提供shell或在桌面上运行现有的flash / flex项目。

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.

顺便说一句,如果你不了解ActionScript,我的意思是它的细节,怪癖等,不要忘记考虑谷歌搜索答案的时间。

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.)?

有没有任何论据支持WinForms作为跨平台应用程序? Winforms是否存在跨平台的未来(例如,Mono等)?

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".

总是很难预测会发生什么,但至少有一个我知道的项目(塑料SCM)在Win,Mac和Linux上使用Mono Winforms,所以它肯定是可行的。然而,他们说他们从头开始构建他们的大多数控件(并声称他们希望将它们作为开源发布,但不确定是否或何时),所以你需要投入一些工作来使事情看起来“漂亮” 。

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.

我在非Windows平台上玩Winforms,不幸的是,它并不完全“成熟”(特别是在Mac上)。所以你开箱即用可能会或可能不足以满足你的需求。

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#.

如果您认为桌面应用程序不是提供跨平台解决方案的最佳方式,那么您始终可以使用C#编写业务逻辑并使用ASP.NET创建完整的Web应用程序,或者使用Silverlight,还有很多其他选项存在于C#中。

#2


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.

就我在Flex / AIR / Flash actionscripting中的经验而言,Adobe AIR开发环境和编码/调试工具集目前远不如Visual Studio和.NET SDK。 UI工具集虽然优越。

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.

但是,由于您已经有了一个可用的C#代码,将其移植到ActionScript可能需要重新设计,因为ActionScript具有不同的思维/编程方式,它们使用不同的原始数据类型,例如,它们只使用Number而不是int float double与VS IMO相比,调试工具很安静。

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

我听说Mono的GtkSharp是一个不错的平台。

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.

但是如果你不介意编码/调试工具问题,那么AIR就是一个很好的平台。我喜欢Adobe如何将Flash体验整合到其中,例如您可以通过Flash动画片段中的按钮单击开始安装AIR应用程序,这种集成。

#3


3  

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

Mono完全支持WinForms,因此它们是跨平台的。

#4


3  

Why would you go with Air?

你为什么选择Air?

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

使用GTK#,你有一个跨平台表单引擎,你可以保留你的C#代码。

#5


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.

我认为使用C#可靠地实现跨平台的唯一方法是Microsoft Silverlight,但实际上不是WinForms,而是基于浏览器。除此之外,是Mono是一个机会。

#6


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.

如果您想使用.net Framework,Microsoft Silverlight是一个很好的(唯一的?)选择。浏览器作为shell做得很好,但您也可以为它编写自己的应用程序shell。例如,斯科特·汉德尔曼(Scott Handelman)提到在Silverlight上写的纽约时报读者和在Mac上的Cocoa上的hostet。

#7


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

我认为WinForms根本没有未来。因为即使在MSFT世界(Win32的一个非常薄的包装器),它似乎也是一个止损解决方案。几乎没有对.NET 3.0和3.5中的System.Windows.Forms进行任何更改

</speculation>

I would use Java or Air.

我会使用Java或Air。

#8


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.

我认为,只要你确保你编写的业务逻辑代码是跨平台的(即在路径中使用反斜杠只能在Windows上运行 - 正斜杠适用于所有操作系统),那么Mono应该没有运行未经修改的主要问题WinForms程序。只需确保测试图形故障。

#9


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.

上周我问了一个类似的问题。我一直在使用Mono,并且没有运行我编译为IL的应用程序在SuSE linux(我通常运行KDE)或Windows上运行的问题,但是,我没有出去并且还没有测试到Mac它在。不过,我很快就会在几周内完成。但Mono的所有开发都非常擅长创建可在多个平台上运行的应用程序。

#1


5  

I'm thinking of redoing it in Adobe AIR

我正在考虑在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.

我没有花太多时间使用AIR,我个人认为最好是将webapp引入桌面并为其提供shell或在桌面上运行现有的flash / flex项目。

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.

顺便说一句,如果你不了解ActionScript,我的意思是它的细节,怪癖等,不要忘记考虑谷歌搜索答案的时间。

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.)?

有没有任何论据支持WinForms作为跨平台应用程序? Winforms是否存在跨平台的未来(例如,Mono等)?

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".

总是很难预测会发生什么,但至少有一个我知道的项目(塑料SCM)在Win,Mac和Linux上使用Mono Winforms,所以它肯定是可行的。然而,他们说他们从头开始构建他们的大多数控件(并声称他们希望将它们作为开源发布,但不确定是否或何时),所以你需要投入一些工作来使事情看起来“漂亮” 。

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.

我在非Windows平台上玩Winforms,不幸的是,它并不完全“成熟”(特别是在Mac上)。所以你开箱即用可能会或可能不足以满足你的需求。

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#.

如果您认为桌面应用程序不是提供跨平台解决方案的最佳方式,那么您始终可以使用C#编写业务逻辑并使用ASP.NET创建完整的Web应用程序,或者使用Silverlight,还有很多其他选项存在于C#中。

#2


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.

就我在Flex / AIR / Flash actionscripting中的经验而言,Adobe AIR开发环境和编码/调试工具集目前远不如Visual Studio和.NET SDK。 UI工具集虽然优越。

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.

但是,由于您已经有了一个可用的C#代码,将其移植到ActionScript可能需要重新设计,因为ActionScript具有不同的思维/编程方式,它们使用不同的原始数据类型,例如,它们只使用Number而不是int float double与VS IMO相比,调试工具很安静。

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

我听说Mono的GtkSharp是一个不错的平台。

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.

但是如果你不介意编码/调试工具问题,那么AIR就是一个很好的平台。我喜欢Adobe如何将Flash体验整合到其中,例如您可以通过Flash动画片段中的按钮单击开始安装AIR应用程序,这种集成。

#3


3  

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

Mono完全支持WinForms,因此它们是跨平台的。

#4


3  

Why would you go with Air?

你为什么选择Air?

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

使用GTK#,你有一个跨平台表单引擎,你可以保留你的C#代码。

#5


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.

我认为使用C#可靠地实现跨平台的唯一方法是Microsoft Silverlight,但实际上不是WinForms,而是基于浏览器。除此之外,是Mono是一个机会。

#6


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.

如果您想使用.net Framework,Microsoft Silverlight是一个很好的(唯一的?)选择。浏览器作为shell做得很好,但您也可以为它编写自己的应用程序shell。例如,斯科特·汉德尔曼(Scott Handelman)提到在Silverlight上写的纽约时报读者和在Mac上的Cocoa上的hostet。

#7


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

我认为WinForms根本没有未来。因为即使在MSFT世界(Win32的一个非常薄的包装器),它似乎也是一个止损解决方案。几乎没有对.NET 3.0和3.5中的System.Windows.Forms进行任何更改

</speculation>

I would use Java or Air.

我会使用Java或Air。

#8


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.

我认为,只要你确保你编写的业务逻辑代码是跨平台的(即在路径中使用反斜杠只能在Windows上运行 - 正斜杠适用于所有操作系统),那么Mono应该没有运行未经修改的主要问题WinForms程序。只需确保测试图形故障。

#9


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.

上周我问了一个类似的问题。我一直在使用Mono,并且没有运行我编译为IL的应用程序在SuSE linux(我通常运行KDE)或Windows上运行的问题,但是,我没有出去并且还没有测试到Mac它在。不过,我很快就会在几周内完成。但Mono的所有开发都非常擅长创建可在多个平台上运行的应用程序。