简体   繁体   中英

MVC in c# win. form application

I 'am building a small windows form application.

I have a View - a simple form that has some functionality in it. a Controller - a class that will react to loading, saving, getting data from the model and prepare it form the view etc. a Model - a class that will get and save data to DB or file.

The controller is creating a form instance an run it, and creating a model instance when needed.

I wonder about how to react in the controller to the view events. Should I register to the view events (buttons click, combo change etc.) ? This will make the form controls visible outside the form?

Maybe I have a mistake in the design?

Microsoft has created a framework for Win Forms MVC applications, the Composite UI Application framework.

http://www.codeplex.com/smartclient

It is probably overkill for a small project, but you could look at it and get some ideas.

如果您使用Google MVP(模型查看呈现器),则会发现有关如何在Windows窗体应用程序中实现关注点分离模式的信息。

您能看看在winforms中使用MVC MVP模式的 SO帖子吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM