AspNetEdit.Editor.ComponentModel.DesignerHost.Reset C# (CSharp) Method

Reset() public method

public Reset ( ) : void
return void
        public void Reset()
        {
            //container automatically destroys all children when this happens
            if (rootComponent != null)
                DestroyComponent (rootComponent);

            if (activated) {
                OnDeactivated ();
                this.activated = false;
            }
        }

Usage Example

示例#1
0
        public void Remove(System.ComponentModel.IComponent component)
        {
            //safety checks
            if (component == null)
            {
                throw new ArgumentNullException("component");
            }
            if (component.Site == null || component.Site.Container != this)
            {
                throw new ArgumentException("Component is not sited in this container");
            }

            //broadcast start of removal process
            OnComponentRemoving(component);

            //clean up component and designer
            components.Remove(component);
            IDesigner designer = GetDesigner(component);

            if (designer != null)
            {
                designers.Remove(component);
                designer.Dispose();
            }
            component.Site = null;

            //if someone tries to kill root component, must destroy all children too
            if (component == host.RootComponent)
            {
                //clean everything up
                foreach (System.Web.UI.Control control in Components)
                {
                    host.DestroyComponent(control);
                }
                host.SetRootComponent(null);
                host.Reset();
            }

            //TODO: remove references from referenceManager

            //clean up selection service
            ISelectionService sel = (ISelectionService)this.GetService(typeof(ISelectionService));

            if (sel != null && sel.GetComponentSelected(component))
            {
                sel.SetSelectedComponents(new IComponent[] {});
            }

            //broadcast completion of removal process
            OnComponentRemoved(component);
        }