Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought

Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Author Topic: Getting started with C# & WinForms.  (Read 14435 times)
Posts: 1

View Profile Email
« on: July 19, 2010, 01:28:31 »

Hi folks:

I'm quite new to this, coming out of a security/encryption background, but I need to write a WinForms app in C# with .NET 3.5 for WinMobile 6/PocketPC 5. PureMVC seems the way to go; it covers all my target environments. However, I'm new not only to PureMVC, but to Win GUI programming. I hope this question isn't too, too, basic.

The Best Practices guide and the WPF example are extremely helpful. I have the WPF example up and running in Visual Studio, and am trying to get a very simple MVC Winforms app up and running.

My test app consists of 3 Forms, each has 1 button. Form1 goes to Form2, Form2 to Form3, and Form3 back to Form2. This allows startup specific code to be associated with Form1, and Forms 2&3 to have a nice symmetry.

This works fine in pure WinForms; I'm now trying to make it work via MVC. At the moment, my primary concern is 'Where the heck should I be initiating PureMVC?' The WPF app initiates its concrete Facade extension in App's constructor (an extension of Application).

Where would be the equivalent point in a WinForms app? In Main()? or in Form1's constructor? Somewhere else?

I'd love to see a small complete example, using C#, PureMVC, and Winforms, but have been unable to locate one. The best link I've found is
but its no where near complete.

thanks in advance,

Peter Trei

Jr. Member
Posts: 10

View Profile Email
« Reply #1 on: July 26, 2010, 09:00:52 »

Hi Peter,

Sorry for the slow response.  The way I instantiate PureMVC in my WinForms apps is in the following way:

/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
MainForm mf = new MainForm(args);
ApplicationFacade facade = (ApplicationFacade) ApplicationFacade.Instance;
catch (Exception ex)
// Log some errors, show message box, etc.

I hope this helps some, and post any other questions you have.

Andy Adamczak

Pages: [1]