internal static void AcquireNewProfile(string make, string model, string printerName)
		{
			string guid = Guid.NewGuid().ToString();

			OemProfile printerProfile = LoadHttpOemProfile(make, model);
			SettingsLayer baseConfig = LoadMatterHackersBaseLayer();

			var layeredProfile = new LayeredProfile(
				printerProfile, 
				baseConfig);
			layeredProfile.DocumentPath = Path.Combine(profilesPath, guid + ".json");
			layeredProfile.Save();

			ProfileData.Profiles.Add(new PrinterInfo
			{
				Name = printerName,
				Id = guid
			});

			Instance = new SettingsProfile(layeredProfile);
		}
		static ActiveSliceSettings()
		{
			// Ensure the profiles directory exists
			Directory.CreateDirectory(profilesPath);

			// Load or import the profiles.json document
			if (File.Exists(profilesDBPath))
			{
				ProfileData = JsonConvert.DeserializeObject<ProfileData>(File.ReadAllText(profilesDBPath));
			}
			else
			{
				ProfileData = new ProfileData();

				// Import class profiles from the db into local json files
				DataStorage.ClassicDB.ClassicSqlitePrinterProfiles.ImportPrinters(ProfileData, profilesPath);
				File.WriteAllText(profilesDBPath, JsonConvert.SerializeObject(ProfileData, Formatting.Indented));

				// TODO: Upload new profiles to webservice
			}

			if (!string.IsNullOrEmpty(ProfileData.ActiveProfileID))
			{
				Instance = LoadProfile(ProfileData.ActiveProfileID);
			}
			else
			{
				// Load an empty profile with just the MatterHackers base settings from config.json
				Instance = new SettingsProfile(LoadEmptyProfile());
			}
		}
		public EditConnectionWidget(ConnectionWindow windowController, GuiWidget containerWindowToClose, Printer activePrinter = null, object state = null)
			: base(windowController, containerWindowToClose)
		{
			textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
			textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
			textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor;
			textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
			textImageButtonFactory.borderWidth = 0;

			linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor;
			linkButtonFactory.fontSize = 8;

			this.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
			this.AnchorAll();
			this.Padding = new BorderDouble(0); //To be re-enabled once native borders are turned off

			GuiWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			mainContainer.AnchorAll();
			mainContainer.Padding = new BorderDouble(3, 3, 3, 5);
			mainContainer.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			string headerTitle;

			if (activePrinter == null)
			{
				headerTitle = string.Format("Add a Printer");
				this.addNewPrinterFlag = true;
				this.ActivePrinter = new Printer();
				this.ActivePrinter.Name = "Default Printer";
				this.ActivePrinter.BaudRate = "250000";
				try
				{
					this.ActivePrinter.ComPort = FrostedSerialPort.GetPortNames().FirstOrDefault();
				}
				catch(Exception e)
				{
					Debug.Print(e.Message);
					GuiWidget.BreakInDebugger();
					//No active COM ports
				}
			}
			else
			{
				this.ActivePrinter = activePrinter;
				string editHeaderTitleTxt = LocalizedString.Get("Edit Printer");
				headerTitle = string.Format("{1} - {0}", this.ActivePrinter.Name, editHeaderTitleTxt);
				if (this.ActivePrinter.BaudRate == null)
				{
					this.ActivePrinter.BaudRate = "250000";
				}
				if (this.ActivePrinter.ComPort == null)
				{
					try
					{
						this.ActivePrinter.ComPort = FrostedSerialPort.GetPortNames().FirstOrDefault();
					}
					catch(Exception e)
					{
						Debug.Print(e.Message);
						GuiWidget.BreakInDebugger();
						//No active COM ports
					}
				}
			}

			FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
			headerRow.Margin = new BorderDouble(0, 3, 0, 0);
			headerRow.Padding = new BorderDouble(0, 3, 0, 3);
			headerRow.HAnchor = HAnchor.ParentLeftRight;
			{
				TextWidget headerLabel = new TextWidget(headerTitle, pointSize: 14);
				headerLabel.TextColor = this.defaultTextColor;

				headerRow.AddChild(headerLabel);
			}

			ConnectionControlContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			ConnectionControlContainer.Padding = new BorderDouble(5);
			ConnectionControlContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
			ConnectionControlContainer.HAnchor = HAnchor.ParentLeftRight;
			{
				TextWidget printerNameLabel = new TextWidget(LocalizedString.Get("Name"), 0, 0, 10);
				printerNameLabel.TextColor = this.defaultTextColor;
				printerNameLabel.HAnchor = HAnchor.ParentLeftRight;
				printerNameLabel.Margin = new BorderDouble(0, 0, 0, 1);

				printerNameInput = new MHTextEditWidget(this.ActivePrinter.Name);

				printerNameInput.HAnchor |= HAnchor.ParentLeftRight;

				comPortLabelWidget = new FlowLayoutWidget();

				Button refreshComPorts = linkButtonFactory.Generate(LocalizedString.Get("(refresh)"));
				refreshComPorts.Margin = new BorderDouble(left: 5);
				refreshComPorts.VAnchor = VAnchor.ParentBottom;
				refreshComPorts.Click += new EventHandler(RefreshComPorts);

				FlowLayoutWidget comPortContainer = null;

#if !__ANDROID__
				TextWidget comPortLabel = new TextWidget(LocalizedString.Get("Serial Port"), 0, 0, 10);
				comPortLabel.TextColor = this.defaultTextColor;

				comPortLabelWidget.AddChild(comPortLabel);
				comPortLabelWidget.AddChild(refreshComPorts);
				comPortLabelWidget.Margin = new BorderDouble(0, 0, 0, 10);
				comPortLabelWidget.HAnchor = HAnchor.ParentLeftRight;

				comPortContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
				comPortContainer.Margin = new BorderDouble(0);
				comPortContainer.HAnchor = HAnchor.ParentLeftRight;

				CreateSerialPortControls(comPortContainer, this.ActivePrinter.ComPort);
#endif

				TextWidget baudRateLabel = new TextWidget(LocalizedString.Get("Baud Rate"), 0, 0, 10);
				baudRateLabel.TextColor = this.defaultTextColor;
				baudRateLabel.Margin = new BorderDouble(0, 0, 0, 10);
				baudRateLabel.HAnchor = HAnchor.ParentLeftRight;

				baudRateWidget = GetBaudRateWidget();
				baudRateWidget.HAnchor = HAnchor.ParentLeftRight;

				FlowLayoutWidget printerMakeContainer = createPrinterMakeContainer();
				FlowLayoutWidget printerModelContainer = createPrinterModelContainer();

				enableAutoconnect = new CheckBox(LocalizedString.Get("Auto Connect"));
				enableAutoconnect.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				enableAutoconnect.Margin = new BorderDouble(top: 10);
				enableAutoconnect.HAnchor = HAnchor.ParentLeft;
				if (this.ActivePrinter.AutoConnectFlag)
				{
					enableAutoconnect.Checked = true;
				}

				if (state as StateBeforeRefresh != null)
				{
					enableAutoconnect.Checked = ((StateBeforeRefresh)state).autoConnect;
				}

				SerialPortControl serialPortScroll = new SerialPortControl();

				if (comPortContainer != null)
				{
					serialPortScroll.AddChild(comPortContainer);
				}

				ConnectionControlContainer.VAnchor = VAnchor.ParentBottomTop;
				ConnectionControlContainer.AddChild(printerNameLabel);
				ConnectionControlContainer.AddChild(printerNameInput);
				ConnectionControlContainer.AddChild(printerMakeContainer);
				ConnectionControlContainer.AddChild(printerModelContainer);
				ConnectionControlContainer.AddChild(comPortLabelWidget);
				ConnectionControlContainer.AddChild(serialPortScroll);
				ConnectionControlContainer.AddChild(baudRateLabel);
				ConnectionControlContainer.AddChild(baudRateWidget);
#if !__ANDROID__
				ConnectionControlContainer.AddChild(enableAutoconnect);
#endif
			}

			FlowLayoutWidget buttonContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
			buttonContainer.HAnchor = HAnchor.ParentLeft | HAnchor.ParentRight;
			//buttonContainer.VAnchor = VAnchor.BottomTop;
			buttonContainer.Margin = new BorderDouble(0, 5, 0, 3);
			{
				//Construct buttons
				saveButton = textImageButtonFactory.Generate(LocalizedString.Get("Save"));
				//saveButton.VAnchor = VAnchor.Bottom;

				cancelButton = textImageButtonFactory.Generate(LocalizedString.Get("Cancel"));
				//cancelButton.VAnchor = VAnchor.Bottom;
				cancelButton.Click += new EventHandler(CancelButton_Click);

				//Add buttons to buttonContainer
				buttonContainer.AddChild(saveButton);
				buttonContainer.AddChild(new HorizontalSpacer());
				buttonContainer.AddChild(cancelButton);
			}

			//mainContainer.AddChild(new PrinterChooser());

			mainContainer.AddChild(headerRow);
			mainContainer.AddChild(ConnectionControlContainer);
			mainContainer.AddChild(buttonContainer);

#if __ANDROID__
			this.AddChild(new SoftKeyboardContentOffset(mainContainer));
#else
			this.AddChild(mainContainer);
#endif

			BindSaveButtonHandlers();
			BindBaudRateHandlers();
		}