public static void LoadStartupProfile() { bool portExists = false; string[] comportNames = FrostedSerialPort.GetPortNames(); var startupProfile = ProfileManager.LoadProfile(UserSettings.Instance.get("ActiveProfileID")); if (startupProfile != null) { portExists = comportNames.Contains(startupProfile.ComPort()); Instance = startupProfile; if (portExists && startupProfile.GetValue <bool>("auto_connect")) { UiThread.RunOnIdle(() => { //PrinterConnectionAndCommunication.Instance.HaltConnectionThread(); PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter(); }, 2); } } if (Instance == null) { // Load an empty profile with just the MatterHackers base settings from config.json Instance = ProfileManager.LoadEmptyProfile(); } }
internal static void SwitchToProfile(string printerID) { var profile = ProfileManager.LoadProfile(printerID); UserSettings.Instance.set("ActiveProfileID", printerID); Instance = profile ?? ProfileManager.LoadEmptyProfile(); }