private void SetImageCell(AlbumViewCell cell, MediaItem item, int row) { DispatchQueue.DefaultGlobalQueue.DispatchAsync(() => { using (var image = UIImage.FromFile(item.Path)) { var scaledImage = image.ScaleImage(_cellSize); DispatchQueue.MainQueue.DispatchAsync(() => { if (cell.Tag == row) { cell.Image = scaledImage; } }); } }); }
private void SetVideoCell(AlbumViewCell cell, MediaItem item, int row) { DispatchQueue.DefaultGlobalQueue.DispatchAsync(() => { using (var asset = AVAsset.FromUrl(new NSUrl(item.Path))) using (var generator = AVAssetImageGenerator.FromAsset(asset)) { generator.AppliesPreferredTrackTransform = true; var duration = asset.Duration.Seconds; var scaledImage = GetVideoThumbnail(generator, duration, _cellSize); DispatchQueue.MainQueue.DispatchAsync(() => { if (cell.Tag != row) { return; } cell.Duration = duration; cell.Image = scaledImage; }); } }); }
private static void SetImageCellImage(AlbumViewCell cell, UIImage image) { cell.Image = image; cell.Tag = 0; }