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.
This commit is contained in:
gregory-diaz 2014-02-18 15:18:58 -08:00
parent 5465563e82
commit 0e592f7317
4 changed files with 45 additions and 8 deletions

View file

@ -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;

View file

@ -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
{

View file

@ -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
{

View file

@ -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
{