private async void LoadImages(string imagePath)
{
try
{
Log.Info("Images load");
await
_imageProvider.LoadImagesAsync(Path.GetDirectoryName(imagePath),
new Progress<string>(image => _thumbnailCollection.Add(
new Thumbnail {ImageUri = image, FileName = Path.GetFileName(image)})));
ThumbnailsHeader = String.Format("Gallery in {0}, {1} images", Path.GetDirectoryName(imagePath), _thumbnailCollection.Count);
Thumbnail selectedThumbnail =
_thumbnailCollection.First(thumbnail => thumbnail.ImageUri == imagePath);
Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background,
new Action(() =>
{
ThumbnailCollection.View.MoveCurrentTo(selectedThumbnail);
}));
}
catch (Exception e)
{
Log.Error("Exception during images load", e);
}
}