Why is the UI blocked when I load data from the server using an async
request as follows:
public ObservableCollection<VideoFile> VideoFiles { get; private set; } = new ObservableCollection<VideoFile>();
private void LoadVideoFiles(string categoryId = "*", int page = 1)
{
_videoFiles = NotifyTask.Create(_videoManager.GetVideoFilesAsync(_videoFileSearchParam));
_videoFiles.PropertyChanged -= VideoFilesPropertyChanged;
_videoFiles.PropertyChanged += VideoFilesPropertyChanged;
}
private void VideoFilesPropertyChanged(object sender, PropertyChangedEventArgs propertyName)
{
foreach (var videoFile in ((NotifyTask<List<VideoFile>>)sender).Result)
{
VideoFiles.Add(videoFile);
}
}