开发者

Winforms for a java swing guy [Applying MVC]

开发者 https://www.devze.com 2022-12-08 21:45 出处:网络
I am developing a GUI application in C# using the design mode in VS2008. Now that I am finished with the looks of the application I am ready to add some functionality to it.

I am developing a GUI application in C# using the design mode in VS2008. Now that I am finished with the looks of the application I am ready to add some functionality to it.

What really confuses me though, is that VS2008 designer only uses the empty constructor. When d开发者_运维知识库eveloping applications in Java I normally pass around a model and controller object to every view object in the constructor.

I am unsure if I have used the designer too much and needs to hardcode more or if there is some other way to do it. How do you pass around data to view objects?

Hope you understand me


  • you can use your constructor in subclasses of Form class without problems. However for Controls to be compatible with designer this doesn't work well.

  • You can pass model object to public property or method of you view object (form or control).

  • You can use Passive View or Supervising Controller patterns in which View knows little about model and is modified by Presenter.


Try to use : http://smartclient.codeplex.com/ (formerly known as Composite Application Block).

It's a MVP framework for Windows Form which allows you to do dependency injection of your presenter in your view.

Manitra.

0

精彩评论

暂无评论...
验证码 换一张
取 消