CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2011

    MVC framework (Winforms)

    Unfortunatelly I need to use WinfForms because XNA doesn't support WPF. I think MVC\MVP is the best pattern for this technology. At the beginning I wanted to use MVC# but it's not supported anymore.
    Which MVC framework do you recomend?

  2. #2
    Join Date
    Dec 2011

    Re: MVC framework (Winforms)

    Any ideas?

  3. #3
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008

    Re: MVC framework (Winforms)

    It would help if you at least gave people a hint what it is you are trying to do.
    Always use [code][/code] tags when posting code.

  4. #4
    Join Date
    Dec 2011

    Re: MVC framework (Winforms)

    I want just Model-View-Controller framework like MVC#. I don't want to use MVC# because it's not anymore supported. Maybe there are any libraries which still are being updated?

  5. #5
    Join Date
    Jan 2010

    Re: MVC framework (Winforms)

    MVC/MVP (or rather, MVP these days) is an architectural style geared towards separating the responsibilities of the and within the presentation layer (UI, how the information is presented to the user on one hand, and the presentation logic itself on the other), from the domain layer (data the application is supposed to work with), as well as facilitating testing, especially using mock objects.

    Now, XNA is a framework for games, and in games you usually wouldn't use Windows Forms controls for your game UI, but something more game-specific, and something based on the game's rendering engine itself.
    That means that you would have to develop your own UI library for that game (or game engine), that would facilitate elements to be incorporated into the HUD, or even float over your game characters, stuff like that. This doesn't have to be a full fledged UI library, but still, it's not an easy task - you have to consider how you'll detect input (XNA should provide a method), how you'll determine wich UI element receives input, how to respond to it, how to make your UI elements customizable, and to what point, etc.

    Today's UIs use the MVP variant, since in MVP the View has the capability to detect user input, and modern UI's can do that. There, the View represents the whole window; the earlier pattern/style, MVC, was developed when Views were by design oblivious to user input, so each View (any widget like a button, label, textbox, as well as the whole window) was accompanied with a Controller, thus forming View-Controller pair. Controller would be able to detect external input, and was also responsible to handle most of the presentation logic of it's pair View.
    So, the MVC variant probably can be in some form applied to game programming, and if you're up to it, you can organize your code in the style of MVC/MVP yourself, without using any 3rd-party MVC/MVP library.

    Some further things to be aware of... Views implement only the bare bones functionality directly related to displaying UI elements on the screen, like how a button should look, or how it should behave when clicked (in the sense that it should appear depressed, not (!) how the overall application should respond to that event). Presentation logic on the other hand, is related to application-specific data-representation logic, things like whether some UI elements should be enabled or not when a specific radio button is selected, or if some text should appear red based on certain conditions, or if some panel should be shown or not.

    Now, all that said, you have several options:
    • Apply MVC/MVP yourself
    • Use an MVC/MVP library which provides support for absolutely custom views, even if they are made specifically for your game,
    • Use windows controls that will feel somewhat awkward in your game

    Now, if this is what you mean by MVC#, then, as far as I can tell, it only requires your View classes to implement the IView interface, so you'll probably be able to use it, although it will require significantly more work for custom GUIs.

    At the beginning I wanted to use MVC# but it's not supported anymore.
    What do you mean? MVC# is not supported by it's developer team? Or it's not supported by XNA? Or XNA is not supported by MVC#? (Dunno if they had any connection before.)

    If MVC# is stable enough - you could still use it.
    Last edited by TheGreatCthulhu; December 30th, 2011 at 11:05 AM.

  6. #6
    Join Date
    Mar 2002

    Re: MVC framework (Winforms)

    Last edited by ewomack; December 30th, 2011 at 04:48 PM.
    Ed Womack
    Get Milked

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.