Move last selected profile management into ProfileManager

- Multi-user support: store the value in a user specific key
This commit is contained in:
John Lewin 2016-07-11 15:14:23 -07:00
parent a8598abafe
commit be3eed0f5d
3 changed files with 28 additions and 6 deletions

View file

@ -135,7 +135,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
string[] comportNames = FrostedSerialPort.GetPortNames();
var startupProfile = ProfileManager.LoadProfile(UserSettings.Instance.get("ActiveProfileID"));
var startupProfile = ProfileManager.Instance.LoadLastProfile();
if (startupProfile != null)
{
portExists = comportNames.Contains(startupProfile.ComPort());
@ -162,9 +162,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
var profile = ProfileManager.LoadProfile(printerID);
UserSettings.Instance.set("ActiveProfileID", printerID);
UserSettings.Instance.set("ActiveUserName", ApplicationController.Instance.GetSessionUsernameForFileSystem());
ProfileManager.Instance.SetLastProfile(printerID);
Instance = profile ?? ProfileManager.LoadEmptyProfile();
}