简体   繁体   English

将C#WPF .NET 4.0应用程序移植到Mac OS X(Mono?)的建议

[英]Recommendations for porting a C# WPF .NET 4.0 application to Mac OS X (Mono?)

I currently have a (non commercial) application created in MS Visual C# 4.5, using WPF and LINQ. 我目前在MS Visual C#4.5中创建了一个(非商业)应用程序,使用WPF和LINQ。

To make a future porting possible to Mac OS X, I have used the MVVM design pattern to split the logic and user interface. 为了使将来可能移植到Mac OS X,我使用MVVM设计模式来分割逻辑和用户界面。

I would like to know: 1) I know WPF is not supported by Mono. 我想知道:1)我知道Mono不支持WPF。 I use a lot of bindings. 我使用了很多绑定。 Is it possible to port this into WinForms (or another way that is supported by Mono) in a reasonably easy manner? 是否可以以一种相当简单的方式将其移植到WinForms(或Mono支持的其他方式)?

2) I guess all LINQ functionality has to be changed into for/foreach loops? 2)我想所有LINQ功能都必须转换为for / foreach循环?

3) Are there other considerations or recommendations I can take into account or warn when porting it? 3)是否有其他考虑或建议我可以考虑或在移植时发出警告?

Thanks in advance. 提前致谢。

Silverligt runs on the Mac. Silverligt在Mac上运行。 If your application can be limited to what is possible in Silverlight the porting will be very easy because basically Silverlight is WPF in the browser. 如果你的应用程序可以限制在Silverlight中,那么移植将非常简单,因为基本上Silverlight在浏览器中是WPF。 In the recently released Silverlight 5 you are able to access the entire local file system when running out-of-browser and you can also create multiple windows. 在最近发布的Silverlight 5中,您可以在浏览器外运行时访问整个本地文件系统,还可以创建多个窗口。

As mentioned in the comments, the Mono XWT cross platform Widget toolkit should do the trick - if (as of April 2012) you're willing to work with very fresh code. 正如评论中所提到的,Mono XWT跨平台Widget工具包应该可以解决这个问题 - 如果(截至2012年4月),您愿意使用非常新的代码。

XWT is similar to the SWT widget kit for Eclipse/Java in that it maps directly to the native OS's widgets for Mac-OSX, Linux, and Windows-WPF. XWT类似于Eclipse / Java的SWT小部件工具包,它直接映射到Mac-OSX,Linux和Windows-WPF的本机OS小部件。 It differs in that it is based on the layout system and general API of the GTK-Sharp library used for much of the Mono tools stack (ie MonoDevelop, MonoDoc, Banshee, etc.) According to the FOSDEM slides, XWT is intended as a replacement/addition to GTK-Sharp for the Mono project and Xamarin's use in MonoDevelop. 它的不同之处在于它基于GTK-Sharp库的布局系统和通用API,用于大多数Mono工具堆栈(即MonoDevelop,MonoDoc,Banshee等)。根据FOSDEM幻灯片,XWT旨在用作替换/添加GTK-Sharp用于Mono项目和Xamarin用于MonoDevelop。 My guess is that they want to move MonoDevelop to appear to be more OS native and/or prettier that the GTK widget kit allows presently, possibly to bring their toolchain more towards parity with the Eclipse offerings. 我的猜测是他们想让MonoDevelop看起来更像OS本机和/或更漂亮,GTK小工具包目前允许,可能使他们的工具链更多地与Eclipse产品相提并论。

At the time of the writing this answer, the XWT toolkit was still undergoing heavy development (particularly the Windows WPF version), but was reasonably functional on all three platforms. 在撰写本答案时,XWT工具包仍在进行大量开发(特别是Windows WPF版本),但在所有三个平台上都具有相当的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM