//���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 static DiscuzControlContainer GetContainer() { if (instance == null) { lock (syncRoot) { if (instance == null) { instance = new DiscuzControlContainer(); } } } return instance; }
//�Ƴ���ָ���ڲ����Ƶ���� 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 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; }