Improved printer import experience (mad simpler)

This commit is contained in:
Lars Brubaker 2018-03-16 15:14:23 -07:00
parent e2229bbd56
commit 1d6c3e68da
6 changed files with 102 additions and 345 deletions

View file

@ -38,6 +38,7 @@ using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
using Newtonsoft.Json;
@ -154,7 +155,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab
&& File.Exists(result.FileName))
{
simpleTabs.RemoveTab(simpleTabs.ActiveTab);
ImportSettingsPage.ImportFromExisting(result.FileName);
if (ProfileManager.ImportFromExisting(result.FileName))
{
string importPrinterSuccessMessage = "You have successfully imported a new printer profile. You can find '{0}' in your list of available printers.".Localize();
DialogWindow.Show(
new ImportSucceeded(importPrinterSuccessMessage.FormatWith(Path.GetFileNameWithoutExtension(result.FileName))));
}
else
{
StyledMessageBox.ShowMessageBox("Oops! Settings file '{0}' did not contain any settings we could import.".Localize().FormatWith(Path.GetFileName(result.FileName)), "Unable to Import".Localize());
}
}
});
});

View file

@ -326,7 +326,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
UiThread.RunOnIdle(() =>
{
DialogWindow.Show(new ImportSettingsPage());
AggContext.FileDialogs.OpenFileDialog(
new OpenFileDialogParams("settings files|*.printer"),
(dialogParams) =>
{
if (!string.IsNullOrEmpty(dialogParams.FileName))
{
DialogWindow.Show(new SelectPartsOfPrinterToImport(dialogParams.FileName));
}
});
});
}