Revise AddToQueueFromLibraryButtonAddsItemToQueue test

- Restore Add To Queue functionality
- Expose reusable AddAllItems() to PrintQueueCollection
- Revise base implementation of FileSystemItem to support default
  name based on filename unless set
This commit is contained in:
John Lewin 2017-06-03 16:18:09 -07:00
parent ba754dba19
commit add70a2f90
4 changed files with 39 additions and 44 deletions

View file

@ -62,7 +62,10 @@ namespace MatterHackers.MatterControl.Library
return fileName;
}
set { }
set
{
fileName = value;
}
}
}
}

View file

@ -64,6 +64,13 @@ namespace MatterHackers.MatterControl.Library
}
public override async void Add(IEnumerable<ILibraryItem> items)
{
await AddAllItems(items);
this.ReloadContainer();
}
public static async Task AddAllItems(IEnumerable<ILibraryItem> items)
{
await Task.Run(async () =>
{
@ -98,8 +105,6 @@ namespace MatterHackers.MatterControl.Library
0);
}
}
this.ReloadContainer();
});
}
@ -110,7 +115,7 @@ namespace MatterHackers.MatterControl.Library
var fileSystemItem = item as FileSystemFileItem;
if (fileSystemItem != null)
{
var matches = QueueData.Instance.PrintItems.Where(p => p.FileLocation == fileSystemItem.Path);
var matches = QueueData.Instance.PrintItems.Where(p => p.FileLocation == fileSystemItem.Path).ToList();
foreach(var printItem in matches)
{

View file

@ -740,18 +740,13 @@ namespace MatterHackers.MatterControl.PrintLibrary
});
}
private void addToQueueButton_Click(object sender, EventArgs e)
private async void addToQueueButton_Click(object sender, EventArgs e)
{
foreach (var item in libraryView.SelectedItems)
var selectedItems = libraryView.SelectedItems.Select(o => o.Model);
if (selectedItems.Any())
{
throw new NotImplementedException("addToQueueButton_Click");
// Get content
// Create printitemwrapper (or not) - an implementation for this exists in cloud library
// Add printitemwrapper to queue
await PrintQueueContainer.AddAllItems(selectedItems);
}
libraryView.SelectedItems.Clear();
}
private void EnableMenus()