Made the LibraryProvider implement iDisposable and we try to dispose them when appropriate.

Made dispose of a collection warn if there are child items or collections.
Made the bread cumbs a clickable navigation rather than just names.
This commit is contained in:
Lars Brubaker 2015-07-02 18:34:10 -07:00
parent 8778a2dd33
commit 60ad94be68
9 changed files with 92 additions and 27 deletions

View file

@ -108,8 +108,22 @@ namespace MatterHackers.MatterControl.PrintLibrary
set
{
currentLibraryProvider = value;
ChangedCurrentLibraryProvider.CallEvents(null, null);
if (currentLibraryProvider != value)
{
bool isChildOfCurrent = value.ParentLibraryProvider == currentLibraryProvider;
// Dispose of all children below this one.
while (!isChildOfCurrent && currentLibraryProvider != value)
{
LibraryProvider parent = currentLibraryProvider.ParentLibraryProvider;
currentLibraryProvider.Dispose();
currentLibraryProvider = parent;
}
currentLibraryProvider = value;
ChangedCurrentLibraryProvider.CallEvents(null, null);
}
}
}