Exemple #1
0
 private void RefreshIcons(int page = 1)
 {
     IsLoading = true;
     Task.Run(() =>
     {
         try
         {
             var res = _iconService.GetList(SearchText, FromType, ColorType, Tag, page);
             if (res.IsSuccess)
             {
                 App.UIDispatcher.Invoke(() =>
                 {
                     Count = res.Data.Count;
                     Items.Clear();
                     foreach (var icon in res.Data.Icons)
                     {
                         Items.Add(new IconItemViewModel()
                         {
                             Id           = icon.Id,
                             Name         = icon.Name,
                             PrototypeSvg = icon.Prototype_svg,
                             IsCollected  = IconCarts.Any(x => x.Id == icon.Id),
                             IsFavorite   = MyCollection.Any(x => x.Id == icon.Id),
                             Origin_file  = icon.Origin_file,
                         });
                     }
                     ;
                     Page = page;
                 });
             }
         }
         finally
         {
             App.UIDispatcher.Invoke(() =>
             {
                 IsLoading = false;
             });
         }
     });
 }