DownloadPrinterProfile should return an instance of PrinterSettings
- Persistence of profile moves to caller - Rename to GetPrinterProfileAsync - Expose PrinterSettings.Save for use in external assemblies - Issue MatterHackers/MCCentral#227, MatterHackers/MCCentral#242
This commit is contained in:
parent
48518f4314
commit
43e94f6ed4
4 changed files with 22 additions and 17 deletions
|
|
@ -185,7 +185,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
private string DocumentPath => ProfileManager.Instance.ProfilePath(this.ID);
|
||||
|
||||
internal void Save()
|
||||
public void Save()
|
||||
{
|
||||
string json = JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
|
||||
|
|
@ -325,12 +325,16 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
string profileToken = recentProfileHistoryItems.OrderByDescending(kvp => kvp.Key).FirstOrDefault().Value;
|
||||
|
||||
// Download the specified json profile
|
||||
await ApplicationController.GetPrinterProfile(profile, profileToken);
|
||||
|
||||
// Update the active instance to the newly downloaded item
|
||||
var printerProfile = ProfileManager.LoadProfile(profile.ID, false);
|
||||
ActiveSliceSettings.RefreshActiveInstance(printerProfile);
|
||||
// Download the specified json profile and persist and activate if successful
|
||||
var printerProfile = await ApplicationController.GetPrinterProfileAsync(profile, profileToken);
|
||||
if (printerProfile != null)
|
||||
{
|
||||
// Persist downloaded profile
|
||||
printerProfile.Save();
|
||||
|
||||
// Update active instance without calling ReloadAll
|
||||
ActiveSliceSettings.RefreshActiveInstance(printerProfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue