This question is kind of related to what I had asked (I've pasted the link below). But there is more to it, so asking altogether a new question.
I've 3 classes that I am working on. Class1, Class2, Class3. Class2 and Class3 are in the same package which is referred by Class1's package.
Class1 is responsible for displaying a progress bar related to the upload of files carried out by Class2 and Class3. Class2 receives a request from Class1 about the list of files/folders to be uploaded which it forwards to Class3.
I've the main UI thread taking care of the ListView with files and folders. After I pass the request from Class1 to Class2, Class2 creates a delegate and invokes a worker thread which carries out all the upload of the files/folders in Class3.
After all, here is my question. Now I need to somehow convey from Class3 all the way to Class1 when each chunk of file is uploaded so that could reflect in the ProgressBar.
What I was planning to do is make the delegate for the UploadProgress(string, long)(this function is responsible for updating the progress bar) in the ProgressBar and pass this delegate along with the list of files/folders to Class2 and then to the Class3. After each chunk is uploaded the Class3 will invoke a new worker thread and inform the Class1's UploadProgress(string, long) that chunk with this size is uploaded.
What I am planning to do is the right way?? I had asked in the question (I have pasted the link above) that how can I pass the delegate from one class to another which are in different packages. If this is not the right way to achieve, how can I get there. I've done quite a bit of research on this and would appreciate any ideas/suggestions/advice.
I hope I am clear in what I am trying to know. If anything is unclear please post back a question. (really sorry for such a long question but wanted to be very clear).
Thanks in advance..