C#, VS2005, THREADS
Ok.
I have to ways to achieve (almost) the same thing.
What do i want to do? Control the progress of an operation in a different project of my application.
Explanation:
I have a winApp form. From there, using a static method from a Class Library project (in the same solution), I return a ReportDataSourc e object.
The problem starts when i don't know what's the progress of my request. Some reports might take up to 3 minutes, others 10 seconds... so, i would like to know how can keep track of this. Ok, i can create an event and a delegate and subscribe it in my winForm. But i would like also to be able to stop the request if I want, then i guess i would need to launch this process in a different thread.
When I click on the Run Report button, i want to start a progress bar, it might be simulated (like waiting for the process to finish, or, it would be better if i could actually see the REAL progress). Then it came up to my mind that i could actually create an instance of the ReportDataSourc e object in my WinApp, then pass it to the method that populates it as a parameter. Then in the meantime, i guess i could "read" the total of records that in the meantine is being put in the instance of the ReportDataSourc e object. Right?
Well, i know it sounds confusing. From what i can see, i guess i'll have to have both implementation. The event and the thread... now it comes another problem. This static method we are talking about, which is in a static class, we are invoking it using reflection, since we use as a generic report provider. in other words, we pass as a parameter the name of a class who is the responsible for retrieving data from the database and send it back in a ReportDataSourc e object. Does it makes sense?
Well i put all the pieces on the table. Any help to fix this puzzle would be appreciate it. I'll be working on this. I'll keep you posted.
Ok.
I have to ways to achieve (almost) the same thing.
What do i want to do? Control the progress of an operation in a different project of my application.
Explanation:
I have a winApp form. From there, using a static method from a Class Library project (in the same solution), I return a ReportDataSourc e object.
The problem starts when i don't know what's the progress of my request. Some reports might take up to 3 minutes, others 10 seconds... so, i would like to know how can keep track of this. Ok, i can create an event and a delegate and subscribe it in my winForm. But i would like also to be able to stop the request if I want, then i guess i would need to launch this process in a different thread.
When I click on the Run Report button, i want to start a progress bar, it might be simulated (like waiting for the process to finish, or, it would be better if i could actually see the REAL progress). Then it came up to my mind that i could actually create an instance of the ReportDataSourc e object in my WinApp, then pass it to the method that populates it as a parameter. Then in the meantime, i guess i could "read" the total of records that in the meantine is being put in the instance of the ReportDataSourc e object. Right?
Well, i know it sounds confusing. From what i can see, i guess i'll have to have both implementation. The event and the thread... now it comes another problem. This static method we are talking about, which is in a static class, we are invoking it using reflection, since we use as a generic report provider. in other words, we pass as a parameter the name of a class who is the responsible for retrieving data from the database and send it back in a ReportDataSourc e object. Does it makes sense?
Well i put all the pieces on the table. Any help to fix this puzzle would be appreciate it. I'll be working on this. I'll keep you posted.