如何从Windows for Linux移植C#应用程序? [英] How to port C# applications from windows for linux?

查看:122
本文介绍了如何从Windows for Linux移植C#应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows.Forms库包含许多错误,有效地阻止了应用程序的运行. WinForms Designer无法将WebBrowser控件放在窗体上. NotifyIcon类在LXDE下不起作用(请参见KeePass的bugtracker).剪贴板类与Calculate Linux的默认管理器不兼容.拖放在DockPanelSuite中有问题.由于不透明问题,WinForms Designer尚未完成. WPF从未实施过,也没有计划这样做.

Windows.Forms library contain many bugs which effectively prevent applications from working. WinForms Designer is unable to put WebBrowser control on form. NotifyIcon class doesn't work under LXDE (see the bugtracker of KeePass). Clipboard class is incompatible with default manager of Calculate Linux. Drag and Drop have problems in DockPanelSuite. WinForms Designer is not finished because of opacity problems. WPF was never implemented and no plans to do it.

Mono团队说:我们不想开发WinForms,因为这是旧技术."

And mono team says "we don't want to develop WinForms, because this is old technology."

如何将一个从Windows移植到Linux的桌面C#应用程序移植?用Gtk#重写它似乎太难了...

How should one port desktop C# application from Windows to Linux? Rewriting it with Gtk# seems to be too hard...

更容易-修复单一WinForms,实现WPF或将世界上所有应用程序重写为Gtk#吗?

What is easier - to fix mono WinForms, to implement WPF, or to rewrite all applications in the world to Gtk# ?

推荐答案

您已经发现Mono WinForms实现仅适用于非常简单的应用程序.看看Xamarin员工Mike James的跨平台桌面用户界面" 博客文章谁总结了可用的解决方案:

As you have already found out Mono WinForms implementation is suitable only for very simple applications. Take a look at "Cross-Platform Desktop UIs" blog post from Xamarin employee Mike James who summarizes available solutions:

  1. 传统方法
    WPF XWT
    XWT工具箱使用相同的API,并在所有平台上提供本机外观,但仅实现了组件的有限子集.它在您的项目中的可用性取决于您真正需要的组件.
  2. HTML前端
    使用简单的WebView组件或 Awesomium HTML UI引擎创建HTML前端.在某些情况下,这可能是一个可行的选择,但我不确定是否可以通过这种方法来实现系统托盘图标.
  3. QTSHARP
    开源项目,旨在为多平台QT工具箱实现.NET绑定.我从未尝试过,但是根据项目网站,它似乎处于早期阶段,目前仅在Windows上进行过测试.
  1. Traditional approach
    WPF or WinForms frontend on Windows, GTK# frontend on Linux and Xamarin.Mac on Mac OS X. IMO this is the best way to go and it may be easier than it looks if you have correctly separated business and presentation layers in your app.
  2. XWT
    XWT toolkit uses the same API and provides native look on all platforms but only a limited subset of components is implemented. Its usability for your projects depends on what components you really need.
  3. HTML frontend
    Create HTML frontend using simple WebView component or Awesomium HTML UI Engine. This may be a viable option in some cases but I am not sure whether it is possible to implement systray icons with this approach.
  4. QTSHARP
    Open source project which aims to implement .NET bindings for multiplatform QT toolkit. I have never tried it but according to project website it seems to be in early stage and currently tested only on Windows.

顺便说一句,我目前正在将WinForms用于 Pkcs11Admin 应用程序,但是我计划在碰到Windows时尽快使用传统方法.在任何受支持的平台上的拦截器错误.

BTW I am currently using WinForms for Pkcs11Admin application but I plan to use traditional approach as soon as I hit a blocker bug on any of the supported platforms.

这篇关于如何从Windows for Linux移植C#应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆