9.1. 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 9-1 shows this relationship.

Figure 9.1. 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 ...

Get Pro WPF in C# 2010: Windows Presentation Foundation in .NET 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.