protected void StopScannerByScannerAction() { if (Monitor.TryEnter(inputLock)) { try { if (CanStopScanner()) { StopScanner(); statusController.ClearSelection(); } } catch (Exception e) { string msg = "Exception occurred while stopping scanner!"; LogAndShowError(msg, e); } finally { Monitor.Exit(inputLock); } } else { logger.Warn("Discarded stop scanner action, because application is busy!"); } }