In my ViewModel, I have this code:
Logs = new ObservableCollection<Log>();
Logs = Task.Factory.StartNew(() => mainModel.GetLogs()).Result;
wtih Log is a very simple class with several public properties.
According to my understanding of the Task class, the mainModel GetLogs () function, called in this way, should be run in a separate thread, and while it is retrieving records from the database, my user interface should respond, however this is not what happens, but instead of this record retrieved from the data store, my user interface is blocked.
I was hoping someone could explain why ... TIA.
EDIT: my underestimation of the Task class was incomplete, using the ContinueWith method of the Task class ensured that async was executed, as described below in member responses ...
source
share