コード例 #1
0
        //添加Session组件
        public bool AddNormalComponent(string componentName, object componentDataObject)
        {
            try
            {
                instance = GetContainer();

                NormalComponent _NormalComponent = new NormalComponent(componentName);

                if (instance.CurrentContainer.Components[componentName] != null) //暂无组件
                    instance.RemoveComponentByName(componentName);
                else
                    instance.RemoveComponentByInnerName(_NormalComponent.InnerName);

                _NormalComponent.ComponentDataObject = componentDataObject;
                instance.CurrentContainer.Add(_NormalComponent, _NormalComponent.InnerName);

                return true;
            }
            catch
            {
                return false;
            }
        }