Make slice presets preload during setup.

This commit is contained in:
Kevin Pope 2014-04-12 12:34:27 -07:00
parent a98655f79c
commit 3efc899d2f
3 changed files with 94 additions and 23 deletions

View file

@ -34,7 +34,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
this.ActivePrinter = new Printer();
this.ActivePrinter.Make = null;
this.ActivePrinter.Model = null;
this.ActivePrinter.Name = "Default Printer";
this.ActivePrinter.Name = "Default Printer ({0})".FormatWith(ExistingPrinterCount() + 1);
this.ActivePrinter.BaudRate = null;
this.ActivePrinter.ComPort = null;
}
@ -44,6 +44,13 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
}
}
public int ExistingPrinterCount()
{
string query = string.Format("SELECT COUNT(*) FROM Printer;");
string result = Datastore.Instance.dbSQLite.ExecuteScalar<string>(query);
return Convert.ToInt32(result);
}
public void LoadCalibrationPrints()
{
if (this.ActivePrinter.Make != null && this.ActivePrinter.Model != null)