> I have, the following question:
>
[quoted text clipped - 10 lines]
> ProgressBar object as parameter( I mean without using
> ClearDatabase(progressBar1); - it doesn't seem to be a good way)
You'll need to provide *something*. If you want to decouple
DatabaseOperations from the UI (which is reasonable) you could give
DatabaseOperations a DatabasedClearProgress event which the UI could
subscribe to, and which ClearDatabase could raise.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
mamin@o2.pl - 30 Nov 2006 08:48 GMT
> You'll need to provide *something*. If you want to decouple
> DatabaseOperations from the UI (which is reasonable) you could give
> DatabaseOperations a DatabasedClearProgress event which the UI could
> subscribe to, and which ClearDatabase could raise.
But how can I raise ProgressBar event from this static method?
Jon Skeet [C# MVP] - 30 Nov 2006 18:47 GMT
> > You'll need to provide *something*. If you want to decouple
> > DatabaseOperations from the UI (which is reasonable) you could give
> > DatabaseOperations a DatabasedClearProgress event which the UI could
> > subscribe to, and which ClearDatabase could raise.
>
> But how can I raise ProgressBar event from this static method?
You'd make the DatabaseClearProgress event static as well. It wouldn't
be a ProgressBar event - it would just be that the handler the UI added
would happen to update the progress bar.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
> I have, the following question:
>
[quoted text clipped - 10 lines]
> ProgressBar object as parameter( I mean without using
> ClearDatabase(progressBar1); - it doesn't seem to be a good way)
I think the issue is that ClearDatabase() should probably NOT be static. You
could create a database "engine" and then have an event on it to indicate
status, completion, what have you. Then subscribe to them from your UI and
have the event handler post to the progress bar.

Signature
Thomas T. Veldhouse
Key Fingerprint: D281 77A5 63EE 82C5 5E68 00E4 7868 0ADC 4EFB 39F0
Jon Skeet [C# MVP] - 30 Nov 2006 20:35 GMT
> I think the issue is that ClearDatabase() should probably NOT be static. You
> could create a database "engine" and then have an event on it to indicate
> status, completion, what have you. Then subscribe to them from your UI and
> have the event handler post to the progress bar.
While I agree that it would be good to have a database engine instance,
there's nothing to stop the OP from having a static event.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too