From 0e592f7317ecd56eb8e3948650e7231ef3883945 Mon Sep 17 00:00:00 2001 From: gregory-diaz Date: Tue, 18 Feb 2014 15:18:58 -0800 Subject: [PATCH] Corrected problems with the view window Print Item Every time the "view" link on a "print queue item" is clicked a new window would open. I made changes so that it only opens once regardless of how many times it is clicked on. --- MainSlidePanel.cs | 6 ++--- PrintLibrary/ExportLibraryItemWindow.cs | 6 ++--- PrintLibrary/ExportLibraryItemWindow.cs.rej | 13 ++++++++++ PrintQueue/PrintQueueItem.cs | 28 +++++++++++++++++++-- 4 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 PrintLibrary/ExportLibraryItemWindow.cs.rej diff --git a/MainSlidePanel.cs b/MainSlidePanel.cs index 044ae8c47..37df0a45e 100644 --- a/MainSlidePanel.cs +++ b/MainSlidePanel.cs @@ -1,5 +1,5 @@ -<<<<<<< HEAD -======= +//<<<<<<< HEAD +//======= /* Copyright (c) 2014, Lars Brubaker All rights reserved. @@ -29,7 +29,7 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ ->>>>>>> upstream/development +//>>>>>>> upstream/development using System; using System.Collections.Generic; using System.Linq; diff --git a/PrintLibrary/ExportLibraryItemWindow.cs b/PrintLibrary/ExportLibraryItemWindow.cs index 1037ec0ca..516de3487 100644 --- a/PrintLibrary/ExportLibraryItemWindow.cs +++ b/PrintLibrary/ExportLibraryItemWindow.cs @@ -9,11 +9,11 @@ using MatterHackers.Agg.UI; using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.PrintQueue; using MatterHackers.GCodeVisualizer; -<<<<<<< HEAD +//<<<<<<< HEAD using MatterHackers.Localizations; -======= +//======= using MatterHackers.MatterControl.SlicerConfiguration; ->>>>>>> upstream/development +//>>>>>>> upstream/development namespace MatterHackers.MatterControl.PrintLibrary { diff --git a/PrintLibrary/ExportLibraryItemWindow.cs.rej b/PrintLibrary/ExportLibraryItemWindow.cs.rej new file mode 100644 index 000000000..4dedb63b9 --- /dev/null +++ b/PrintLibrary/ExportLibraryItemWindow.cs.rej @@ -0,0 +1,13 @@ +diff a/PrintLibrary/ExportLibraryItemWindow.cs b/PrintLibrary/ExportLibraryItemWindow.cs (rejected hunks) +@@ -9,7 +9,11 @@ + using MatterHackers.MatterControl.DataStorage; + using MatterHackers.MatterControl.PrintQueue; + using MatterHackers.GCodeVisualizer; ++<<<<<<< HEAD + using MatterHackers.Localizations; ++======= ++using MatterHackers.MatterControl.SlicerConfiguration; ++>>>>>>> upstream/development + + namespace MatterHackers.MatterControl.PrintLibrary + { diff --git a/PrintQueue/PrintQueueItem.cs b/PrintQueue/PrintQueueItem.cs index 3d39b4342..ea11b8809 100644 --- a/PrintQueue/PrintQueueItem.cs +++ b/PrintQueue/PrintQueueItem.cs @@ -33,7 +33,9 @@ namespace MatterHackers.MatterControl.PrintQueue FlowLayoutWidget editControls; LinkButtonFactory linkButtonFactory = new LinkButtonFactory(); ExportQueueItemWindow exportingWindow; + PartPreviewMainWindow viewingWindow; bool exportingWindowIsOpen = false; + bool viewWindowIsOpen = false; public PrintQueueItem(PrintItemWrapper printItem) @@ -140,7 +142,28 @@ namespace MatterHackers.MatterControl.PrintQueue this.exportingWindowIsOpen = false; } - + private void OpenViewWindow() + { + if (viewWindowIsOpen == false) + { + viewingWindow = new PartPreviewMainWindow(PrintItemWrapper); + this.viewWindowIsOpen = true; + viewingWindow.Closed += new EventHandler(PartPreviewWindow_Closed); + } + else + { + if(viewingWindow != null) + { + viewingWindow.BringToFront(); + } + } + } + + void PartPreviewWindow_Closed(object sender, EventArgs e) + { + this.viewWindowIsOpen = false; + } + private void CreateEditControls() { editControls = new FlowLayoutWidget(); @@ -156,10 +179,11 @@ namespace MatterHackers.MatterControl.PrintQueue Button viewLink = linkButtonFactory.Generate(new LocalizedString("View").Translated); viewLink.Click += (sender, e) => { + string pathAndFile = PrintItemWrapper.FileLocation; if (File.Exists(pathAndFile)) { - new PartPreviewMainWindow(PrintItemWrapper); + OpenViewWindow(); } else {