Exemplo n.º 1
0
        public Item Create(BaseItem baseItem) 
        {
            Item item = null;

            foreach (IsOne isOne in itemFactoryItems.Keys)
                if (isOne(baseItem))
                    item = (Item)Activator.CreateInstance(itemFactoryItems[isOne]);

            if (item == null)
                if (baseItem is UpcomingTvFolder)
                {
                    item = new UpcomingTvFolderModel();
                } else
                if (baseItem is User)
                {
                    item = new UserItem();
                } else
                if (baseItem is Folder) {
                    item = new FolderModel();
                } else {
                    item = new Item();
                }
            item.Assign(baseItem);
            return item;
        }
        public Item Create(BaseItem baseItem)
        {
            Item item = null;

            foreach (IsOne isOne in itemFactoryItems.Keys)
            {
                if (isOne(baseItem))
                {
                    item = (Item)Activator.CreateInstance(itemFactoryItems[isOne]);
                }
            }

            if (item == null)
            {
                if (baseItem is UpcomingTvFolder)
                {
                    item = new UpcomingTvFolderModel();
                }
                else
                if (baseItem is User)
                {
                    item = new UserItem();
                }
                else
                if (baseItem is Folder)
                {
                    item = new FolderModel();
                }
                else
                {
                    item = new Item();
                }
            }
            item.Assign(baseItem);
            return(item);
        }