public void LoadRecommendedSites()
        {
            HomepageItems.Clear();
            var recommendedSites = PBData.GetRecommendedSites();

            if (recommendedSites != null)
            {
                foreach (var site in recommendedSites)
                {
                    HomepageItems.Add(new SecureBrowserItem(site));
                }
            }

            HomepageModel = new PageableViewModel <SecureItem>(HomepageItems);
        }
        public void LoadRecentlyUsedItems()
        {
            HomepageItems.Clear();

            var recentlyUsedItemList = PBData.GetSecureItemsByItemType(SecurityItemsDefaultProperties.SecurityItemType_PasswordVault, SecureItemOrderEnum.LastAccess);

            foreach (var item in recentlyUsedItemList)
            {
                HomepageItems.Add(new SecureBrowserItem(item));
                if (HomepageItems.Count() == 24)
                {
                    break;
                }
            }
            HomepageModel = new PageableViewModel <SecureItem>(HomepageItems);
        }
        public void LoadFavoriteItems()
        {
            HomepageItems.Clear();
            var favoriteSecureItemsList = PBData.GetSecureItemsByItemType(SecurityItemsDefaultProperties.SecurityItemType_PasswordVault).Where(x => x.Favorite).ToList();

            if (favoriteSecureItemsList.Count == 0)
            {
                LoadRecentlyUsedItems();
            }
            foreach (var favoriteItem in favoriteSecureItemsList)
            {
                HomepageItems.Add(new SecureBrowserItem(favoriteItem));
                if (HomepageItems.Count() == 24)
                {
                    break;
                }
            }
            HomepageModel = new PageableViewModel <SecureItem>(HomepageItems);
        }
        public SecureBrowserViewModel(IResolver resolver)
        {
            this.resolver    = resolver;
            PBData           = resolver.GetInstanceOf <IPBData>();
            PBWebAPI         = resolver.GetInstanceOf <IPBWebAPI>();
            FavoriteList     = new ObservableCollection <FavoriteListItemViewModel>();
            HomepageItemList = new ObservableCollection <HomepageItem>();

            HomepageItems = new ObservableCollection <SecureItem>();
            HomepageModel = new PageableViewModel <SecureItem>(HomepageItems);



            //HomepageFavoriteItems = new ObservableCollection<SecureItem>();
            //HomepageFavoriteModel = new PageableViewModel<SecureItem>(HomepageFavoriteItems);

            //HomepageRecentlyUsedItems = new ObservableCollection<SecureItem>();
            //HomepageRecentlyUsedModel = new PageableViewModel<SecureItem>(HomepageRecentlyUsedItems);

            //HomepageMostUsedItems = new ObservableCollection<SecureItem>();
            //HomepageMostUsedModel = new PageableViewModel<SecureItem>(HomepageMostUsedItems);
            TabItemCollection = new ObservableCollection <TabItem>();
            //->
            LoadSecureBrowserFavoriteList();

            InitialHomePageItemsLoad();

            _portManager = new PortManager(TabItemCollection, resolver);

            TabItem defaultItem = new TabItem(this, resolver);

            defaultItem.HideAllHompageContainerItems();
            defaultItem.NewTabButtonVisibility = true;


            //var startPage = PBData.GetPrivateSetting(DefaultProperties.Settings_StartPageUrl);
            //if(!string.IsNullOrWhiteSpace(startPage))
            //{
            //    //vedo - async
            //    System.Threading.Tasks.Task.Factory.StartNew(() =>
            //    {
            //        Application.Current.Dispatcher.BeginInvoke((Action)(() =>
            //        {
            //            defaultItem.SearchBar.Address = startPage;
            //        }));
            //    });
            //}
            //defaultItem.SearchBar.Address = "http://www.linkedin.com";
            TabItemCollection.Add(defaultItem);

            //<--

            RemoveFromFavoriteListCommand       = new RelayCommand(RemoveFromFavoriteListClick);
            OpenInCurrentTabCommand             = new RelayCommand(OpenInCurrentTabClick);
            SecureBrowserfavoriteListVisibility = false;

            InitializeCommands();

            /*
             * LoadFavoriteList();
             * LoadHomepageItemList();
             *
             * RemoveFromFavoriteListCommand = new RelayCommand(RemoveFromFavoriteListClick);
             * OpenInCurrentTabCommand = new RelayCommand(OpenInCurrentTabClick);
             *
             * TabItemCollection = new ObservableCollection<TabItem>();
             * _portManager = new PortManager(TabItemCollection, resolver);
             *
             * TabItem defaultItem = new TabItem(this, resolver);
             *
             * var startPage = PBData.GetPrivateSetting(DefaultProperties.Settings_StartPageUrl);
             * if(!string.IsNullOrWhiteSpace(startPage))
             * {
             *  defaultItem.SearchBar.Address = startPage;
             * }
             * //defaultItem.SearchBar.Address = "http://www.linkedin.com";
             * TabItemCollection.Add(defaultItem);
             *
             * //TabItem ln = new TabItem(TabItemCollection);
             * //ln.SearchBar.Address = "link";
             * //TabItemCollection.Add(ln);
             * //SelectedTabItem = defaultItem;
             *
             * //TabItem newTab = new TabItem(this);
             * //TabItemCollection.Add(newTab);
             * SecureBrowserfavoriteListVisibility = false;
             *
             * InitializeCommands();
             */

            _pbExtSecureBrowserBridge = resolver.GetInstanceOf <IPBExtSecureBrowserBridge>();
        }