SDownload.Program.Dispose C# (CSharp) Method

Dispose() protected method

Disposes of the tray icon before disposing of itself
protected Dispose ( bool disposing ) : void
disposing bool
return void
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_listener != null)
                    _listener.Dispose();

                if (_trayIcon != null)
                    _trayIcon.Dispose();

                try
                {
                    if (_mutex != null)
                        _mutex.ReleaseMutex();
                } catch (ApplicationException)
                {
                    // Do nothing since the exception is due to attempting to release
                    // a mutex that we do not own
                }
            }

            base.Dispose(disposing);
        }