private void btnOk_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; if (cbSelectedTrack.SelectedItem != null) { using (var progressIndicator = new ProgressIndicator(_deviceReader)) { _deviceReader.StartReadTrackThread(cbSelectedTrack.SelectedItem as IGH615MTrackInfo); progressIndicator.ShowDialog(); } } Close(); }
private void btnScan_Click(object sender, EventArgs e) { using (var progressIndicator = new ProgressIndicator(_deviceReader)) { cbSelectedTrack.DataSource = null; cbSelectedTrack.Items.Clear(); cbSelectedTrack.Enabled = false; _deviceReader.StartRescanPortThread(); progressIndicator.ShowDialog(); cbSelectedTrack.DataSource = _deviceReader.GetTracksInfo(); cbSelectedTrack.Enabled = (cbSelectedTrack.Items.Count > 0); btnOk.Enabled = (cbSelectedTrack.Items.Count > 0); } }