Perform FileSystemFileItem edits and update thumbnails
- Move common FileSystemFileItem edit into base WritableContainer - Issue MatterHackers/MCCentral#2251 Thumbnails not updated after edits
This commit is contained in:
parent
bfd6fb54d3
commit
6df0dba376
5 changed files with 17 additions and 17 deletions
|
|
@ -351,6 +351,12 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
internal void Save()
|
||||
{
|
||||
var thumbnailPath = ApplicationController.Instance.ThumbnailCachePath(this.SourceItem);
|
||||
if (File.Exists(thumbnailPath))
|
||||
{
|
||||
File.Delete(thumbnailPath);
|
||||
}
|
||||
|
||||
// Call save on the provider
|
||||
this.LibraryContainer.Save(this.SourceItem, this.Content);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ using System.Threading.Tasks;
|
|||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MeshVisualizer;
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
|
|
@ -330,17 +328,6 @@ namespace MatterHackers.MatterControl.Library
|
|||
}
|
||||
}
|
||||
|
||||
public override void Save(ILibraryItem item, IObject3D content)
|
||||
{
|
||||
if (item is FileSystemFileItem fileItem)
|
||||
{
|
||||
if (content is InteractiveScene scene)
|
||||
{
|
||||
scene.Save(fileItem.Path, ApplicationDataStorage.Instance.ApplicationLibraryDataPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DirectoryContainerLink : FileSystemItem, ILibraryContainerLink
|
||||
{
|
||||
public DirectoryContainerLink(string path)
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ using MatterHackers.Agg.Image;
|
|||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrintHistory;
|
||||
using MatterHackers.MatterControl.Library;
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
|
|
@ -99,6 +97,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
{
|
||||
// Serialize the scene to disk using a modified Json.net pipeline with custom ContractResolvers and JsonConverters
|
||||
File.WriteAllText(fileItem.Path, content.ToJson());
|
||||
this.ItemContentChanged?.Invoke(this, new ItemChangedEventArgs(fileItem));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.DataConverters3D;
|
||||
|
||||
|
|
@ -40,7 +41,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public virtual void OnItemContentChanged(ItemChangedEventArgs args)
|
||||
{
|
||||
ItemContentChanged?.Invoke(this, args);
|
||||
this.ItemContentChanged?.Invoke(this, args);
|
||||
}
|
||||
|
||||
public virtual void Add(IEnumerable<ILibraryItem> items)
|
||||
|
|
@ -57,6 +58,13 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public virtual void Save(ILibraryItem item, IObject3D content)
|
||||
{
|
||||
if (item is FileSystemFileItem fileItem)
|
||||
{
|
||||
// Serialize the scene to disk using a modified Json.net pipeline with custom ContractResolvers and JsonConverters
|
||||
File.WriteAllText(fileItem.Path, content.ToJson());
|
||||
|
||||
this.OnItemContentChanged(new ItemChangedEventArgs(fileItem));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Move(IEnumerable<ILibraryItem> items, ILibraryContainer targetContainer)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 157ae3944409f34e7381ef0c72d8022a34914111
|
||||
Subproject commit 80de803ed4923a7c6aae1bc121f6ad3b72687060
|
||||
Loading…
Add table
Add a link
Reference in a new issue