tag:blogger.com,1999:blog-6579772240267288367.post8351824949222050443..comments2023-06-05T08:45:12.716-04:00Comments on kwblog: MVC in Windows ApplicationsKevin Berridgehttp://www.blogger.com/profile/13759114853595462455noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-6579772240267288367.post-56327355074029026832008-02-14T15:03:00.000-05:002008-02-14T15:03:00.000-05:00i think i actually like the word action for it too...i think i actually like the word action for it too. I might switch to that. We do a model similar to what im describing at work and I'm trying to find a way to translate it to the PHP stuff i do at home. So now on all my forms ive added a hidden field called postback. If a form submits to itself postback will be set. If set it executes a Save or Process Action.Josh Schrammhttps://www.blogger.com/profile/04179432092617833919noreply@blogger.comtag:blogger.com,1999:blog-6579772240267288367.post-65296109077079198102008-02-14T11:10:00.000-05:002008-02-14T11:10:00.000-05:00I like that. Rather than having one big controlle...I like that. Rather than having one big controller class with many methods for each action, you have many "action" classes each performing one job.<BR/><BR/>You could mix and match between 1 controller and many controllers (actions) depending on the complexity of the View.<BR/><BR/>Quite nice!Kevin Berridgehttps://www.blogger.com/profile/13759114853595462455noreply@blogger.comtag:blogger.com,1999:blog-6579772240267288367.post-62454823259748798492008-02-14T11:06:00.000-05:002008-02-14T11:06:00.000-05:00I just noticed you replied to this comment. Basica...I just noticed you replied to this comment. <BR/><BR/>Basically yes. The commands tell the view what to do. If the action the view takes is complicated (say binding a dataset to a grid) the view might have a method exposed through an interface called BindMyDataGrid(Dataset data) and your controller calls View.BindMyDataGrid();<BR/><BR/>For testing the controller mocks out the view.Josh Schrammhttps://www.blogger.com/profile/04179432092617833919noreply@blogger.comtag:blogger.com,1999:blog-6579772240267288367.post-42483699365754724482008-01-31T23:28:00.000-05:002008-01-31T23:28:00.000-05:00I totally agree that the traditional WinForms prac...I totally agree that the traditional WinForms practice just feels "yucky." I've been trying to remove my logic from the form class and into a controller class for a few weeks now, but somehow Rails just makes it so much easier. I can't seem to figure it out in C#.Unknownhttps://www.blogger.com/profile/07836866342093878085noreply@blogger.comtag:blogger.com,1999:blog-6579772240267288367.post-46680290813838875192008-01-25T07:53:00.000-05:002008-01-25T07:53:00.000-05:00How does the view get updated in that arrangement?...How does the view get updated in that arrangement? Does each action class have a handle to the view so they can tell it what to do? Or does the view monitor the data class for updates?Kevin Berridgehttps://www.blogger.com/profile/13759114853595462455noreply@blogger.comtag:blogger.com,1999:blog-6579772240267288367.post-41560616442490333462008-01-24T22:34:00.000-05:002008-01-24T22:34:00.000-05:00One way ive seen this implemented is making each a...One way ive seen this implemented is making each action/ event execute a command. Your set of commands acts as your "controller" and they act upon a data model. <BR/><BR/>This keeps your form class clean (one line methods basically) and segments the different actions into their own classes. Also pretty easy to unit test the commandsJosh Schrammhttps://www.blogger.com/profile/04179432092617833919noreply@blogger.com