Exemplo 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(nameof(owner));
     }
     return(_elementMap.TryGetValue(owner, out var element) ? element : null);
 }
Exemplo 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(nameof(owner));
     }
     if (element == null)
     {
         throw new ArgumentNullException(nameof(element));
     }
     if (_currentStatus != Status.Insertion)
     {
         throw new InvalidOperationException();
     }
     _elementMap.Add(owner, element);
     _registeredElements.Add(element);
 }