I have a WPF/MVVM app, which consists of one window with a few buttons.
Each of the buttons triggers a call to an external device (an USB missile launcher), which takes
Ok the CanExecute method will not work because the click will immediately put you into your long-running task.
So here's how I would do it:
Make your view model implement INotifyPropertyChanged
Add a property called something like:
public bool IsBusy
{
get
{
return this.isBusy;
}
set
{
this.isBusy = value;
RaisePropertyChanged("IsBusy");
}
}
Bind your buttons to this property in this manner:
In your ShowMessage/CallExternal device methods add the line
IsBusy = true;
Should do the trick