Fixing issue with variable capture

This commit is contained in:
Lars Brubaker 2023-09-28 18:11:34 -07:00
parent 32f338fa2f
commit 35db9e6867
5 changed files with 7 additions and 45 deletions

View file

@ -178,7 +178,7 @@ namespace MatterHackers.MatterControl
CacheFilename(libraryItem, width, height));
}
internal void QueueForGeneration(Func<Task> func)
public void QueueForGeneration(Func<Task> func)
{
lock (ThumbsLock)
{

View file

@ -1,40 +0,0 @@
/*
Copyright (c) 2017, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
namespace MatterHackers.MatterControl.Library
{
public class SceneReplacementFileItem : FileSystemFileItem
{
public SceneReplacementFileItem(string filePath)
: base(filePath)
{
}
}
}

View file

@ -207,11 +207,13 @@ namespace MatterHackers.MatterControl.Library
&& ApplicationSettings.ValidFileExtensions.Contains(fileExtensionLower);
}
public async Task LoadItemThumbnail(Action<ImageBuffer> thumbnailListener, Action<MeshContentProvider> buildThumbnail, ILibraryItem libraryItem, ILibraryContainer libraryContainer, int thumbWidth, int thumbHeight, ThemeConfig theme)
public async Task LoadItemThumbnail(Action<ImageBuffer> thumbnailListenerIn, Action<MeshContentProvider> buildThumbnail, ILibraryItem libraryItem, ILibraryContainer libraryContainer, int thumbWidth, int thumbHeight, ThemeConfig theme)
{
async void setItemThumbnail(ImageBuffer icon)
{
if (icon != null)
var thumbnailListener = thumbnailListenerIn;
if (icon != null)
{
if (icon.Width == 0)
{

View file

@ -1233,7 +1233,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if ((firstItem is ILibraryAssetStream contentStream
&& contentStream.ContentType == "gcode")
|| firstItem is SceneReplacementFileItem)
|| firstItem is FileSystemFileItem)
{
DragDropObject = null;
this.SceneReplacement = firstItem as ILibraryAssetStream;

View file

@ -610,7 +610,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
int maxItemWidth = 0;
var recentFiles = new DirectoryInfo(ApplicationDataStorage.Instance.PlatingDirectory).GetFiles("*.mcx").OrderByDescending(f => f.LastWriteTime);
foreach (var item in recentFiles.Where(f => f.Length > 215).Select(f => new SceneReplacementFileItem(f.FullName)).Take(12))
foreach (var item in recentFiles.Where(f => f.Length > 215).Select(f => new FileSystemFileItem(f.FullName)).Take(12))
{
var imageBuffer = new ImageBuffer(thumbWidth, thumbWidth);