Restore CloudLibrary save functionality, revise convert to AMF behavior

- Fixes #111237022 - Unable to save any changes to CloudLibrary items
 - Add useIncrementedNameDuringTypeChange to PrintItemWrapper to control naming behavior
 - Pass useIncrementedName value though from provider factory all the way to PrintItemWrapper
 - Prevent duplicate calls to GetPrintItemWrapperAsync within the same callstack i.e. pass instance through
 - Only rename files when switching to AMF and use different logic for different provider types
 - Add path helper methods to PrintItemWrapper for clarity and conciseness in callers
This commit is contained in:
John Lewin 2016-01-11 14:06:47 -08:00
parent 7b94b2ede8
commit 40939b906d
5 changed files with 87 additions and 43 deletions

View file

@ -240,11 +240,15 @@ namespace MatterHackers.MatterControl.PrintLibrary
}
}
public async void OpenPartViewWindow(View3DWidget.OpenMode openMode = View3DWidget.OpenMode.Viewing)
public async void OpenPartViewWindow(View3DWidget.OpenMode openMode = View3DWidget.OpenMode.Viewing, PrintItemWrapper printItemWrapper = null)
{
if (viewingWindow == null)
{
var printItemWrapper = await this.GetPrintItemWrapperAsync();
// Only call GetPrintItemWrapperAsync if need to avoid unneeded overhead
if (printItemWrapper == null)
{
printItemWrapper = await this.GetPrintItemWrapperAsync();
}
viewingWindow = new PartPreviewMainWindow(printItemWrapper, View3DWidget.AutoRotate.Enabled, openMode);
viewingWindow.Closed += new EventHandler(PartPreviewMainWindow_Closed);
}
@ -433,7 +437,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
string pathAndFile = printItemWrapper.FileLocation;
if (File.Exists(pathAndFile))
{
OpenPartViewWindow(openMode);
OpenPartViewWindow(openMode, printItemWrapper);
}
else
{