private void _findDeviceButton_Click(object sender, System.EventArgs e) { try { _deviceModel.StopSignal(); var deviceSearchForm = new DeviceSearchForm(); if (deviceSearchForm.ShowDialog(this) == DialogResult.OK) { if (deviceSearchForm.SelectedDevice != null) { _deviceLabel.Text = deviceSearchForm.SelectedDevice.ToString(); _deviceModel.SelectDevice(deviceSearchForm.SelectedDevice); } else { _deviceLabel.Text = "Not selected"; } } } catch (Exception exc) { MessageBox.Show($"Cannot connect to device: {exc.Message}", "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void _findDeviceButton_Click(object sender, System.EventArgs e) { _deviceModel.StopSignal(); var deviceSearchForm = new DeviceSearchForm(); if (deviceSearchForm.ShowDialog(this) == DialogResult.OK) { if (deviceSearchForm.SelectedDevice != null) { _deviceLabel.Text = deviceSearchForm.SelectedDevice.ToString(); _deviceModel.SelectDevice(deviceSearchForm.SelectedDevice); } else { _deviceLabel.Text = "Not selected"; } } }