从表单迁移到 WPF

发布于 2024-08-29 22:24:10 字数 274 浏览 1 评论 0原文

我们正在考虑将 WinForms 应用程序迁移到 WPF,但现在 4.0 已经发布,我们才刚刚开始 WPF 学习曲线。

我想做的是将我们的应用程序命令(剪切、复制、粘贴等)迁移到类似 WPF 的命令绑定系统,同时仍然作为 WinForms 应用程序运行 - 但以这样的方式使迁移变得容易当我们继续使用 WPF 时。

理想的方法是直接使用 WPF 命令接口、类和事件来实现我们的命令,并简单地将 WinForms 事件与我们自己的调度程序挂钩。

有没有人尝试过类似的事情或知道这是否可能?

We're considering migrating a WinForms app to WPF, but are just starting on the WPF learning curve now that 4.0 is out.

What I'd like to do is migrate our application commands (cut, copy, paste, etc) to a WPF-like command-binding system, while still running as a WinForms app - but in such a way as to make the migration easy when we go ahead with WPF.

The ideal approach would be to implement our commands using the WPF command interfaces, classes and events directly, and simply hooking the WinForms events up to them with our own dispatcher.

Has anyone tried something like this or know if it might be possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花想c 2024-09-05 22:24:10

看来,由于没有人有任何答案,最安全的方法是使用类似 WPF 的结构和类命名,以便将我们所有的业务逻辑封装到命令中,然后暂时使用我们自己的调度机制在 WinForms 应用程序中。这将使命令的移植变得简单(只需更改它们以从 WPF 类/接口派生) - 然后我们只需将新的 WPF UI 绑定到现有命令并删除我们的 WinForms 调度代码。

It appears, as nobody has any answers, that the safest approach for this will be to use a WPF-like structure and naming for the classes so that all our business logic is encapsulated into Commands, then use our own dispatch mechanism for the time being in the WinForms app. This would make the Commands trivial to port (just changing them to derive off the WPF classes/interfaces) - then we'd just need to bind new WPF UI to the existing commands and strip out our WinForms dispatch code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文