示例#1
0
文件: Manager.cs 项目: t1b1c/lwas
        public ISymbolWebPart NewSymbolWebPart()
        {
            string type = ConfigurationManager.AppSettings["SYMBOL"];

            if (null == type)
            {
                throw new ManagerException("Default webpart symbol not set in config");
            }

            Type driverType = Type.GetType(type, false);

            if (null == driverType)
            {
                throw new ManagerException("Default webpart symbol could not be loaded");
            }

            ISymbolWebPart symbol = (Activator.CreateInstance(driverType) as ISymbolWebPart);

            if (null == symbol)
            {
                throw new ManagerException("Default webpart symbol specified in config is not an ISymbolWebPart");
            }

            return(symbol);
        }
示例#2
0
        protected virtual WebPart CreateEmptyWebPart()
        {
            Manager        manager = (Manager)this.WebPartManager;
            ISymbolWebPart swp     = manager.NewSymbolWebPart();

            swp.Title    = "empty";
            swp.SymbolOf = swp.GetType().AssemblyQualifiedName;

            return(swp as WebPart);
        }