Add Save method to ILibraryWritableContainer

This commit is contained in:
John Lewin 2017-11-14 13:47:33 -08:00
parent 1c5f0c0a0a
commit 2aba5f185d
3 changed files with 22 additions and 0 deletions

View file

@ -31,6 +31,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MatterHackers.Agg.Image;
using MatterHackers.DataConverters3D;
namespace MatterHackers.MatterControl.Library
{
@ -67,6 +68,8 @@ namespace MatterHackers.MatterControl.Library
void Rename(ILibraryItem item, string revisedName);
void Move(IEnumerable<ILibraryItem> items, ILibraryContainer targetContainer);
void Save(ILibraryItem item, IObject3D content);
void SetThumbnail(ILibraryItem item, int width, int height, ImageBuffer imageBuffer);
bool AllowAction(ContainerActions containerActions);
}

View file

@ -36,6 +36,9 @@ using System.Text.RegularExpressions;
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
{
@ -327,6 +330,17 @@ 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)

View file

@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project.
using System;
using System.Collections.Generic;
using MatterHackers.Agg.Image;
using MatterHackers.DataConverters3D;
namespace MatterHackers.MatterControl.Library
{
@ -54,6 +55,10 @@ namespace MatterHackers.MatterControl.Library
{
}
public virtual void Save(ILibraryItem item, IObject3D content)
{
}
public virtual void Move(IEnumerable<ILibraryItem> items, ILibraryContainer targetContainer)
{
}