方法最佳实践 - VB.NET
我有一个程序变得非常大,通过所有函数和类找到所有内容是很痛苦的。
我正在尝试根据他们的方法将其分解为其他文件。
其中一些函数调用主类中的其他函数。我将大部分功能从私有更改为公共以访问此功能。我在调用某些代码创建的窗口时遇到问题,因此导入 mainwindow 对此有所帮助。
我的最后一个问题是从一个模块文件编辑主窗口用户界面。在继续分解之前,我想确保我在正确的页面上。我唯一的猜测是,他们更新用户界面的任何内容都应该留在主类中。
谢谢
I have a program that is getting pretty big and it is a pain to find everything through all the functions and classes.
I am trying to break it up into other files based on their method.
Some of these functions have calls to others in the main class. I changed most my functions from private to public to access this. I had problems calling certain code created windows so importing mainwindow helped that.
My last problem is editing the mainwindow ui from one of the module files. I want to make sure im on the right page before i continue breaking it up. My only guess is that anything they updates the ui should be left on the main class.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
表单类中的唯一代码应该是与其他类对话并根据其他类的数据更新 UI 的代码。
根据您的应用程序,表单类可能会处理来自其他类的更改事件,以更新 UI 或将用户输入传递到
Change
或Click
事件中的其他类。The only code in your form class should be code that talks to other classes and updates the UI based on data from other classes.
Depending on your application, the form class might handle change events from other classes to update the UI or pass user input to other classes in
Change
orClick
events.有几个选项:
A couple options: