C# 将 Windows 窗体应用程序转换为 Asp.net
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/412763/
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
Convert Windows Forms application into Asp.net
提问by Ahmed Said
I am asking about the best tool that you used before to convert a c# windows forms application into asp.net? I already googledabout this topic and found alot of tools but I want someone to recommend the best one based on his usage.
我问的是您之前使用的将 ac# windows 窗体应用程序转换为 asp.net 的最佳工具?我已经在谷歌上搜索过这个话题并找到了很多工具,但我希望有人根据他的使用情况推荐最好的工具。
采纳答案by Jon Skeet
I really wouldn't recommend using a tool to do the conversion. Web applications and WinForms are fundamentally different, and should be designeddifferently. Even with the vast amount of Ajax kicking around these days, you still need to bear in mind the whole stateless HTTP model.
我真的不建议使用工具进行转换。Web 应用程序和 WinForms 是根本不同的,应该以不同的方式设计。即使现在有大量的 Ajax 出现,您仍然需要牢记整个无状态 HTTP 模型。
If you don't want to rethink the application, you might want to look into converting it to Silverlight 2.0 instead...
如果您不想重新考虑应用程序,您可能需要考虑将其转换为 Silverlight 2.0...
回答by GvS
You could consider hosting your Windows Forms application via Remote Desktop or Citrix
您可以考虑通过远程桌面或 Citrix 托管您的 Windows 窗体应用程序
回答by John Rudy
@Jon Skeethas the best advice. That said, let's examine the results of the Google link you provided. What would happen?
@Jon Skeet有最好的建议。也就是说,让我们检查您提供的 Google 链接的结果。会发生什么?
The majority of the on-topic (for the query) results are other programmers asking essentially the same question -- and getting essentially the same answer. Indeed, I only see one tool for this: A sample from CodeProject. In this tool, not only are the generated UIs barren and ugly, but there is the following big disclaimer:
大多数主题(对于查询)结果是其他程序员提出的基本相同的问题——并得到基本相同的答案。事实上,我只看到了一个工具:来自CodeProject的示例。在这个工具中,不仅生成的 UI 贫瘠丑陋,而且还有以下重要的免责声明:
Please note that it is not the intention of this article or the accompanying code sample to achieve a complete conversion between Windows Forms and Web Forms including all events and business logic. Due to the fundamentally different nature of the two programming models, this would be a fruitless attempt. Rather, we are targeting the user interface components themselves, mapping Windows Forms controls to appropriate Web Forms counterparts.
请注意,本文或随附的代码示例的目的不是实现 Windows 窗体和 Web 窗体之间的完整转换,包括所有事件和业务逻辑。由于两种编程模型的本质不同,这将是徒劳的尝试。相反,我们的目标是用户界面组件本身,将 Windows 窗体控件映射到适当的 Web 窗体对应物。
And therein lies the real rub: All it's doing is generating a (very rudimentary) UI based on your existing UI. All code, logic, flow and even navigation is up to you.
这就是真正的问题所在:它所做的只是根据您现有的 UI 生成一个(非常基本的)UI。所有代码、逻辑、流程甚至导航都由您决定。
Bottom line: The reason there's isn't a tool that pops up front and center is because such a tool would be nigh-impossible to write, and would churn out (most likely) un-navigable, non-functional sites. While WinForms and WebForms, programmatically, look similar, they are actually quite different under the hood. No tool will be able to generate an entire site for you from nothing but a WinForms app -- the models are more dissimilar than they might appear.
底线:没有一个工具在前面和中间弹出的原因是因为这样的工具几乎不可能编写,并且会产生(很可能)无法导航、无功能的站点。虽然 WinForms 和 WebForms 在编程上看起来很相似,但实际上它们在底层是完全不同的。除了 WinForms 应用程序之外,没有任何工具能够为您生成整个站点——模型比它们看起来更不相似。
At the end of the day, the best way to take a WinForms app and web-enable it is to have written said app such that all the business logic is encapsulated in its own DLL (or set thereof), and use those DLLs to drive the back-end of a new-from-scratch site. That way all you're developing is the front end and display support.
归根结底,使用 WinForms 应用程序并启用 Web 的最佳方法是编写所述应用程序,以便将所有业务逻辑封装在其自己的 DLL(或其中的集合)中,并使用这些 DLL 来驱动从头开始的新网站的后端。这样,您正在开发的只是前端和显示支持。
回答by Dimi Takis
Maybe you wanna try VisualWebGui? With some adjustments it would be probably possible for you to run your Windows Forms app inside a browser window.
也许您想尝试 VisualWebGui?通过一些调整,您可能可以在浏览器窗口中运行 Windows 窗体应用程序。
回答by Zuuum
VisualJS.NETis the solution you're looking for. Watch the videos
VisualJS.NET是您正在寻找的解决方案。观看视频