Made PrintItemWarppers have a ProviderLocator rather than a Provider

Fixed some null reference bugs
Fixed a bug with copy to library changing the queues file path
Made save as work better.
This commit is contained in:
Lars Brubaker 2015-09-11 14:36:57 -07:00
parent fa97829073
commit a0659dc8bb
10 changed files with 126 additions and 64 deletions

View file

@ -231,7 +231,9 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector
}
// Dispose of all children below this one.
while (currentLibraryProvider != null)
// Dispose of all children below this one.
while (currentLibraryProvider != null
&& currentLibraryProvider.ParentLibraryProvider != null)
{
LibraryProvider parent = currentLibraryProvider.ParentLibraryProvider;
currentLibraryProvider.Dispose();
@ -368,21 +370,24 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector
var provider = this.CurrentLibraryProvider;
if (provider != null && provider.ProviderKey != "ProviderSelectorKey")
if (provider != null)
{
PrintItemCollection parent = new PrintItemCollection("..", provider.ProviderKey);
LibrarySelectorRowItem queueItem = new LibrarySelectorRowItem(parent, -1, this, provider.ParentLibraryProvider, GetThumbnailWidget(provider.ParentLibraryProvider, parent, LibraryProvider.UpFolderImage));
AddListItemToTopToBottom(queueItem);
}
for (int i = 0; i < provider.CollectionCount; i++)
{
PrintItemCollection item = provider.GetCollectionItem(i);
if (item.Key != "LibraryProviderPurchasedKey")
if (provider.ProviderKey != "ProviderSelectorKey")
{
LibrarySelectorRowItem queueItem = new LibrarySelectorRowItem(item, i, this, null, GetThumbnailWidget(null, item, provider.GetCollectionFolderImage(i)));
PrintItemCollection parent = new PrintItemCollection("..", provider.ProviderKey);
LibrarySelectorRowItem queueItem = new LibrarySelectorRowItem(parent, -1, this, provider.ParentLibraryProvider, GetThumbnailWidget(provider.ParentLibraryProvider, parent, LibraryProvider.UpFolderImage));
AddListItemToTopToBottom(queueItem);
}
for (int i = 0; i < provider.CollectionCount; i++)
{
PrintItemCollection item = provider.GetCollectionItem(i);
if (item.Key != "LibraryProviderPurchasedKey")
{
LibrarySelectorRowItem queueItem = new LibrarySelectorRowItem(item, i, this, null, GetThumbnailWidget(null, item, provider.GetCollectionFolderImage(i)));
AddListItemToTopToBottom(queueItem);
}
}
}
}