private void allDefaultsLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { m_settings = new CommBaseSettings(); m_settings.port = Project.controllerPortSettings.port; m_settings.baudRate = Project.controllerPortSettings.baudRate; m_settings.parity = Parity.none; m_settings.autoReopen = true; FillValues(); }
public DlgPortSettings() { InitializeComponent(); m_settings = Project.controllerPortSettings; FillASCII(comboBoxXon); FillASCII(comboBoxXoff); // Project.setDlgIcon(this); }
// returns true if could restore from file public static bool restoreOrDefaultPortSettings() { bool ret = false; // restore controllerPortSettings from the file or fill it with default values: string controllerPortFilePath = Project.GetMiscPath(Project.CONTROLLER_PORTCONFIG_FILE_NAME + "-" + currentControllerMake + ".xml"); if (!File.Exists(controllerPortFilePath)) { // older versions used single file for all Controllers controllerPortFilePath = Project.GetMiscPath(Project.CONTROLLER_PORTCONFIG_FILE_NAME + ".xml"); } Stream fs = null; try { fs = new FileStream(controllerPortFilePath, FileMode.Open, FileAccess.Read, FileShare.Read); Project.controllerPortSettings = CommBaseSettings.LoadFromXML(fs); if (Project.controllerPortSettings == null) { throw new Exception(); } ret = true; } catch { Project.controllerPortSettings = new CommBaseSettings(); Project.controllerPortSettings.port = "COM1:"; Project.controllerPortSettings.baudRate = 9600; Project.controllerPortSettings.parity = Parity.none; Project.controllerPortSettings.autoReopen = true; } finally { if (fs != null) { fs.Close(); } } return(ret); }