//constructor
        public ControllerMain(FormMain view) : base(null, null)
        {
            //connect controller to its view
            this.view = view;
            list_customers = new ArrayList();
            list_networks = new ArrayList();
            list_networkInventories = new ArrayList();
            list_allAvailableLicenses = new ArrayList();
            list_licenseInventories = new ArrayList();
            list_systems = new ArrayList();
            list_systemInventories = new ArrayList();
            list_Audits = new ArrayList();

            //initialising by database
            list_customers = db.GetCustomers();
            list_allAvailableLicenses = db.GetLicenses();
            list_networks = db.GetNetworks();
            list_networkInventories = db.GetNetworkInventories();
            list_licenseInventories = db.GetLicenseInventories();
            list_systems = db.GetClientSystems();
            list_systemInventories = db.GetSystemInventories();
            list_Audits = db.GetAudits();

            //Creating Forms
            fAudit = new FormAudit();
            fChanges = new FormChange();
            fCustomer = new FormCustomer();
            fLicense = new FormLicense();
            fNetwork = new FormNetwork();
            fSystemInventory = new FormSystemInventory();
            fAudit.Visible = false;
            fChanges.Visible = false;
            fCustomer.Visible = false;
            fLicense.Visible = false;
            fNetwork.Visible = false;
            fSystemInventory.Visible = false;

            //Creating Controllers and connect data
            cAudit = new ControllerAudit(this, fAudit, list_customers, list_licenseInventories, list_systemInventories, list_Audits, list_allAvailableLicenses);
            cChanges = new ControllerChanges(this, fChanges, list_customers, list_networks, list_networkInventories, list_licenseInventories, list_allAvailableLicenses, list_systems);
            cCustomer = new ControllerCustomer(this, fCustomer, list_customers);
            cLicense = new ControllerLicense(this, fLicense, list_customers, list_allAvailableLicenses, list_licenseInventories);
            cNetwork = new ControllerNetwork(this, fNetwork, list_customers, list_networks, list_networkInventories);
            cSystemInventory = new ControllerSystemInventory(this, fSystemInventory, list_customers, list_networks,
                                                             list_networkInventories, list_systems, list_systemInventories, list_allAvailableLicenses);

            //Connect Controller to View
            fAudit.Currentcontroller = cAudit;
            fChanges.Currentcontroller = cChanges;
            fCustomer.Currentcontroller = cCustomer;
            fLicense.Currentcontroller = cLicense;
            fNetwork.Currentcontroller = cNetwork;
            fSystemInventory.Currentcontroller = cSystemInventory;

            //Update View with Information initialised by Database
            UpdateView(true);

        }
示例#2
0
 static void Main()
 {
     //Initialize Main Form Forms
     FormMain FMain = new FormMain();
     FMain.Visible = false;
     //Initialize Controller
     ControllerMain CMain = new ControllerMain(FMain);
     //pass controller to Form
     FMain.Currentcontroller = CMain;
     FMain.ShowDialog();
 }