Home > Articles > Programming > C#

  • Print
  • + Share This
This chapter is from the book

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);

  • + Share This
  • 🔖 Save To Your Account