示例#1
0
 public void TearDown()
 {
     if (Connection != null)
     {
         Connection.Dispose();
     }
     Connection = null;
 }
示例#2
0
 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;
 }
示例#3
0
 /// <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;
 }
示例#4
0
 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);
        }