From e3c5924ef2641232ef89e815d394ceaa69250b54 Mon Sep 17 00:00:00 2001 From: Kevin Pope Date: Fri, 7 Mar 2014 11:06:59 -0800 Subject: [PATCH] Made save dialogs for pdf import/export Mac compatible. --- PartsSheet.cs | 5 +++-- PrintQueue/PrintQueueMenu.cs | 8 +++++++- ProjectFileHandler.cs | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/PartsSheet.cs b/PartsSheet.cs index ecc5ea31f..852bbd27a 100644 --- a/PartsSheet.cs +++ b/PartsSheet.cs @@ -231,6 +231,7 @@ namespace MatterHackers.MatterControl document.Info.Subject = "This is a list of the parts that are in a queue from MatterControl."; document.Info.Keywords = "MatterControl, STL, 3D Printing"; + int nextPartToPrintIndex = 0; int plateNumber = 1; bool done = false; @@ -241,10 +242,10 @@ namespace MatterHackers.MatterControl } try { - document.Save(pathAndFileToSaveTo); + document.Save(pathAndFileToSaveTo); Process.Start(pathAndFileToSaveTo); } - catch { + catch (Exception e){ } diff --git a/PrintQueue/PrintQueueMenu.cs b/PrintQueue/PrintQueueMenu.cs index f186488d2..b5373e198 100644 --- a/PrintQueue/PrintQueueMenu.cs +++ b/PrintQueue/PrintQueueMenu.cs @@ -99,13 +99,19 @@ namespace MatterHackers.MatterControl.PrintQueue if (parts.Count > 0) { SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Parts Sheet|*.pdf"); + saveParams.ActionButtonLabel = new LocalizedString("Save Parts Sheet").Translated; string saveParamsTitleLbl = new LocalizedString("MatterContol").Translated; string saveParamsTitleLblFull = new LocalizedString ("Save").Translated; saveParams.Title = string.Format("{0}: {1}",saveParamsTitleLbl,saveParamsTitleLblFull); System.IO.Stream streamToSaveTo = FileDialog.SaveFileDialog(ref saveParams); - if (streamToSaveTo != null) + if (streamToSaveTo != null) + { + streamToSaveTo.Close (); + } + + if (saveParams.FileName != null) { PartsSheet currentPartsInQueue = new PartsSheet(parts, saveParams.FileName); diff --git a/ProjectFileHandler.cs b/ProjectFileHandler.cs index 7f3ae90a2..bcf1c8df8 100644 --- a/ProjectFileHandler.cs +++ b/ProjectFileHandler.cs @@ -242,8 +242,8 @@ namespace MatterHackers.MatterControl { OpenFileDialogParams openParams = new OpenFileDialogParams("Zip file|*.zip"); - System.IO.Stream streamToLoadFrom = FileDialog.OpenFileDialog(ref openParams); - if (streamToLoadFrom != null) + FileDialog.OpenFileDialog(ref openParams); + if (openParams.FileNames != null) { string loadedFileName = openParams.FileName; return ImportFromProjectArchive(loadedFileName);