fix import settings

issue: MatterHackers/MCCentral#6035
After importing a material or quality preset the drop menu does not get updated

fixing warnings
This commit is contained in:
LarsBrubaker 2020-09-01 09:22:18 -07:00
parent 6baf716729
commit c0113ef797
4 changed files with 11 additions and 7 deletions

View file

@ -98,7 +98,7 @@ namespace MatterHackers.MatterControl.DataStorage.ClassicDB
}
// Import macros from the database
var allMacros = Datastore.Instance.dbSQLite.Query<CustomCommands>("SELECT * FROM CustomCommands WHERE PrinterId = " + printer.Id);
var allMacros = Datastore.Instance.dbSQLite.Query<CustomCommands>("SELECT * FROM CustomCommands WHERE PrinterId = " + printer.Id);
printerSettings.Macros = allMacros.Select(macro => new GCodeMacro()
{
GCode = macro.Value.Trim(),
@ -119,7 +119,7 @@ namespace MatterHackers.MatterControl.DataStorage.ClassicDB
printerSettings.OemLayer[SettingsKey.layer_to_pause] = "";
// TODO: Where can we find CalibrationFiiles in the current model?
//layeredProfile.SetActiveValue(""calibration_files"", ???);
// layeredProfile.SetActiveValue(""calibration_files"", ???);
printerSettings.ID = printer.Id.ToString();
@ -134,7 +134,7 @@ namespace MatterHackers.MatterControl.DataStorage.ClassicDB
private static void LoadMaterialSettings(PrinterSettings layeredProfile, Printer printer)
{
var materialAssignments = printer.MaterialCollectionIds?.Split(',');
if(materialAssignments == null)
if (materialAssignments == null)
{
return;
}

View file

@ -208,10 +208,14 @@ namespace MatterHackers.MatterControl
if (destIsMaterial)
{
printer.Settings.MaterialLayers.Add(printerSettingsLayer);
var newMaterial = printer.Settings.MaterialLayers[printer.Settings.MaterialLayers.Count - 1];
printer.Settings.SetValue(SettingsKey.active_material_key, newMaterial.LayerID);
}
else
{
printer.Settings.QualityLayers.Add(printerSettingsLayer);
var newQuality = printer.Settings.QualityLayers[printer.Settings.QualityLayers.Count - 1];
printer.Settings.SetValue(SettingsKey.active_quality_key, newQuality.LayerID);
}
}
else

View file

@ -83,14 +83,14 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
Margin = new BorderDouble(top: 6),
Padding = new BorderDouble(left: (accentColor != Color.Transparent) ? 6 : 0)
};
pullDownContainer.AddChild(this.GetPulldownContainer());
pullDownContainer.AddChild(this.NewPulldownContainer());
this.AddChild(pullDownContainer);
// Register listeners
printer.Settings.SettingChanged += Printer_SettingChanged;
}
public FlowLayoutWidget GetPulldownContainer()
private FlowLayoutWidget NewPulldownContainer()
{
dropDownList = CreateDropdown();
@ -422,7 +422,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
private void RebuildDropDownList()
{
pullDownContainer.CloseAllChildren();
pullDownContainer.AddChild(this.GetPulldownContainer());
pullDownContainer.AddChild(this.NewPulldownContainer());
}
private void SettingsLayers_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)

@ -1 +1 @@
Subproject commit 0feb38735cfc1b4af4c8e9887a678ee04888047c
Subproject commit e992aacf403db28ebd1b8869b70300280dc1b7b9