Inline 'Success' method

This commit is contained in:
John Lewin 2018-06-05 15:30:06 -07:00
parent a94523e6d5
commit 6bc8dc9c16
2 changed files with 12 additions and 13 deletions

View file

@ -197,7 +197,16 @@ namespace MatterHackers.MatterControl
printer.Settings.Merge(printerSettingsLayer, settingsToImport, sourceFilter, copyName);
var layerName = (printerSettingsLayer.ContainsKey(SettingsKey.layer_name)) ? printerSettingsLayer[SettingsKey.layer_name] : "none";
Success(settingsFilePath, layerName, destIsMaterial ? "Material".Localize() : "Quality".Localize());
string sectionName = destIsMaterial ? "Material".Localize() : "Quality".Localize();
string importSettingSuccessMessage = $"You have successfully imported a new {sectionName} setting. You can find '{layerName}' in your list of {sectionName} settings.".Localize();
WizardWindow.ChangeToPage(
new ImportSucceeded(importSettingSuccessMessage)
{
WizardWindow = this.WizardWindow,
});
if (destIsMaterial)
{
@ -221,17 +230,6 @@ namespace MatterHackers.MatterControl
this.AddPageAction(mergeButton);
}
private void Success(string settingsFilePath, string sourceName, string sectionName)
{
string importSettingSuccessMessage = $"You have successfully imported a new {sectionName} setting. You can find '{sourceName}' in your list of {sectionName} settings.".Localize();
WizardWindow.ChangeToPage(
new ImportSucceeded(importSettingSuccessMessage)
{
WizardWindow = this.WizardWindow,
});
}
private static void DisplayFailedToImportMessage(string settingsFilePath)
{
StyledMessageBox.ShowMessageBox("Oops! Settings file '{0}' did not contain any settings we could import.".Localize().FormatWith(Path.GetFileName(settingsFilePath)), "Unable to Import".Localize());