public virtual void RemoveChild(SupportContainer child) { if (child.Parent == this) { child.Parent = null; } }
public virtual void RemoveChild(SupportContainer child) { if (child.Parent == this) { child.Parent = null; } }
public void addContainer_throws_if_containers_are_nested() { SupportContainer container1 = new SupportContainer(); SupportContainer container2 = new SupportContainer(); container1.AddChild(container2); viewManager.AddContainer(container1); viewManager.AddContainer(container2); }
public void before() { container = new SupportContainer (); registry = new ContainerRegistry(); registry.SetParentFinder (new SupportParentFinder ()); viewManager = new ViewManager(registry); ViewNotifier.SetRegistry (registry); }
public override void AddChild(SupportContainer child) { base.AddChild(child); if (child is SupportView) { (child as SupportView).AddThisView(); } }
public object FindParent(object childView, IEnumerable <ContainerBinding> containerBindings) { SupportContainer supportView = childView as SupportContainer; while (supportView != null && supportView.Parent != null) { foreach (ContainerBinding containerBinding in containerBindings) { if (containerBinding.Container == supportView.Parent) { return(containerBinding.Container); } } supportView = supportView.Parent; } return(null); }
public bool Contains(object parentContainer, object childContainer) { SupportContainer parentSupport = parentContainer as SupportContainer; SupportContainer childSupport = childContainer as SupportContainer; if (parentSupport == null || childContainer == null) { return(false); } while (childSupport != null) { if (childSupport.Parent == parentSupport) { return(true); } childSupport = childSupport.Parent; } return(false); }
public virtual void AddChild(SupportContainer child) { _childCount++; child.Parent = this; }
public void adding_two_fallbacks_should_remove_previous() { SupportContainer fallback1 = new SupportContainer (); SupportContainer fallback2 = new SupportContainer (); registry.SetFallbackContainer (fallback1); registry.SetFallbackContainer (fallback2); Assert.That (registry.FallbackBinding.Container, Is.EqualTo (fallback2)); }
public void before() { registry = new ContainerRegistry(); registry.SetParentFinder (new SupportParentFinder()); container = new SupportContainer(); }
public void adding_and_removing_fallback_puts_back_old_handlers() { int callCount = 0; viewManager.AddViewHandler(new CallbackViewHandler(delegate(object view, Type type) { callCount++; })); SupportContainer newContainer = new SupportContainer (); viewManager.SetFallbackContainer(new object()); viewManager.RemoveFallbackContainer (); newContainer.AddChild(new SupportView()); Assert.That (callCount, Is.EqualTo (0)); }
public void fallback_handles_when_container_is_not_parent() { int callCount = 0; viewManager.AddViewHandler(new CallbackViewHandler(delegate(object view, Type type) { callCount++; })); viewManager.SetFallbackContainer(new object()); SupportContainer newContainer = new SupportContainer (); newContainer.AddChild(new SupportView()); Assert.That (callCount, Is.EqualTo (1)); }
public virtual void AddChild(SupportContainer child) { _childCount++; child.Parent = this; }
public override void AddChild(SupportContainer child) { base.AddChild (child); if (child is SupportView) (child as SupportView).AddThisView(); }
public void before() { context = new Context(); view = new SupportView(); }