Esempio n. 1
0
        /// <summary>
        /// Returns the active element belonging to the specified snippet element, or null if no such active element is found.
        /// </summary>
        public IActiveElement GetActiveElement(SnippetElement owner)
        {
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }
            IActiveElement element;

            if (elementMap.TryGetValue(owner, out element))
            {
                return(element);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Registers an active element. Elements should be registered during insertion and will be called back
 /// when insertion has completed.
 /// </summary>
 /// <param name="owner">The snippet element that created the active element.</param>
 /// <param name="element">The active element.</param>
 public void RegisterActiveElement(SnippetElement owner, IActiveElement element)
 {
     if (owner == null)
     {
         throw new ArgumentNullException("owner");
     }
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     if (currentStatus != Status.Insertion)
     {
         throw new InvalidOperationException();
     }
     elementMap.Add(owner, element);
     registeredElements.Add(element);
 }