Пример #1
0
        public override void UpdateItems()
        {
            // evaluate immediate to allow sql connections to close
            places  = LoadPlaceItems().ToArray();
            folders = LoadFolderItems().ToArray();

            items.Clear();

            items.Add(new BrowseHistoryItem());
            items.Add(new BrowseBookmarkItem());

            items.AddRange(folders.OfType <Item> ());
            items.AddRange(PlacesWithParent.OfType <Item> ());
        }
Пример #2
0
        public override IEnumerable <Item> ChildrenOfItem(Item item)
        {
            if (IsFirefox(item))
            {
                yield return(new BrowseHistoryItem());

                yield return(new BrowseBookmarkItem());
            }
            else if (item is BrowseBookmarkItem || item is BrowseHistoryItem)
            {
                foreach (FolderItem folder in folders)
                {
                    yield return(folder);
                }

                if (item is BrowseBookmarkItem)
                {
                    foreach (PlaceItem place in PlacesWithParent)
                    {
                        yield return(place);
                    }
                }
                else
                {
                    foreach (PlaceItem place in places)
                    {
                        yield return(place);
                    }
                }
            }
            else if (item is FolderItem)
            {
                FolderItem parent = (FolderItem)item;

                foreach (FolderItem folder in folders.Where(folder => folder.ParentId == parent.Id))
                {
                    yield return(folder);
                }

                foreach (PlaceItem place in PlacesWithParent.Where(place => place.ParentId == parent.Id))
                {
                    yield return(place);
                }
            }
        }