Always the same problem with this kind of functionality... You set a UI property from another thread - so just marshal the call to the correct one (the UI thread). I use a
Dispatcher dispatcherUIThread
Variable in my ViewModels that I fill (on app initialization) with the current Application Dispatcher (
App.Current.Dispatcher
So your problematic line should be changed to something like this
dispatcherUIThread.Invoke(() => vm.ColorSecurity = Brushes.Green);
I try to design my background work as independend as possible from the UI so I don't use e.g.
sometextbox.Text
inside async methods, but use variables for input, and only marshal final output, error information or progress back to the UI thread. (Keep in mind that BackgroundWoker does some Auto marshalling by calling Completed on the starting thread - you could do the same with your RaiseExecuteChanged...