private async Task SetThumbnailImageAsync(OTPictureBox picbox, ThumbnailInfo thumbInfo, CancellationToken cancelToken) { try { picbox.ShowInitialImage(); picbox.MouseDown += this.pictureBox_MouseDown; picbox.MouseUp += this.pictureBox_MouseUp; picbox.Image = await thumbInfo.LoadThumbnailImageAsync(cancelToken); cancelToken.ThrowIfCancellationRequested(); picbox.MouseMove += this.pictureBox_MouseMove; if (this.ThumbnailLoadCompleted != null) this.ThumbnailLoadCompleted(picbox, EventArgs.Empty); } catch (Exception) { picbox.ShowErrorImage(); try { throw; } catch (HttpRequestException) { } catch (InvalidImageException) { } catch (TaskCanceledException) { } catch (WebException) { } } }
private async Task SetThumbnailImageAsync(OTPictureBox picbox, ThumbnailInfo thumbInfo, CancellationToken cancelToken) { try { picbox.ShowInitialImage(); picbox.Image = await thumbInfo.LoadThumbnailImageAsync(cancelToken); } catch (Exception) { picbox.ShowErrorImage(); try { throw; } catch (HttpRequestException) { } catch (InvalidImageException) { } catch (TaskCanceledException) { } } }