public DialogStickersViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator) : base(protoService, cacheService, settingsService, aggregator) { _favoriteSet = new StickerSetViewModel(new StickerSetInfo { Title = Strings.Resources.FavoriteStickers, Name = "tg/favedStickers" }); _recentSet = new StickerSetViewModel(new StickerSetInfo { Title = Strings.Resources.RecentStickers, Name = "tg/recentlyUsed" }); //_groupSet = new TLChannelStickerSet //{ // Set = new TLStickerSet // { // Title = Strings.Resources.GroupStickers, // ShortName = "tg/groupStickers", // }, //}; Aggregator.Subscribe(this); SavedGifs = new MvxObservableCollection <MosaicMediaRow>(); FeaturedStickers = new MvxObservableCollection <TLFeaturedStickerSet>(); SavedStickers = new StickerSetCollection(); //SyncStickers(); //SyncGifs(); InstallCommand = new RelayCommand <TLFeaturedStickerSet>(InstallExecute); }
public async void Update(IProtoService protoService, StickerSetViewModel stickerSet) { if (_loadToken != null) { _loadToken.Cancel(); } Title.Text = stickerSet.Title; List.ItemsSource = stickerSet.Stickers; if (stickerSet.IsLoaded) { return; } _loadToken = new CancellationTokenSource(); var token = _loadToken.Token; var response = await protoService.SendAsync(new GetStickerSet(stickerSet.Id)); if (response is StickerSet full) { stickerSet.Update(full); } if (token.IsCancellationRequested) { return; } //List.ItemsSource = null; //List.ItemsSource = stickerSet.Stickers; }