Open printer if count == 1
This commit is contained in:
parent
fcae79528d
commit
728a2c421b
1 changed files with 17 additions and 1 deletions
|
|
@ -28,6 +28,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
|
|
@ -45,10 +46,25 @@ namespace MatterHackers.MatterControl
|
|||
: base(continueButtonText)
|
||||
{
|
||||
this.printerLoaded = printerLoaded;
|
||||
|
||||
HardwareTreeView.CreatePrinterProfilesTree(rootPrintersNode, theme);
|
||||
}
|
||||
|
||||
public override async void OnLoad(EventArgs args)
|
||||
{
|
||||
base.OnLoad(args);
|
||||
|
||||
if (ProfileManager.Instance.ActiveProfiles.Count() == 1)
|
||||
{
|
||||
// select the printer
|
||||
var printerInfo = ProfileManager.Instance.ActiveProfiles.FirstOrDefault();
|
||||
var printer = await ApplicationController.Instance.OpenEmptyPrinter(printerInfo.ID);
|
||||
|
||||
printerLoaded?.Invoke(printer);
|
||||
|
||||
this.DialogWindow.CloseOnIdle();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTreeNodeDoubleClicked(TreeNode treeNode)
|
||||
{
|
||||
if (treeNode.Tag is PrinterInfo printerInfo)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue