Пример #1
0
 private void connectButton_Click(object sender, EventArgs e)
 {
     if (displayConnection.Connected())
     {
         displayConnection.Close();
         stateLabel.Text    = "Disconnected";
         connectButton.Text = "Connect";
     }
     else
     {
         if (displayConnection.Open(Properties.Settings.Default.ComPort, Properties.Settings.Default.BaudRate))
         {
             connectButton.Text = "Disconnect";
             IracingStopped();
         }
     }
 }
Пример #2
0
        private bool allowClose;       // ContextMenu's Exit command used


        public HostWindow()
        {
            InitializeComponent();

            displayConnection = new DisplayConnection(this);
            iracingConnection = new IRacingConnection(this, displayConnection);

            if (Properties.Settings.Default.AutoConnect)
            {
                autoConnectCheckbox.Checked = Properties.Settings.Default.AutoConnect;

                displayConnection.Open(Properties.Settings.Default.ComPort, Properties.Settings.Default.BaudRate);
                iracingConnection.Open(Properties.Settings.Default.RefreshRate);

                if (displayConnection.Connected())
                {
                    IracingStopped();
                    connectButton.Text = "Disconnect";
                }
            }
        }