views:

135

answers:

2

We have a service that runs methods used for data import/export at specified intervals. To test these methods we have a little application with a single button that, when clicked, instantiates the import/export class and invokes the desired method. Nothing fancy. I would like create a more robust test application that can receive debug information from the method in more of a real-time fashion than the return value from the service method. These methods can take anywhere from a few minutes to 30 to run a full import/export load, and I would like some indication of the amount of data that's already been processed.

My initial idea was to wrap the classes in some type of message queuing class which the test application could then read from and display the messages. However I'm still kind of a n00b at this, so I don't know if there's a better way to do what I want to do.

We develop in VB on .NET 2.0

+2  A: 

You could modify your service methods to raise events that report on status during the processing then simply handle the events in your code to update the status, that would be the fastest method.

Your production code could simply not do anything with the events

Mitchel Sellers
+1  A: 

Perhaps you can use a BackgroundWorker object to update your application with the Debug information from your service. The nice thing about BackgroundWorker is that it runs the code on a separate thread which leaves your form available for updates.

Using the BackgroundWorker will allow you to update your application with debug information from the service allowing you to see more information while the process is running. Start the process in the 'DoWork' method and when there is debug information to be displayed, invoke the 'ProgressChanged' method. In the 'ProgressChanged' method, you can update your form with the debug information.

Let me know if this helps! JFV

JFV
+1 You're comment was extremely helpful as well as Mitchel's, however his answer was more along the lines of what I was asking for. You should be pleased to know, that I did implement a BackgroundWorker as well as the events.
Wes P