public void LoadSecureBrowserFavoriteList() { FavoriteList.Clear(); var favoriteList = PBData.GetFavorites(); if (favoriteList == null) { return; } foreach (var favorite in favoriteList) { FavoriteListItemViewModel item = new FavoriteListItemViewModel(this); item.Favorite = favorite; item.SiteImage = null; //force loading of favicon FavoriteList.Add(item); } if (favoriteList.Count == 0) { IsFavoriteListEmpty = true; } else { IsFavoriteListEmpty = false; } }
public void RemoveFromFavoriteListClick(object obj) { if (obj != null) { var favorite = PBData.GetFavorites().Where(x => x.Url == obj.ToString()).FirstOrDefault(); if (favorite != null) { this.PBData.RemoveFromFavorites(favorite); var tabItem = TabItemCollection.Where(x => x.SearchBar.Address == favorite.Url).FirstOrDefault(); if (tabItem != null) { tabItem.SearchBar.SetFavoriteIconVisibility(false); } } this.LoadSecureBrowserFavoriteList(); } }
public void OpenInCurrentTabClick(object obj) { if (obj != null) { var favorite = PBData.GetFavorites().Where(x => x.Url == obj.ToString()).FirstOrDefault(); if (favorite != null && this.SelectedTabItem != null) { this.SelectedTabItem.ShowOrHideFavoriteListClick(null); this.SelectedTabItem.WebBrowser.Navigate(favorite.Url); } else if (favorite != null) { TabItem defaultItem = new TabItem(this, resolver); defaultItem.SearchBar.Address = favorite.Url; TabItemCollection.Add(defaultItem); } } else { this.SelectedTabItem.ShowOrHideFavoriteListClick(null); } }