public void databaseOpenFileDialog_FileOk(object sender, CancelEventArgs e) { if (this.Robot == null) Robot = new Robot(); Robot tmpRobot = new Robot(); if (tmpRobot.Read(databaseOpenFileDialog.FileName)) this.Robot = tmpRobot; LoadGUI(); }
//====================================================================== private void CloseDB() { if (Robot!=null) { if (Properties.Settings.Default.RobotDBSettings == 1) Properties.Settings.Default.DBPath = Robot.DBPath; if (Properties.Settings.Default.RobotDBSettings == 2) { Properties.Settings.Default.DBPath = Robot.DBPath; Properties.Settings.Default.RobotID = Robot.ID; } } this.closeDatabaseToolStripMenuItem.Enabled = false; this.metadataToolStripButton.Enabled = false; Robot = null; if (robotSerialPort.IsOpen) connectionButton_Click(null, null); refreshPortsButton_Click(null, null); refreshBaudRatesButton_Click(null, null); ConnectionReset(); LoadGUI(); }
private void LoadSettings() { refreshPortsButton_Click(null, null); refreshBaudRatesButton_Click(null, null); if (Properties.Settings.Default.ConnectionSettings == 1) { ConnectionFromSettings(); } if (Properties.Settings.Default.RobotDBSettings != 0) { if ((Properties.Settings.Default.RobotDBSettings == 1) || (Properties.Settings.Default.RobotDBSettings == 3)) { if ((Properties.Settings.Default.DBPath != string.Empty) && System.IO.File.Exists(Properties.Settings.Default.DBPath)) { this.Robot = new Robot(); this.Robot.Read(Properties.Settings.Default.DBPath); } } if ((Properties.Settings.Default.RobotDBSettings == 2) || (Properties.Settings.Default.RobotDBSettings == 4)) { if ((Properties.Settings.Default.DBPath != string.Empty) && System.IO.File.Exists(Properties.Settings.Default.DBPath)) { this.Robot = new Robot(); this.Robot.Read(Properties.Settings.Default.DBPath, Properties.Settings.Default.RobotID); } } } LoadGUI(); }