O'Reilly logo

Pro WPF in C# 2008: Windows Presentation Foundation with .NET 3.5, Second Edition by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding Commands

In a well-designed Windows application, the application logic doesn't sit in the event handlers but is coded in higher-level methods. Each one of these methods represents a single application "task." Each task may rely on other libraries (such as separately compiled components that encapsulate business logic or database access). Figure 10-1 shows this relationship.

Mapping event handlers to a task

The most obvious way to use this design is to add event handlers wherever they're needed and use each event handler to call the appropriate application method. In essence, your window code becomes a stripped-down switchboard ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required