是否有工具可以将 C# 1.1 Forms 设计转换为更新的标准?

发布于 2024-08-30 07:15:12 字数 229 浏览 1 评论 0原文

正如我们所知,旧代码是危险的,因为 GUI 布局和业务逻辑混合在一起。将两者分开可能是一项乏味且容易出错的任务。有没有一个工具可以为我做到这一点?

谢谢。

编辑:保持 UI 和逻辑分离的非常明显的方法是通过引入分部类。我希望这能澄清这个问题。我想我只是想从 1.1 转向 2.0 的做事方式。简单地在 VS2008 中打开并保存旧设计并不能达到我想要的效果。

The old code, as we know, is dangerous because both GUI layout and business logic are mixed into one. Separating the two can be a tedious and an error-prone task. Is there a tool that can do this for me?

Thanks.

EDIT: The pretty obvious way of keeping the UI and the logic separate is through introduction of a partial class. I hope that clarifies the question. I suppose I am simply trying to go from 1.1 to 2.0 way of doing things. Simply opening and saving the old design in VS2008 does not do what I want.

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

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

发布评论

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

评论(3

孤独陪着我 2024-09-06 07:15:13

没有工具,但可以通过剪切和粘贴文本编辑轻松完成。将新表单添加到您的项目中。在解决方案资源管理器中,打开窗体旁边的节点,然后双击 Designer.cs 文件。将 InitializeComponent() 方法从旧表单剪切并粘贴到该文件。剪切并粘贴其余代码。删除旧的表单,更改新表单的类名。

No tool, but easily accomplished with cut-and-paste text editing. Add a new form to your project. In the Solution Explorer, open the node next to the form and double-click the Designer.cs file. Cut and paste the InitializeComponent() method from your old form to that file. Cut and paste the rest of your code. Remove the old form, change the class name of the new one.

月亮是我掰弯的 2024-09-06 07:15:13

没有“标准”,但有很多标准,比如人们将逻辑与 UI 分开的方式。它迫使你设计一种特定的方式。所以自动重新设计你的软件有点不可能。

你拥有的最好的工具是重构工具,看看像 Resharper 这样的工具,它可以让进行一些转换变得更安全。

There is no "standard", but lots of standard like ways people separate logic from UI. It forces you to design a particular way. So its a bit impossible to automatically redesign your software.

The best you have is refactoring tools, check out something like Resharper, makes it a bit safer to make some transformations.

猥︴琐丶欲为 2024-09-06 07:15:13

。很遗憾,没有这样的工具,那仍然是手工工作。如果您无论如何都想这样做,我建议您研究一下 WPF 开发,因为那里的分离更容易实现。

No. Sry to say but there is no such tool, that is still manual work. If you're looking into doing it anyway I would suggest looking into WPF development, since the separation is much easier to realize there.

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