private void GetSourceCompleted(ImageSource imgSrc, bool useTransitions, int id)
{
if (id == this.requestID)
{
if (imgSrc == null || ViewBounds.IsEmpty)
{
base.Container.Children.Clear();
this.OnProgress(100);
}
else
{
Image img = new Image
{
IsHitTestVisible = false,
Opacity = 1.0,
DataContext = useTransitions,
};
img.SetValue(Image.StretchProperty, Stretch.Fill);//模糊吗?
LayerContainer.SetBounds(img, ViewBounds);
img.ImageFailed += new EventHandler<ExceptionRoutedEventArgs>(this.Img_ImageFailed);
bool flag = (imgSrc is BitmapImage) && ((imgSrc as BitmapImage).UriSource != null) && !string.IsNullOrEmpty((imgSrc as BitmapImage).UriSource.OriginalString);
if (flag)
{
EventHandler<DownloadProgressEventArgs> onProgressEventHandler = null;
onProgressEventHandler = delegate(object sender, DownloadProgressEventArgs e)
{
this.bitmap_DownloadProgress(sender, e, img, onProgressEventHandler, id);
};
(imgSrc as BitmapImage).DownloadProgress += onProgressEventHandler;
}
img.Source = imgSrc;
base.Container.Children.Add(img);
if (!flag)
{
this.ShowImage(img);
this.OnProgress(100);
}
}
}
}