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:
parent
8778a2dd33
commit
60ad94be68
9 changed files with 92 additions and 27 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue