Esempio n. 1
0
        /// <summary>
        /// Removes the component of specified media type (if registered).
        /// It calls the dispose method of the media component too.
        /// </summary>
        /// <param name="mediaType">Type of the media.</param>
        public void Remove(MediaType mediaType)
        {
            lock (SyncLock)
            {
                if (Items.ContainsKey(mediaType) == false)
                {
                    return;
                }

                try
                {
                    var component = Items[mediaType];
                    Items.Remove(mediaType);
                    component.Dispose();
                }
                catch
                { }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Removes the component of specified media type (if registered).
        /// It calls the dispose method of the media component too.
        /// </summary>
        /// <param name="mediaType">Type of the media.</param>
        internal void RemoveComponent(MediaType mediaType)
        {
            lock (SyncLock)
            {
                if (Items.ContainsKey(mediaType) == false) return;

                try
                {
                    var component = Items[mediaType];
                    Items.Remove(mediaType);
                    component.Dispose();
                }
                catch
                { }
                finally
                {
                    CachedComponents = null;
                    ComputeMainComponent();
                }
            }
        }