Move add printer logic to Part -> Print button
- Later make reusable from Add Hardware and Print button - Issue MatterHackers/MCCentral#4294
This commit is contained in:
parent
57646852ee
commit
4174b0f77d
4 changed files with 22 additions and 18 deletions
|
|
@ -1736,15 +1736,7 @@ namespace MatterHackers.MatterControl
|
|||
public void OnLoadActions()
|
||||
{
|
||||
bool showAuthWindow = ApplicationController.GuestUserActive?.Invoke() ?? false;
|
||||
if (showAuthWindow)
|
||||
{
|
||||
if (ApplicationSettings.Instance.get(ApplicationSettingsKey.SuppressAuthPanel) != "True")
|
||||
{
|
||||
//Launch window to prompt user to sign in
|
||||
UiThread.RunOnIdle(() => DialogWindow.Show(PrinterSetup.GetBestStartPage()));
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!showAuthWindow)
|
||||
{
|
||||
//If user in logged in sync before checking to prompt to create printer
|
||||
if (ApplicationController.SyncPrinterProfiles == null)
|
||||
|
|
|
|||
|
|
@ -119,14 +119,14 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
StyledMessageBox.ShowMessageBox(
|
||||
(deletePrinter) =>
|
||||
{
|
||||
if (deletePrinter)
|
||||
{
|
||||
if (treeView.SelectedNode.Tag is PrinterInfo printerInfo)
|
||||
{
|
||||
ProfileManager.Instance.DeletePrinter(printerInfo.ID, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
if (deletePrinter)
|
||||
{
|
||||
if (treeView.SelectedNode.Tag is PrinterInfo printerInfo)
|
||||
{
|
||||
ProfileManager.Instance.DeletePrinter(printerInfo.ID, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
"Are you sure you want to delete your currently selected printer?".Localize(),
|
||||
"Delete Printer?".Localize(),
|
||||
StyledMessageBox.MessageType.YES_NO,
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ using MatterHackers.Localizations;
|
|||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.Library;
|
||||
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
|
||||
using MatterHackers.MatterControl.PrintLibrary;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
|
|
@ -215,6 +216,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (showPrintButton)
|
||||
{
|
||||
var printButton = new TextButton("Print", theme);
|
||||
printButton.Click += (s, e) =>
|
||||
{
|
||||
bool showAuthWindow = ApplicationController.GuestUserActive?.Invoke() ?? false;
|
||||
if (showAuthWindow)
|
||||
{
|
||||
if (ApplicationSettings.Instance.get(ApplicationSettingsKey.SuppressAuthPanel) != "True")
|
||||
{
|
||||
//Launch window to prompt user to sign in
|
||||
UiThread.RunOnIdle(() => DialogWindow.Show(PrinterSetup.GetBestStartPage()));
|
||||
}
|
||||
}
|
||||
};
|
||||
this.AddChild(printButton);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
public void DeletePrinter(string printerID, bool markedForDelete)
|
||||
{
|
||||
|
||||
bool isActivePrinter = printerID == this.ActiveProfile?.ID;
|
||||
|
||||
var printerInfo = ProfileManager.Instance[printerID];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue