// NOTE: at the moment both details and download share the same webbrowser. private bool ShowDetailsOrDownload(int galleryId, Action <Metadata> action) { DetailsModel.AddSearch(galleryId); string cachedMetadataFilePath; if (PathFormatter.IsEnabled) { cachedMetadataFilePath = PathFormatter.GetMetadata(galleryId); } else { cachedMetadataFilePath = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}", PathFormatter.GetCacheDirectory(), galleryId, ".json"); } Metadata metadata = SearchResultCache.Find(galleryId) ?? JsonUtility.LoadFromFile <Metadata>(cachedMetadataFilePath); if (metadata == null) { // let it download in the background, DetailsBrowserView will respond to its completion event. GalleryDownloader.Download(galleryId); return(false); } if (metadata == null) { MessageBox.Show("can't find metadata"); return(false); } if (action != null) { action.Invoke(metadata); } return(true); }