private void ShowImage(MediaItem item)
{
Task.Factory.StartNew(() =>
{
try
{
object image = Viewer.LoadImage(item);
PlatformService.InvokeOnUiThread(() =>
{
var message = Viewer.DisplayImage(image);
logger.Info("image {0}; {1}", item.Identifier, message);
});
}
catch (Exception e)
{
logger.Error("Error loading image '{0}': {1}", item.Identifier, e);
}
})
.ContinueWith((a) =>
{
try
{
var message = string.Format(" {0} ", Path.GetFileName(item.ParentDirectoryName));
var location = item.GetLocation();
if (location != null)
{
var placeName = location.PlaceName(Location.PlaceNameFilter.Standard);
message = string.Format("{0} {1}", message, placeName);
}
PlatformService.InvokeOnUiThread(() => Viewer.DisplayInfo(message));
}
catch (Exception ex)
{
logger.Error("Error loading info for {0}: {1}", item.Identifier, ex);
}
});
}