private void connectButton_Click(object sender, RoutedEventArgs e)
        {
            string host = hostTextBox.Text;
            int i2cCommandPort = int.Parse(i2cCommandPortTextBox.Text);
            int cameraPort = int.Parse(cameraPortTextBox.Text);

            Settings.Default.Host = host;
            Settings.Default.I2CProxyPort = i2cCommandPort;
            Settings.Default.CameraPort = cameraPort;
            Settings.Default.Save();

            var robot = new Beagle();
            robot.Host = host;
            robot.I2CCommandPort = i2cCommandPort;
            robot.I2CPollPort = i2cCommandPort + 1;
            robot.CameraPort = cameraPort;
            robot.Init();
            bool ok = robot.Connect();
            if (!ok)
            {
                MessageBox.Show("Unable to connect. Please check your settings.", "Connect", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            var main = new MainWindow();
            main.Robot = robot;
            main.Show();

            expectedToClose = true;
            Close();
        }