// Token: 0x06007C6B RID: 31851 RVA: 0x0022FD94 File Offset: 0x0022DF94 public override void RemoveFromHost(IAnnotationComponent component, bool reorder) { if (component == null) { throw new ArgumentNullException("component"); } if (this.IsInternalComponent(component)) { this._annotationAdorner.AnnotationComponent.PresentationContext = null; this._adornerLayer.Remove(this._annotationAdorner); this._annotationAdorner.RemoveChildren(); this._annotationAdorner = null; return; } AnnotationAdorner annotationAdorner = this.FindAnnotationAdorner(component); if (annotationAdorner == null) { throw new InvalidOperationException(SR.Get("ComponentNotInPresentationContext", new object[] { component })); } this._adornerLayer.Remove(annotationAdorner); annotationAdorner.RemoveChildren(); AdornerPresentationContext adornerPresentationContext = component.PresentationContext as AdornerPresentationContext; if (adornerPresentationContext != null) { adornerPresentationContext.ResetInternalAnnotationAdorner(); } component.PresentationContext = null; }
/// <summary> /// Remove annotation component from host; in our case: respective annotation adorner from adornerLayer. /// If this presentation context does not contain the component search the adorner layer. /// Null out the presentation context of the component and set the local annotationAdorner to null if necessary, /// ask the annotation adorner to remove all visual children. /// </summary> /// <param name="component">Component to remove from host</param> /// <param name="reorder">if true - recalculate z-order</param> public override void RemoveFromHost(IAnnotationComponent component, bool reorder) { if (component == null) { throw new ArgumentNullException("component"); } if (IsInternalComponent(component)) { _annotationAdorner.AnnotationComponent.PresentationContext = null; _adornerLayer.Remove(_annotationAdorner); _annotationAdorner.RemoveChildren(); _annotationAdorner = null; } else {// need to find annotation adorner in layer, remove it and do house-keeping AnnotationAdorner foundAdorner = this.FindAnnotationAdorner(component); if (foundAdorner == null) { throw new InvalidOperationException(SR.Get(SRID.ComponentNotInPresentationContext, component)); } _adornerLayer.Remove(foundAdorner); foundAdorner.RemoveChildren(); // now get rid of reference from presentation context of annotation component to annotation adorner AdornerPresentationContext p = component.PresentationContext as AdornerPresentationContext; if (p != null) { p.ResetInternalAnnotationAdorner(); } // finally get rid of reference from annotation component to presentation context component.PresentationContext = null; } }