Пример #1
0
        /// <summary>
        /// Method for disposing object references, only if all other references
        /// to this class have already been disposed.  This also disposes
        /// managed resources.
        /// </summary>
        /// <param name="disposing">
        /// Flag for indicating that this was called from the public <see cref="Dispose()"/>
        /// method, and thus we really do want to dispose this class reference.
        /// </param>
        private void Dispose(Boolean disposing)
        {
            if (_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (_refCount == 0)
                {
                    _instance    = null;
                    _initialized = false;
                    if (this._plugins != null)
                    {
                        foreach (AvailablePlugin p in this._plugins)
                        {
                            if ((p.Instance.IsInitialized) || (!p.Instance.IsDisposed))
                            {
                                p.Instance.Dispose();
                            }
                        }
                        this._plugins.Clear();
                        this._plugins = null;
                    }
                    _isDisposed = true;
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Initializes the plugin manager.
 /// </summary>
 public void Initialize()
 {
     if (_initialized)
     {
         return;
     }
     this._plugins = new AvailablePluginCollection();
     _initialized  = true;
 }
Пример #3
0
 /// <summary>
 /// Determines if the specified <b>AvailablePlugins</b> collection is
 /// null or empty.
 /// </summary>
 /// <param name="collection">
 /// The <b>AvailablePlugins</b> collection to check.
 /// </param>
 /// <returns>
 /// true if the specified collection is null or empty; Otherwise, false.
 /// </returns>
 public static Boolean IsNullOrEmpty(AvailablePluginCollection collection)
 {
     return((collection == null) || (collection.Count == 0));
 }