从表单迁移到 WPF
我们正在考虑将 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来,由于没有人有任何答案,最安全的方法是使用类似 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.