IPleaseWaitService process completed delgate?

Apr 7, 2012 at 8:36 PM

Hi,

I am using Catel for my MVVM program.

I want to run a long process and saw the IPleaseWaitService that Catel has.

I am used to using a BackgroundWorker that has also a delegate for when the process has ended.

Is there such a mechanism in Catel? If not, is there some alternative within Catel or should I implement something of my own?

Thanks,

Tomer

Coordinator
Apr 8, 2012 at 8:57 AM

Yes, you have 2 options:

1) Use the show and hide (when the process starts, call Show, when the process ends, call Hide)

2) Use the Push and Pop (very usefull when you launch multiple threads and the please wait should only hide when the last one is finished).

Then you can still use the background worker. Or, if you are using WPF, you can also use the override that accepts an Action instance.

var pleaseWaitService = GetService<IPleaseWaitService>();
pleaseWaitService.Show(() => ExecuteYourMethodHere());

For more info, see this documentation.