C# 目前有哪些 Windows GUI 框架值得学习?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9752375/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 08:43:01  来源:igfitidea点击:

Which Windows GUI frameworks are currently worth learning?

c#javawindowsuser-interface

提问by Dave

I'm planning to write a Windows app to help myself with some exploratory testing tasks (note taking, data generation, defect logging) and I've got stuck at the early stage of choosing a framework/language. My sole experience is with web development and from what I can see, WinForms, WPF, Silverlight, Swing etc are all simultaneously obsolete and thriving depending on who you ask.

我计划编写一个 Windows 应用程序来帮助自己完成一些探索性测试任务(记笔记、数据生成、缺陷记录),但我在选择框架/语言的早期阶段陷入了困境。我唯一的经验是 Web 开发,据我所知,WinForms、WPF、Silverlight、Swing 等都同时过时和蓬勃发展,这取决于你问谁。

While my main aim is to create the app, obviously I'd like to learn something useful while doing so rather than picking up skills with something that's never going to be seen on a project at work. Which Java or C# frameworks would people recommend learning?

虽然我的主要目标是创建应用程序,但显然我想在这样做的同时学习一些有用的东西,而不是学习一些在工作项目中永远不会看到的技能。人们会推荐学习哪些 Java 或 C# 框架?

采纳答案by ApprenticeHacker

Note:consider when this answer was posted (2012). Since then, things have changed a bit, for example Silverlighthas been deprecated.

注意:请考虑发布此答案的时间(2012 年)。从那时起,情况发生了一些变化,例如Silverlight已被弃用。



Native Applications

本机应用程序

For employment: Well, nowadays most companies (at least most companies from Oman and the UAE, where I live) are slowly migrating to the cloud. However there are still some opportunities for native app development. The most demanding framework nowadays, is, ( no.. not WPF), it's Windows Forms!

对于就业:嗯,现在大多数公司(至少来自我居住的阿曼和阿联酋的大多数公司)正在慢慢迁移到云。然而,原生应用程序开发仍有一些机会。现在最苛刻的框架是,(不.. 不是WPF),它是Windows 窗体

Why plain old Windows Forms instead of the awesome WPF? One reason, legacy apps. Nowadays most companies only start small scale GUI Application projects, mainly Business applications. For that, WPF will be very expensive since they already have a work-force experienced in Windows Forms, and a lot of legacy code, however for WPF they will have to create a new code-base, and that's pretty risky. So the best thing to keep you employed is Windows Forms.

为什么使用普通的旧 Windows 窗体而不是令人敬畏的 WPF?原因之一,遗留应用程序。现在大多数公司只开始小规模的 GUI 应用程序项目,主要是业务应用程序。为此,WPF 将非常昂贵,因为他们已经拥有在 Windows 窗体方面经验丰富的劳动力和大量遗留代码,但是对于 WPF,他们将不得不创建一个新的代码库,这非常冒险。因此,让您保持就业的最佳方式是 Windows 窗体。

For new projects: However, if by 'worth learning', you mean, new, ambitious and glamorous. Then WPF may be the best choice for you. It depends on what your requirements are, really.

对于新项目:然而,如果说“值得学习”,你的意思是新的、雄心勃勃的和迷人的。那么WPF可能是你的最佳选择。这取决于你的要求是什么,真的。

The Cloud

云端

Now, for the cloud. Java FX and Silverlight are both currently head to head. However Java FX may have an edge since it supports a greater number of platforms. But then again, Silverlight has all the power and resources of Microsoft behind it, and it's ideal for Windows Phone development.

现在,对于云。Java FX 和 Silverlight 目前都是正面交锋。然而,Java FX 可能具有优势,因为它支持更多的平台。但话又说回来,Silverlight 拥有 Microsoft 的所有力量和资源,它非常适合 Windows Phone 开发。

Comparison

比较

For a comparison, here's what you get by each toolkit:

为了进行比较,以下是您通过每个工具包获得的内容:

Windows Presentation Foundation:

Windows 演示基础

  • The power and resources of Microsoft
  • Ideal for creating new Desktop Applications
  • Eye candy
  • Awesome API
  • XAML, best way to separate design from logic
  • Create Apps for the Cloud (but they only work on Windows with .NET though)
  • Windows Phone can run a subset of WPF
  • 微软的力量和资源
  • 非常适合创建新的桌面应用程序
  • 秀色可餐
  • 很棒的API
  • XAML,将设计与逻辑分开的最佳方式
  • 为云创建应用程序(但它们只能在带有 .NET 的 Windows 上运行)
  • Windows Phone 可以运行 WPF 的一个子集

Windows Forms:

Windows 窗体

  • Used to possess the power and resources of Microsoft, now WPF has that
  • Ideal for maintaining legacy applications
  • A well-trained workforce, if you're an entrepreneur
  • Pretty mature API
  • Supports more platforms than WPF (through Mono)
  • 曾经拥有微软的力量和资源,现在WPF有了
  • 非常适合维护遗留应用程序
  • 训练有素的劳动力,如果您是企业家
  • 相当成熟的API
  • 支持比 WPF 更多的平台(通过 Mono)

Java FX:

Java外汇

  • Create Apps for the Cloud
  • Backed by Oracle
  • Pretty nice API
  • Cross-platform, runs on most PCs, smart phones are a problem.
  • 为云创建应用程序
  • 由 Oracle 提供支持
  • 相当不错的API
  • 跨平台,在大多数PC上运行,智能手机是一个问题。

Silverlight:

银光

  • Create Apps for the Cloud
  • Backed by Microsoft
  • Pretty awesome API
  • XAML
  • Cross-platform, runs on Mac and PC, runs on Windows Phone.
  • 为云创建应用程序
  • 由微软支持
  • 非常棒的API
  • XAML
  • 跨平台,在Mac和PC上运行,在Windows Phone上运行。

GTK#:

GTK#:

  • Cross-platform, runs on most PCs, runs on no smart phone.
  • Backed by the Open-Source world
  • Endorsed by Mono
  • Ideal for creating Apps for Gnome.
  • 跨平台,可在大多数 PC 上运行,无需在智能手机上运行。
  • 由开源世界提供支持
  • 由 Mono 认可
  • 非常适合为 Gnome 创建应用程序。

Swing:

摆动

  • Cross-platforms, runs on most PCs, smart phones are a problem.
  • Pretty mature
  • Ideal for creating 2D games, using Java2D
  • 跨平台,在大多数 PC 上运行,智能手机是一个问题。
  • 相当成熟
  • 非常适合使用 Java2D 创建 2D 游戏

Conclusion

结论

As you say:

正如你所说:

While my main aim is to create the app, obviously I'd like to learn something useful while doing so rather than picking up skills with something that's never going to be seen on a project at work.

虽然我的主要目标是创建应用程序,但显然我想在这样做的同时学习一些有用的东西,而不是学习一些在工作项目中永远不会看到的技能。

Well, the frameworks you are most likely to see at work (if you don't for mainstream companies like Microsoft, Oracle, Google etc. ) are Windows Forms and WPF. At least that's what most companies use here. So those are what I recommend. JavaFX and Silverlight also look like they have potential and may be used in the near future.

好吧,您在工作中最有可能看到的框架(如果您不使用 Microsoft、Oracle、Google 等主流公司的话)是 Windows Forms 和 WPF。至少这是大多数公司在这里使用的。所以这些就是我推荐的。JavaFX 和 Silverlight 看起来也很有潜力,可能会在不久的将来使用。

回答by assylias

Java FX 2.0seems very promising and is now live if swing looks obsolete to you. Note that it has little in common with previous versions. See for example this short comparison with swing. And oracle said they plan to open the source.

Java FX 2.0看起来很有前途,如果 Swing 对你来说已经过时了,它现在已经上线了。请注意,它与以前的版本几乎没有共同之处。例如,请参见与 swing 的简短比较。而且oracle表示他们计划开源。

Now it is fairly new so unlikely to be used in existing applications.

现在它相当新,因此不太可能在现有应用程序中使用。

回答by alex.b

WPF. Best support for Windows. BTW, it's not obsolete.

WPF. 对 Windows 的最佳支持。顺便说一句,它并没有过时。

回答by Kyberias

One option for you might be to create your application as HTML+Javascript and run it in your desktop application by embedding a browser engine (IE or something else). If you need native APIs, there are mechanisms to make these available to browser's Javascript code.

您的一种选择可能是将您的应用程序创建为 HTML+Javascript,并通过嵌入浏览器引擎(IE 或其他引擎)在您的桌面应用程序中运行它。如果您需要本机 API,有一些机制可以使这些 API 可用于浏览器的 Javascript 代码。