public void Release() { foreach (Control child in Children) { if (child is DecoratorItem) { DecoratorItem item = child as DecoratorItem; item.BoundDecoratorlSelected -= item_BoundDecoratorlSelected; item.Release(); RemoveChild(item); } } m_target = null; }
public void UpdateDecoratorData(Control control) { foreach (Control child in Children) { if (child is DecoratorItem) { DecoratorItem item = child as DecoratorItem; item.BoundDecoratorlSelected -= item_BoundDecoratorlSelected; item.Release(); RemoveChild(item); } } int i = 0; int count = 0; Control c = (Control)Activator.CreateInstance(control.GetType()); int builtinDecorators = c.Decorators.Count; foreach (Decorator d in control.Decorators) { count++; if (count <= builtinDecorators) { continue; } DecoratorItem item = new DecoratorItem(d); AddChild(item); item.SetPosition(LEVEL_INDENT * (m_depth + 1), (i + 1) * LINE_HEIGHT); i++; item.BoundDecoratorlSelected += item_BoundDecoratorlSelected; } SetHeight((i + 1) * LINE_HEIGHT); }