Fixing 'File' removal regressions

issue: MatterHackers/MCCentral#4342
Save as not working from toolbar

issue: MatterHackers/MCCentral#4343
No right click bed menu
This commit is contained in:
Lars Brubaker 2018-10-20 13:06:29 -07:00
parent c612b5d77a
commit 29bfeb23c3
2 changed files with 22 additions and 4 deletions

View file

@ -1336,7 +1336,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
var popupMenu = new PopupMenu(ApplicationController.Instance.MenuTheme);
var actions = new[] {
WorkspaceActions["Insert"],
new ActionSeparator(),
new NamedAction()
{
@ -1365,8 +1364,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
},
IsEnabled = () => Clipboard.Instance.ContainsImage || Clipboard.Instance.GetText() == "!--IObjectSelection--!"
},
WorkspaceActions["Save"],
WorkspaceActions["SaveAs"],
WorkspaceActions["Export"],
new ActionSeparator(),
WorkspaceActions["ArrangeAll"],

View file

@ -538,7 +538,28 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
var saveAs = popupMenu.CreateMenuItem("Save As".Localize());
saveAs.Click += (s, e) => UiThread.RunOnIdle(() =>
{
this.MenuActions.FirstOrDefault(m => m.ID == "SaveAs")?.Action?.Invoke();
UiThread.RunOnIdle(() =>
{
DialogWindow.Show(
new SaveAsPage(
async (newName, destinationContainer) =>
{
// Save to the destination provider
if (destinationContainer is ILibraryWritableContainer writableContainer)
{
// Wrap stream with ReadOnlyStream library item and add to container
writableContainer.Add(new[]
{
new InMemoryLibraryItem(sceneContext.Scene)
{
Name = newName
}
});
destinationContainer.Dispose();
}
}));
});
});
return popupMenu;