/// <summary>
 /// Фильтровать.
 /// </summary>
 /// <param name="board">Борда.</param>
 /// <param name="filter">Фильтр.</param>
 /// <returns>Результат.</returns>
 public static bool Filter(IBoardListBoardViewModel board, string filter)
 {
     if (string.IsNullOrWhiteSpace(filter))
     {
         return true;
     }
     filter = filter.Trim().ToLower();
     return (board?.Board ?? "").ToLower().Contains(filter) || (board?.DisplayName ?? "").ToLower().Contains(filter);
 }
 /// <summary>
 /// Добавить борду.
 /// </summary>
 /// <param name="board">Борда.</param>
 public async void Remove(IBoardListBoardViewModel board)
 {
     if (board?.Link == null)
     {
         return;
     }
     try
     {
         var store = ServiceLocator.Current.GetServiceOrThrow<IStorageService>();
         var oldData = await store.ThreadData.FavoriteBoards.LoadLinkCollection() as BoardLinkCollection ??
                       new BoardLinkCollection()
                       {
                           Links = new List<BoardLinkBase>(),
                           BoardInfo = new Dictionary<string, FavoriteBoardInfo>()
                       };
         var hashService = ServiceLocator.Current.GetServiceOrThrow<ILinkHashService>();
         var linkHash = hashService.GetLinkHash(board.Link);
         oldData.Links = oldData.Links.Where(l => !linkEqualityComparer.Equals(l, board.Link)).ToList();
         if (oldData.BoardInfo.ContainsKey(linkHash))
         {
             oldData.BoardInfo.Remove(linkHash);
         }
         oldData.Links.Sort(linkComparer);
         await store.ThreadData.FavoriteBoards.SaveLinkCollectionSync(oldData);
         if (cachedResult != null)
         {
             UpdateList(cachedResult, oldData);
         }
         else
         {
             refreshCommand.Start2(false);
         }
     }
     catch (Exception ex)
     {
         await AppHelpers.ShowError(ex);
     }
 }
 /// <summary>
 /// Добавить борду.
 /// </summary>
 /// <param name="board">Борда.</param>
 public async void Add(IBoardListBoardViewModel board)
 {
     if (board?.Link == null)
     {
         return;
     }
     try
     {
         var store = ServiceLocator.Current.GetServiceOrThrow<IStorageService>();
         var oldData = await store.ThreadData.FavoriteBoards.LoadLinkCollection() as BoardLinkCollection ??
                       new BoardLinkCollection()
                       {
                           Links = new List<BoardLinkBase>(),
                           BoardInfo = new Dictionary<string, FavoriteBoardInfo>()
                       };
         var hashService = ServiceLocator.Current.GetServiceOrThrow<ILinkHashService>();
         var linkSet = new HashSet<string>(oldData.Links.Where(l => l != null).Select(l => hashService.GetLinkHash(l)));
         var linkHash = hashService.GetLinkHash(board.Link);
         if (!linkSet.Contains(linkHash))
         {
             oldData.Links.Add(board.Link);
         }
         oldData.BoardInfo[linkHash] = new FavoriteBoardInfo()
         {
             DisplayName = board.DisplayName
         };
         oldData.Links.Sort(linkComparer);
         await store.ThreadData.FavoriteBoards.SaveLinkCollectionSync(oldData);
         if (cachedResult != null)
         {
             UpdateList(cachedResult, oldData);
         }
         else
         {
             refreshCommand.Start2(false);
         }
     }
     catch (Exception ex)
     {
         await AppHelpers.ShowError(ex);
     }
 }
 private bool DoFilter(IBoardListBoardViewModel obj)
 {
     if (obj == null)
     {
         return false;
     }
     return obj.Filter(Filter);
 }