public Form1() { InitializeComponent(); ucProgress = new UC_Progress(this); ucAudit = new UC_Audit(this, ucProgress, auditLocation_Setting, exportLocation_Setting, includeAdministrator_Setting, numLevels_Setting); panel_UCContainer.Controls.Add(ucAudit); }
// Entry point for the audit - manages the various configurations surrounding the audit public Audit(Form1 _form1, UC_Progress _ucProgress, string _auditLocation, string _exportLocation, string numLevelsDeep, bool _auditEventLogs, bool _showSystemAccounts) { this.form1 = _form1; this.ucProgress = _ucProgress; this.auditLocation = _auditLocation; this.exportLocation = _exportLocation; this.auditEventLogs = _auditEventLogs; this.showSystemAccounts = _showSystemAccounts; this.ucAudit = _form1.ucAudit; // Access ucAudit instance from form1 field // Check how many levels deep the application needs to scan and audit calculateHowManyLevelsDeepToScan(numLevelsDeep); // Configure logging log = new Logs(); log.generateFileName(exportLocation, "permissions", "csv"); // Background worker for scanning and reporting bgWorker_Audit = new BackgroundWorker(); bgWorker_Audit.WorkerReportsProgress = true; bgWorker_Audit.DoWork += new DoWorkEventHandler(bgWorker_Scan_DoWork); bgWorker_Audit.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_Scan_RunWorkerCompleted); bgWorker_Audit.WorkerReportsProgress = true; bgWorker_Audit.RunWorkerAsync(); }