public void Register(IDocumentContainer container)
 {
     // Only one document container at a time
     if (_documentContainer != null)
     {
         _documentContainer.Unlisten(OnDocumentChanged);
     }
     _documentContainer = container;
     // A null container can be used to clear
     if (container == null)
     {
         _document = null;
     }
     else
     {
         _document = container.Document;
         container.Listen(OnDocumentChanged);
     }
     RefreshCache(_document);
 }
Beispiel #2
0
 public void Unlisten(IDocumentChangeListener listener)
 {
     lock (_documentChangedEventHandlers)
     {
         if (!_documentChangedEventHandlers.Remove(listener))
         {
             throw new ArgumentException(@"Listener not added");
         }
         if (_documentChangedEventHandlers.Count == 0)
         {
             var documentUiContainer = _documentContainer as IDocumentUIContainer;
             if (null == documentUiContainer)
             {
                 _documentContainer.Unlisten(DocumentChangedEventHandler);
             }
             else
             {
                 documentUiContainer.UnlistenUI(DocumentChangedEventHandler);
             }
         }
     }
 }
Beispiel #3
0
 public void Unregister(IDocumentContainer container)
 {
     container.Unlisten(OnDocumentChanged);
     container.RemoveBackgroundLoader(this);  // Useful information for enforcing orderly test shutdown
 }
 public void Unregister(IDocumentContainer container)
 {
     container.Unlisten(OnDocumentChanged);
 }
 public void Unregister(IDocumentContainer container)
 {
     container.Unlisten(OnDocumentChanged);
 }