Merge pull request #895 from larsbrubaker/master
make sure we close editor on delete printer
This commit is contained in:
commit
e5447a9fc2
3 changed files with 42 additions and 24 deletions
|
|
@ -32,6 +32,7 @@ using MatterHackers.Agg.UI;
|
|||
using MatterHackers.GuiAutomation;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.PrinterCommunication;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
|
@ -62,38 +63,30 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
if (PrinterConnectionAndCommunication.Instance?.ActivePrinter?.ID != null)
|
||||
{
|
||||
if (!runingNavigation)
|
||||
Task.Run(() =>
|
||||
{
|
||||
runingNavigation = true;
|
||||
Task.Run(() =>
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(inputType: AutomationRunner.InputType.Simulated, drawSimulatedMouse: false);
|
||||
testRunner.TimeToMoveMouse = 0;
|
||||
testRunner.UpDelaySeconds = 0;
|
||||
WizardWindow.Show<EditPrinterSettingsPage>("EditSettings", "Edit Printer Settings");
|
||||
|
||||
UiThread.RunOnIdle(() =>
|
||||
EventHandler unregisterEvents = null;
|
||||
ActiveSliceSettings.ActivePrinterChanged.RegisterEvent((s,e) =>
|
||||
{
|
||||
WizardWindow.Show<EditPrinterSettingsPage>("EditSettings", "Edit Printer Settings");
|
||||
});
|
||||
|
||||
testRunner.Wait(.5);
|
||||
|
||||
if (widgetNameToHighlight.Contains(","))
|
||||
{
|
||||
foreach (string item in widgetNameToHighlight.Split(','))
|
||||
WizardWindow openWindowInternal = WizardWindow.GetSystemWindow("EditSettings");
|
||||
if(openWindowInternal != null)
|
||||
{
|
||||
HighlightWidget(testRunner, item);
|
||||
UiThread.RunOnIdle(() => openWindowInternal.Close());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HighlightWidget(testRunner, widgetNameToHighlight);
|
||||
}
|
||||
}, ref unregisterEvents);
|
||||
|
||||
WizardWindow openWindow = WizardWindow.GetSystemWindow("EditSettings");
|
||||
openWindow.Closed += (s2, e2) =>
|
||||
{
|
||||
UiThread.RunOnIdle(() => unregisterEvents?.Invoke(s2, null));
|
||||
};
|
||||
|
||||
testRunner.Dispose();
|
||||
runingNavigation = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,28 @@ namespace MatterHackers.MatterControl
|
|||
this.MinimumSize = new Vector2(350 * GuiWidget.DeviceScale, 400 * GuiWidget.DeviceScale);
|
||||
}
|
||||
|
||||
public static void Close(string uri)
|
||||
{
|
||||
WizardWindow existingWindow;
|
||||
|
||||
if (allWindows.TryGetValue(uri, out existingWindow))
|
||||
{
|
||||
existingWindow.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static WizardWindow GetSystemWindow(string uri)
|
||||
{
|
||||
WizardWindow existingWindow;
|
||||
|
||||
if (allWindows.TryGetValue(uri, out existingWindow))
|
||||
{
|
||||
return existingWindow;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void Show<PanelType>(string uri, string title) where PanelType : WizardPage, new()
|
||||
{
|
||||
WizardWindow existingWindow;
|
||||
|
|
|
|||
|
|
@ -4957,3 +4957,6 @@ Translated:Enable Fan If Layer Print Time Is Below
|
|||
English:Hz
|
||||
Translated:Hz
|
||||
|
||||
English:Current Settings
|
||||
Translated:Current Settings
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue