I’ve got several nested classes, with the following structure:
BackupLocation contains list of BackupClients
BackupClients contains a list of BackupVersions
BackupVersions contains a list of BackupFiles
In my UI – Im populating a combo box with BackupLocations – and have several listboxes for the clients, versions, and files.
When processing the BackupLocations – I can update my status bar easily because thats the top level class that the UI creates. But how can I update the status bar and progress bar on each file being processed? Since the BackupFiles are 3 levels deep, I cant see any way to update the UI. The actual processing of the files are within the BackupVersion class – which loads its files.
I think it probably has something to do with events and delegates – but am unsure exactly how to proceed with this, any help would be appreciated.
I would use events and bubble them up through the classes.
Basically:
In a very simplistic example of code, see the below (no null checking etc. just the general concept):