Microsoft.WindowsAzure.CAT.ServiceBusExplorer.ListenerControl.Dispose C# (CSharp) Method

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }

                if (blockingCollection != null)
                {
                    blockingCollection.Dispose();
                }

                if (messageCollection != null)
                {
                    messageCollection.Dispose();
                }

                if (cancellationTokenSource != null)
                {
                    cancellationTokenSource.Dispose();
                }

                if (receiverBrokeredMessageInspector != null)
                {
                    var disposable = receiverBrokeredMessageInspector as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }

                if (queueClient != null)
                {
                    queueClient.Close();
                }

                if (subscriptionClient != null)
                {
                    subscriptionClient.Close();
                }

                for (var i = 0; i < Controls.Count; i++)
                {
                    Controls[i].Dispose();
                }


                this.logStopped = true;

                base.Dispose(disposing);
            }
            // ReSharper disable once EmptyGeneralCatchClause
            catch
            {
            }
        }
ListenerControl