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); }
public void Listen(IDocumentChangeListener listener) { lock (_documentChangedEventHandlers) { bool firstListener = _documentChangedEventHandlers.Count == 0; if (!_documentChangedEventHandlers.Add(listener)) { throw new ArgumentException(@"Listener already added"); } if (firstListener) { var documentUiContainer = _documentContainer as IDocumentUIContainer; if (null == documentUiContainer) { _documentContainer.Listen(DocumentChangedEventHandler); } else { documentUiContainer.ListenUI(DocumentChangedEventHandler); } } } }
public void Register(IDocumentContainer container) { container.Listen(OnDocumentChanged); container.AddBackgroundLoader(this); // Useful information for enforcing orderly test shutdown }
public void Register(IDocumentContainer container) { container.Listen(OnDocumentChanged); }
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); }