Ich habe Befehl wie folgt aus:Multi Threading mit ObservesProperty
CancelCommand = new DelegateCommand(Cancel,() => IsProcessing).ObservesProperty(() => IsProcessing);
Und in anderen Verfahren nenne ich
Task.Factory.StartNew(() =>
{
IsProcessing = true; // Stop here
IsProcessing = false;
});
Irgendwie die Ausführung stoppt, wenn IsProcessing
Satz true
. Aber wenn ich zu
Application.Current.Dispatcher.Invoke(() => IsProcessing = true);
IsProcessing = false; // Hit this line then stop again
int i = 0; // Never reach here
ändern Sieht aus wie ObservesProperty
Problem verursacht, wenn IsProcessing
Satz in nicht UI-Thread. Ist es ein Fehler oder funktioniert es wie geplant?