Async PrintItemWrapper

This commit is contained in:
John Lewin 2015-07-13 13:07:26 -07:00
parent 3a797d2544
commit 908b604328
10 changed files with 108 additions and 94 deletions

View file

@ -39,6 +39,7 @@ using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace MatterHackers.MatterControl.PrintLibrary.Provider
{
@ -171,11 +172,18 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
return new PrintItemCollection(Path.GetFileNameWithoutExtension(directoryName), Path.Combine(rootPath, directoryName));
}
public override PrintItemWrapper GetPrintItemWrapper(int itemIndex)
public override string GetPrintItemName(int itemIndex)
{
return Path.GetFileName(currentDirectoryFiles[itemIndex]);
}
public async override Task<PrintItemWrapper> GetPrintItemWrapperAsync(int itemIndex)
{
string fileName = currentDirectoryFiles[itemIndex];
List<ProviderLocatorNode> providerLocator = GetProviderLocator();
string providerLocatorJson = JsonConvert.SerializeObject(providerLocator);
return new PrintItemWrapper(new DataStorage.PrintItem(Path.GetFileNameWithoutExtension(fileName), fileName, providerLocatorJson));
}