Fixing library tests

Making subtract object name better
Removing broadcast
This commit is contained in:
Lars Brubaker 2022-01-27 11:01:49 -08:00
parent d2b6d0c4ae
commit 5e898a0650
15 changed files with 182 additions and 98 deletions

View file

@ -145,7 +145,7 @@ namespace MatterHackers.MatterControl.Library
var nonZipFiles = allFiles.Except(zipFiles);
IEnumerable<ILibraryContainerLink> childContainers = childCollections.Select(c => new SqliteLibraryContainerLink()
IEnumerable<ILibraryContainerLink> childContainers = childCollections.Select(c => new SqliteLibraryContainerLink(this)
{
CollectionID = c.Id,
Name = c.Name
@ -159,7 +159,7 @@ namespace MatterHackers.MatterControl.Library
{
if (File.Exists(printItem.FileLocation))
{
return new SqliteFileItem(printItem);
return new SqliteFileItem(printItem, this);
}
else
{
@ -242,6 +242,13 @@ namespace MatterHackers.MatterControl.Library
public class SqliteLibraryContainerLink : ILibraryContainerLink
{
private SqliteLibraryContainer sqliteLibraryContainer;
public SqliteLibraryContainerLink(SqliteLibraryContainer sqliteLibraryContainer)
{
this.sqliteLibraryContainer = sqliteLibraryContainer;
}
public int CollectionID { get; set; }
public DateTime DateCreated { get; } = DateTime.Now;
@ -284,10 +291,9 @@ namespace MatterHackers.MatterControl.Library
container.Commit();
}
ApplicationController.Instance.MainView.Broadcast("ILibraryItem Name Changed", new LibraryItemNameChangedEvent(this.ID));
NameChanged?.Invoke(this, EventArgs.Empty);
sqliteLibraryContainer.ReloadContent();
}
NameChanged?.Invoke(this, EventArgs.Empty);
}
}
}