In a WPF / MVVM application, I am trying to find a code-efficient way to set the main view cursor to Cursors.Wait
prior to any lengthy operation and to restore it to the default cursor after completion.
Since all operations are invoked using routed commands, I'd like to find a way of intercepting command execution, ideally by creating a generic command class that wraps an instance of a built-in routed command, but I can't visualize how to do this.
Specifically, the RoutedCommand.Execute
method is not virtual so I need another mechanism to intercept its calls. Also, I am not sure how an instance of the generic command class would reference the view for which it has to set the cursor.
Any advice please?