Wire up initial move item invocation, remove dead code

This commit is contained in:
John Lewin 2017-12-21 10:39:58 -08:00
parent deeb6772e0
commit 138b2521ea
2 changed files with 28 additions and 27 deletions

View file

@ -513,7 +513,34 @@ namespace MatterHackers.MatterControl.PrintLibrary
menuActions.Add(new PrintItemAction()
{
Title = "Move".Localize(),
Action = (selectedLibraryItems, listView) => moveInLibraryButton_Click(selectedLibraryItems, null),
Action = (selectedLibraryItems, listView) =>
{
// TODO: If we don't filter to non-container content here, then the providers could be passed a container to move to some other container
var partItems = selectedLibraryItems.Where(item => item is ILibraryContentStream);
if (partItems.Count() > 0)
{
// If all selected items are LibraryRowItemParts, then we can invoke the batch remove functionality (in the Cloud library scenario)
// and perform all moves as part of a single request, with a single notification from Socketeer
var container = libraryView.ActiveContainer as ILibraryWritableContainer;
if (container != null)
{
var movePage = new MoveItemPage((newName, destinationContainer) =>
{
Console.WriteLine(destinationContainer.Name);
throw new NotImplementedException("Library Move not implemented");
// TODO: Implement move
//container.Move(partItems.Select(p => p.Model), null);
});
DialogWindow.Show(movePage);
}
}
libraryView.SelectedItems.Clear();
},
IsEnabled = (selectedListItems, listView) =>
{
// Multiselect, WritableContainer - disallow protected
@ -738,27 +765,6 @@ namespace MatterHackers.MatterControl.PrintLibrary
libraryView.SelectedItems.Clear();
}
private void moveInLibraryButton_Click(object sender, EventArgs e)
{
// TODO: If we don't filter to non-container content here, then the providers could be passed a container to move to some other container
var partItems = libraryView.SelectedItems.Where(item => item is ILibraryContentItem);
if (partItems.Count() > 0)
{
// If all selected items are LibraryRowItemParts, then we can invoke the batch remove functionality (in the Cloud library scenario)
// and perform all moves as part of a single request, with a single notification from Socketeer
var container = libraryView.ActiveContainer as ILibraryWritableContainer;
if (container != null)
{
throw new NotImplementedException("Library Move not implemented");
// TODO: Implement move
container.Move(partItems.Select(p => p.Model), null);
}
}
libraryView.SelectedItems.Clear();
}
private void shareFromLibraryButton_Click(object sender, EventArgs e)
{
// TODO: Should be rewritten to Register from cloudlibrary, include logic to add to library as needed