private void barButtonItemFirmwareUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if(!(_deviceConnection is UsbDaqConnection)) { MessageBox.Show("Device is not supported.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { timerQueryTime.Stop(); timerLive.Stop(); var patchForm = new PatcherForm(_deviceConnection as UsbDaqConnection); patchForm.ShowDialog(); } catch(Exception ex) { Log.Error("Firmware update failed.", ex); } finally { timerLive.Start(); timerQueryTime.Start(); } }