Made a utility function to get the List of PrividerLocatorNodes

Made Text Creator only save to the queue
This commit is contained in:
Lars Brubaker 2015-06-23 15:23:28 -07:00
parent 7d2a7f5bd4
commit e27a3ec16c
4 changed files with 15 additions and 19 deletions

View file

@ -27,6 +27,8 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.MatterControl.PrintLibrary.Provider;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -221,6 +223,16 @@ namespace MatterHackers.MatterControl.DataStorage
DateAdded = DateTime.Now;
PrintCount = 0;
}
public List<ProviderLocatorNode> GetLibraryProviderLocator()
{
List<ProviderLocatorNode> providerPath = null;
if (LibraryProviderLocatorJson != null)
{
providerPath = JsonConvert.DeserializeObject<List<ProviderLocatorNode>>(LibraryProviderLocatorJson);
}
return providerPath;
}
}
public class SliceSettingsCollection : Entity

View file

@ -270,16 +270,6 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
libraryProviders[libraryProviderToUseIndex].RemoveItem(printItemWrapper);
}
private static List<ProviderLocatorNode> GetProviderPathFromPrintItem(PrintItemWrapper printItemWrapper)
{
List<ProviderLocatorNode> providerPath = null;
if (printItemWrapper.PrintItem.LibraryProviderLocatorJson != null)
{
providerPath = JsonConvert.DeserializeObject<List<ProviderLocatorNode>>(printItemWrapper.PrintItem.LibraryProviderLocatorJson);
}
return providerPath;
}
public override void SaveToLibrary(PrintItemWrapper printItemWrapper, List<MeshGroup> meshGroupsToSave, List<ProviderLocatorNode> providerSavePath = null)
{
if (selectedLibraryProvider == -1)
@ -341,7 +331,7 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
private int GetProviderIndex(PrintItemWrapper printItemWrapper, out List<ProviderLocatorNode> subProviderSavePath)
{
List<ProviderLocatorNode> providerPath = GetProviderPathFromPrintItem(printItemWrapper);
List<ProviderLocatorNode> providerPath = printItemWrapper.PrintItem.GetLibraryProviderLocator();
return GetProviderIndex(providerPath, out subProviderSavePath);
}

@ -1 +1 @@
Subproject commit 65277f9413eacbb2cf75da8fda7f2d155d02615f
Subproject commit 9cfe76ee4e58b408d6c297ebf59ea36c879e2cb3

View file

@ -926,21 +926,15 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
if (filePath != null)
{
PrintItem printItem = new PrintItem();
printItem.Commit();
printItem.Name = string.Format("{0}", word);
printItem.FileLocation = Path.GetFullPath(filePath);
printItem.PrintItemCollectionID = LibrarySQLiteData.Instance.LibraryCollection.Id;
printItem.Commit();
PrintItemWrapper printItemWrapper = new PrintItemWrapper(printItem);
LibrarySQLiteData.Instance.AddItem(printItemWrapper);
// and save to the queue
{
QueueData.Instance.AddItem(printItemWrapper);
}
QueueData.Instance.AddItem(printItemWrapper);
}
//Exit after save