public void TearDown() { if (Connection != null) { Connection.Dispose(); } Connection = null; }
protected virtual void Dispose(bool fDisposing) { System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); if (fDisposing) { if (Connection != null) { Connection.Dispose(); } } Connection = null; }
/// <summary/> protected virtual void Dispose(bool fDisposing) { System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType() + ". *******"); if (fDisposing && !IsDisposed) { // dispose managed and unmanaged objects if (m_connection != null) { m_connection.Dispose(); } } m_connection = null; IsDisposed = true; }
public void DestroyQueues() { try { foreach (IBusQueue item in _queueList) { item.Dispose(); } _queueList.Clear(); _connection.Dispose(); } catch (Exception e) { _logger?.LogError(e, $"{_config.LocalIP} : {_config.ApplicationName}.{typeof(BusManager).FullName} : {e.Message}"); } }
/// <summary> /// Create a Connection to Ibus. If successfull Connected property is true. /// </summary> public IbusCommunicator() { m_connection = IBusConnectionFactory.Create(); if (m_connection == null) return; // Prevent hanging on exit issues caused by missing dispose calls, or strange interaction // between ComObjects and managed object. Application.ThreadExit += (sender, args) => { if (m_connection != null) m_connection.Dispose(); m_connection = null; }; m_ibus = new InputBus(m_connection); }
/// <summary> /// Create a Connection to Ibus. If successfull Connected property is true. /// </summary> public IBusCommunicator() { m_connection = IBusConnectionFactory.Create(); if (m_connection == null) { return; } // Prevent hanging on exit issues caused by missing dispose calls, or strange interaction // between ComObjects and managed object. Application.ThreadExit += (sender, args) => { if (m_connection != null) { m_connection.Dispose(); } }; m_ibus = new IBusDotNet.InputBusWrapper(m_connection); }