diff --git a/Library/ContentProviders/MeshContentProvider.cs b/Library/ContentProviders/MeshContentProvider.cs index bd2be7474..1e294ab9b 100644 --- a/Library/ContentProviders/MeshContentProvider.cs +++ b/Library/ContentProviders/MeshContentProvider.cs @@ -126,8 +126,9 @@ namespace MatterHackers.MatterControl { IObject3D object3D = null; - var contentModel = item as ILibraryContentStream; - if (contentModel != null + if (item is ILibraryContentStream contentModel + // Only load the stream if it's available - prevents download of internet content simply for thumbnails + && contentModel.LocalContentExists && contentModel.FileSize < MaxFileSizeForTracing) { // TODO: Wire up limits for thumbnail generation. If content is too big, return null allowing the thumbnail to fall back to content default diff --git a/Library/Interfaces/ILibraryItem.cs b/Library/Interfaces/ILibraryItem.cs index 421d5e2d5..92a3f0b55 100644 --- a/Library/Interfaces/ILibraryItem.cs +++ b/Library/Interfaces/ILibraryItem.cs @@ -58,6 +58,8 @@ namespace MatterHackers.MatterControl.Library string ContentType { get; } string FileName { get; } string AssetPath { get; } + bool LocalContentExists { get; } + Task GetContentStream(Action progress); } } diff --git a/Library/Providers/FileSystem/FileSystemItem.cs b/Library/Providers/FileSystem/FileSystemItem.cs index 051fef3dc..b546c631c 100644 --- a/Library/Providers/FileSystem/FileSystemItem.cs +++ b/Library/Providers/FileSystem/FileSystemItem.cs @@ -43,7 +43,8 @@ namespace MatterHackers.MatterControl.Library public string ThumbnailKey { get; set; } = ""; public virtual bool IsProtected => false; public virtual bool IsVisible => true; - + public virtual bool LocalContentExists => true; + public FileSystemItem(string path) { this.Path = path; diff --git a/Library/Providers/MatterControl/CalibrationPartsContainer.cs b/Library/Providers/MatterControl/CalibrationPartsContainer.cs index 5deed6619..2e86b412f 100644 --- a/Library/Providers/MatterControl/CalibrationPartsContainer.cs +++ b/Library/Providers/MatterControl/CalibrationPartsContainer.cs @@ -79,7 +79,7 @@ namespace MatterHackers.MatterControl.Library return new FileSystemFileItem(AggContext.StaticData.MapPath(s)); }).ToList(); - UiThread.RunOnIdle(this.OnReloaded); + UiThread.RunOnIdle(this.OnReloaded); }); } diff --git a/Library/Providers/MatterControl/HistoryContainer.cs b/Library/Providers/MatterControl/HistoryContainer.cs index eb43c3dae..8e24bf9f7 100644 --- a/Library/Providers/MatterControl/HistoryContainer.cs +++ b/Library/Providers/MatterControl/HistoryContainer.cs @@ -63,6 +63,8 @@ namespace MatterHackers.MatterControl.Library public bool IsVisible => true; + public bool LocalContentExists => true; + public Task GetContentStream(Action reportProgress) { throw new NotImplementedException(); diff --git a/Library/Widgets/ListView/ListViewItemBase.cs b/Library/Widgets/ListView/ListViewItemBase.cs index ec34f1f93..43887938c 100644 --- a/Library/Widgets/ListView/ListViewItemBase.cs +++ b/Library/Widgets/ListView/ListViewItemBase.cs @@ -117,8 +117,7 @@ namespace MatterHackers.MatterControl.CustomWidgets { // Ask content provider - allows type specific thumbnail creation var contentProvider = ApplicationController.Instance.Library.GetContentProvider(itemModel); - if (contentProvider != null - && contentProvider is MeshContentProvider) + if (contentProvider is MeshContentProvider) { // Before we have a thumbnail set to the content specific thumbnail thumbnail = contentProvider.DefaultImage;