/// <summary>
 /// Kills all the threads, disposes of internal objects, unregisters devices and disposes all the panels.
 /// Can be used to teardown all the touchpanel logic at once, instead of manually calling dispose on all
 /// the touchpanels.
 /// </summary>
 public void Dispose()
 {
     Disposed = true;
     StopThreads();
     panelProcessingQueue.Dispose();
     DisposeChildren();
     UnRegister();
     foreach (var p in panels)
     {
         p.Dispose();
     }
 }
Пример #2
0
        /// <summary>
        /// Cleans up all resources.
        /// </summary>
        public static void Dispose()
        {
            if (IsInitialized)
            {
                client.Disconnect();
                commandQueue.Dispose();
                commandQueueTimer.Stop();
                commandQueueTimer.Dispose();

                if (!heartbeatTimer.Disposed)
                {
                    heartbeatTimer.Stop();
                    heartbeatTimer.Dispose();
                }

                isDisposed = true;
            }
        }
Пример #3
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            if (client.IsConnected)
            {
                client.Disconnect();
            }

            if (disposing)
            {
                // Free managed resources
                comStream.Dispose();
                client.Dispose();
                cmdQueue.Dispose();
            }
            disposed = true;
        }
Пример #4
0
        private void Dispose(bool disposing)
        {
            _disposed = true;
            if (disposing)
            {
                _queueAddEvent.Set();
                _queueReturnEvent.Set();

                if (CleanupPoolOnDispose && typeof(IDisposable).IsAssignableFrom(typeof(T)))
                {
                    while (!_objectPool.IsEmpty)
                    {
                        ((IDisposable)_objectPool.Dequeue()).Dispose();
                    }
                }

                _objectPool.Dispose();
                _queueAddEvent.Dispose();
                _queueReturnEvent.Dispose();
                _disposeLock.Dispose();
            }
        }