internal void AddHighPriority(IContentHost host) { lock (_sync) { if (_manager == null) { throw new ObjectDisposedException("this"); } if (host == null) { throw new ArgumentNullException(); } if (_nullReferences.Count > 0) { WeakReference wr = _nullReferences.Pop(); wr.Target = host; _highPriorityItems.Add(wr); } else { _highPriorityItems.Add(new WeakReference(host)); } if (_created) { host.LoadContent(this, _manager); } ProcessDelayed(); } }
/// <summary> /// Register an <see cref = "IContentHost" /> instance with this content manager /// </summary> /// <param name = "host"></param> public void Add(IContentHost host) { if (Monitor.TryEnter(_sync)) { try { if (_manager == null) { throw new ObjectDisposedException("this"); } if (host == null) { throw new ArgumentNullException(); } if (_nullReferences.Count > 0) { WeakReference wr = _nullReferences.Pop(); wr.Target = host; _items.Add(wr); } else { _items.Add(new WeakReference(host)); } if (_created) { host.LoadContent(this, _manager); } } finally { Monitor.Exit(_sync); } } else { lock (_delayedAddList) _delayedAddList.Add(host); } }
internal void AddHighPriority(IContentHost host) { lock (_sync) { if (_manager == null) throw new ObjectDisposedException("this"); if (host == null) throw new ArgumentNullException(); if (_nullReferences.Count > 0) { WeakReference wr = _nullReferences.Pop(); wr.Target = host; _highPriorityItems.Add(wr); } else _highPriorityItems.Add(new WeakReference(host)); if (_created) host.LoadContent(this, _manager); ProcessDelayed(); } }
/// <summary> /// Register an <see cref = "IContentHost" /> instance with this content manager /// </summary> /// <param name = "host"></param> public void Add(IContentHost host) { if (Monitor.TryEnter(_sync)) { try { if (_manager == null) throw new ObjectDisposedException("this"); if (host == null) throw new ArgumentNullException(); if (_nullReferences.Count > 0) { WeakReference wr = _nullReferences.Pop(); wr.Target = host; _items.Add(wr); } else _items.Add(new WeakReference(host)); if (_created) host.LoadContent(this, _manager); } finally { Monitor.Exit(_sync); } } else { lock (_delayedAddList) _delayedAddList.Add(host); } }