Merge pull request #79 from mmoening/development

Added feature to replace "Default Printer" with the Make and Model of th...
This commit is contained in:
Lars Brubaker 2014-10-29 18:14:51 -07:00
commit cde58a3148
2 changed files with 14 additions and 0 deletions

View file

@ -425,6 +425,10 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
void NextButton_Click(object sender, EventArgs mouseEvent)
{
if(printerNameInput.Text == "Default Printer ({0})".FormatWith(ExistingPrinterCount() + 1))
{
printerNameInput.Text = String.Format ("{0} {1} ({2})", this.ActivePrinter.Make, this.ActivePrinter.Model, ExistingPrinterCount () + 1);
}
bool canContinue = this.OnSave();
if (canContinue)
{
@ -432,6 +436,13 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
UiThread.RunOnIdle(MoveToNextWidget);
}
}
public int ExistingPrinterCount()
{
string query = string.Format("SELECT COUNT(*) FROM Printer;");
string result = Datastore.Instance.dbSQLite.ExecuteScalar<string>(query);
return Convert.ToInt32(result);
}
void LoadSlicePresets()
{