The Unveiling


A lot of work has gone into this payroll application, and at last we'll see it come alive with its new graphical user interface. Listing 38-19 contains the PayrollMain class, the entry point for the application. Before we can load the Payroll view, we need an instance of the database. In this code listing, an InMemoryPayrollDatabase is being created. This is for demonstration purposes. In production, we'd create an SqlPayrollDatabase that would link up to our SQL Server database. But the application will happily run with the InMemoryPayrollDatabase while all the data is saved in memory and loaded in memory.

Next, an instance of WindowViewLoader is created. LoadPayrollView is called, and the application is started. We can now compile, run it, and add as many employees to the system as we like.

Listing 38-19. PayrollMain.cs

using System.Windows.Forms; using Payroll; namespace PayrollUI {   public class PayrollMain   {     public static void Main(string[] args)     {       PayrollDatabase database =         new InMemoryPayrollDatabase();       WindowViewLoader viewLoader =         new WindowViewLoader(database);       viewLoader.LoadPayrollView();       Application.Run(viewLoader.LastLoadedView);     }   } }




Agile Principles, Patterns, and Practices in C#
Agile Principles, Patterns, and Practices in C#
ISBN: 0131857258
EAN: 2147483647
Year: 2006
Pages: 272

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net