private void DeviceDisconnectionNotify(object sender, EventArgs e) { if (InvokeRequired) { try { Invoke((Delegate) new DeviceDisconnectionNotifyDelegate(DeviceConnectionNotify), sender, e); } catch { } } else { m_mutex.WaitOne(); DeviceForm devForm = sender as DeviceForm; if (devForm != null) { comPortTreeForm.DisconnectDevice(devForm); } m_mutex.ReleaseMutex(); } }