private void connectButton_Click(object sender, EventArgs e) { connectProgress.Visible = true; connectButton.Enabled = false; FpsGt511C1R.Close(); var status = FpsGt511C1R.Open(Port, Baud); if (status == 1) { DialogResult = DialogResult.OK; IsConnected = true; connectBg.BackColor = Color.Green; connectText.Text = Resources.FPS_CONNECTED; } else { DialogResult = DialogResult.None; IsConnected = false; connectBg.BackColor = Color.Red; connectText.Text = Resources.FPS_DISCONNECTED; FpsGt511C1R.Close(); MessageBox.Show( $"Got connect error #{status}.\nYou may need to manually reset the device and try again."); } connectButton.Enabled = true; connectProgress.Visible = false; }
public virtual void Dispose() { FpsGt511C1R.Close(); Dispose(true); }