Ejemplo n.º 1
0
        private ComponentState AttachAndInitComponent(IComponent component, int parentComponentId)
        {
            var componentId          = _nextComponentId++;
            var parentComponentState = GetOptionalComponentState(parentComponentId);
            var componentState       = new ComponentState(this, componentId, component, parentComponentState);

            Log.InitializingComponent(_logger, componentState, parentComponentState);
            _componentStateById.Add(componentId, componentState);
            component.Attach(new RenderHandle(this, componentId));
            return(componentState);
        }
Ejemplo n.º 2
0
 public void AddComponent(IComponent component)
 {
     if (component.IsAttached)
     {
         throw new InvalidOperationException(Strings.ComponentAttached);
     }
     if (this.Components.ContainsKey(component.Name))
     {
         throw new ArgumentException(Strings.DuplicateKey);
     }
     component.Attach(this);
     this.Components.Add(component.Name, component);
     this.UpdateSorting();
 }