/// <summary> /// Refreshes the thumbnails of the given assets. /// </summary> /// <param name="assets">The assets for which to refresh thumbnails.</param> /// <param name="firstPriority">If <c>true</c>, the given assets will be put in the front of the thumbnail processing queue.</param> private void RefreshThumbnails(IEnumerable <AssetViewModel> assets, bool firstPriority) { if (thumbnailService != null) { var assetItems = new HashSet <AssetItem>(assets.Select(x => x.AssetItem)); // We run this as a task to prevent dead lock Task.Run(() => thumbnailService.AddThumbnailAssetItems(assetItems, firstPriority ? QueuePosition.First : QueuePosition.Last)); } }
public void Run() { tcs = new TaskCompletionSource <int>(); var allAssets = projectSession.Packages.SelectMany(x => x.Assets).ToList(); assetCount = allAssets.Count; thumbnailService.AddThumbnailAssetItems(allAssets, QueuePosition.First); tcs.Task.Wait(); }