//添加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;
			}
		}
Exemple #2
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);
            }
        }
		//得到指定组件名称的组件的数据捆绑对象
		public object GetNormalComponentDataObject(string componentName)
		{
			instance=GetContainer();
			NormalComponent _NormalComponent=new NormalComponent(componentName);
			if(instance.CurrentContainer.Components[_NormalComponent.InnerName]==null) //暂无组件
			{
				return null;
			}
			return ((NormalComponent) instance.CurrentContainer.Components[_NormalComponent.InnerName]).ComponentDataObject;
		}
Exemple #4
0
        //得到指定组件名称的组件的数据捆绑对象
        public object GetNormalComponentDataObject(string componentName)
        {
            instance = GetContainer();
            NormalComponent _NormalComponent = new NormalComponent(componentName);

            if (instance.CurrentContainer.Components[_NormalComponent.InnerName] == null)          //暂无组件
            {
                return(null);
            }
            return(((NormalComponent)instance.CurrentContainer.Components[_NormalComponent.InnerName]).ComponentDataObject);
        }
Exemple #5
0
 //移除掉指定名称的组件
 public void RemoveComponentByName(string componentName)
 {
     instance = GetContainer();
     foreach (IDiscuzNTComponent component in instance.CurrentContainer.Components)
     {
         if (component.ComponentName == componentName)
         {
             CurrentContainer.Remove(component);
         }
         break;
     }
 }
		public static DiscuzControlContainer GetContainer()
		{
			if (instance == null)
			{
				lock (syncRoot)
				{
					if (instance == null)
					{
						instance = new DiscuzControlContainer();
					}
				}
			}
			return instance;
		}
Exemple #7
0
 public static DiscuzControlContainer GetContainer()
 {
     if (instance == null)
     {
         lock (syncRoot)
         {
             if (instance == null)
             {
                 instance = new DiscuzControlContainer();
             }
         }
     }
     return(instance);
 }
Exemple #8
0
        //移除掉指定内部名称的组件
        public void RemoveComponentByInnerName(string componentName)
        {
            instance = GetContainer();
            NormalComponent _NormalComponent = new NormalComponent(componentName);

            foreach (IDiscuzNTComponent component in instance.CurrentContainer.Components)
            {
                if (component.InnerName == _NormalComponent.ComponentName)
                {
                    CurrentContainer.Remove(component);
                }
                break;
            }
        }
		//移除掉指定名称的组件
		public void RemoveComponentByName(string componentName)
		{
			instance=GetContainer();
			foreach(IDiscuzNTComponent component in instance.CurrentContainer.Components)
			{
				if(component.ComponentName==componentName)
				{
					CurrentContainer.Remove (component);
				}
				break;
			}
		}
		//移除掉指定内部名称的组件
		public void RemoveComponentByInnerName(string componentName)
		{
			instance=GetContainer();
			NormalComponent _NormalComponent=new NormalComponent(componentName);
			foreach(IDiscuzNTComponent component in instance.CurrentContainer.Components)
			{
				if(component.InnerName==_NormalComponent.ComponentName)
				{
					CurrentContainer.Remove (component);
				}
				break;
			}			
		}