From cfdf796d9224ffbd21fec7c6f342e8085d95e26c Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Fri, 16 Nov 2018 16:00:22 -0800 Subject: [PATCH] Make sure we still auto connect issue: MatterHackers/MCCentral#4601 Make AutoConnect work with new multiple open printer tabs --- .../ApplicationView/ApplicationController.cs | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/MatterControlLib/ApplicationView/ApplicationController.cs b/MatterControlLib/ApplicationView/ApplicationController.cs index b2921a498..3f48663a2 100644 --- a/MatterControlLib/ApplicationView/ApplicationController.cs +++ b/MatterControlLib/ApplicationView/ApplicationController.cs @@ -1698,22 +1698,6 @@ namespace MatterHackers.MatterControl } } - if (this.ActivePrinter is PrinterConfig printer - && printer.Settings.PrinterSelected - && printer.Settings.GetValue(SettingsKey.auto_connect)) - { - ApplicationController.StartupTasks.Add(new ApplicationController.StartupTask() - { - Title = "Auto Connect".Localize(), - Priority = 100, - Action = (progress, cancellationToken) => - { - printer.Connection.Connect(); - return Task.CompletedTask; - } - }); - } - if (AssetObject3D.AssetManager == null) { AssetObject3D.AssetManager = new AssetManager(); @@ -1806,6 +1790,12 @@ namespace MatterHackers.MatterControl this.OnOpenPrintersChanged(new OpenPrintersChangedEventArgs(printer, OpenPrintersChangedEventArgs.OperationType.Add)); + if (printer.Settings.PrinterSelected + && printer.Settings.GetValue(SettingsKey.auto_connect)) + { + printer.Connection.Connect(); + } + return printer; }