Beispiel #1
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        /// <remarks>
        /// If the main class was marked as sealed, we could just make this a private void Dispose(bool).  Alternatively, we could (in this case) put
        /// all of our logic directly in Dispose().
        /// </remarks>
        public virtual void Dispose(bool disposing)
        {
            // Use our disposed flag to allow us to call this method multiple times safely.
            // This is a requirement when implementing IDisposable.
            if (!this.disposed)
            {
                if (disposing)
                {
                    // If we have any managed, IDisposable resources, Dispose of them here.
                    // In this case, we don't, so this was unneeded.
                    // Later, we will subclass this class, and use this section.
                    if (OcrEngine != null)
                    {
                        OcrEngine.Dispose();
                        OcrEngine = null;
                    }
                }

                // Always dispose of undisposed unmanaged resources in Dispose(bool).
            }
            // Mark us as disposed, to prevent multiple calls to dispose from having an effect,
            // and to allow us to handle ObjectDisposedException.
            this.disposed = true;
        }
 public void Dispose()
 {
     _engine.Dispose();
 }