Esempio n. 1
0
        private void UpdateStickersAsync(TLArchivedStickers cachedStickers)
        {
            IsWorking = true;
            MTProtoService.GetArchivedStickersAsync(true, new TLLong(0), new TLInt(100),
                                                    result => BeginOnUIThread(() =>
            {
                Status    = result.Sets.Count > 0 ? string.Empty : AppResources.NoSetsHere;
                IsWorking = false;

                var archivedStickers = result;
                if (archivedStickers != null)
                {
                    _messagesStickerSets = archivedStickers.MessagesStickerSets;

                    Items.Clear();

                    cachedStickers = archivedStickers;
                    StateService.SaveArchivedStickersAsync(cachedStickers);

                    UpdateSets(archivedStickers);
                }
            }),
                                                    error => BeginOnUIThread(() =>
            {
                Status    = string.Empty;
                IsWorking = false;

                Execute.ShowDebugMessage("messages.getArchivedStickers error " + error);
            }));
        }
Esempio n. 2
0
        public void ForwardInAnimationComplete()
        {
            StateService.GetAllStickersAsync(cachedAllStickers => BeginOnUIThread(() =>
            {
                _allStickers = cachedAllStickers;

                var allStickers = _allStickers as TLAllStickers43;
                if (allStickers != null)
                {
                    UpdateShowStickersByEmojiSubtitle(allStickers.ShowStickersByEmoji);

                    UpdateSets(allStickers, () => UpdateAllStickersAsync(allStickers));
                    Status = string.Empty;
                }
                else
                {
                    UpdateAllStickersAsync(null);
                }
            }));

            StateService.GetFeaturedStickersAsync(cachedFeaturedStickers => BeginOnUIThread(() =>
            {
                if (cachedFeaturedStickers != null)
                {
                    UpdateFeaturedSetsString(cachedFeaturedStickers.Unread.Count);
                }

                _featuredStickers = cachedFeaturedStickers;

                var featuredStickersHash = _featuredStickers != null
                    ? _featuredStickers.HashValue
                    : new TLInt(0);

                MTProtoService.GetFeaturedStickersAsync(false, featuredStickersHash,
                                                        result => BeginOnUIThread(() =>
                {
                    var featuredStickers = result as TLFeaturedStickers;
                    if (featuredStickers != null)
                    {
                        if (_featuredStickers != null)
                        {
                            _featuredStickers.Unread = featuredStickers.Unread;
                        }
                        UpdateFeaturedSetsString(featuredStickers.Unread.Count);
                    }
                }),
                                                        error =>
                {
                    Execute.ShowDebugMessage("messages.getFeaturedStickers error " + error);
                });
            }));

            StateService.GetArchivedStickersAsync(cachedArchivedStickers => BeginOnUIThread(() =>
            {
                if (cachedArchivedStickers != null)
                {
                    UpdateArchivedSetsString(cachedArchivedStickers.Count.Value);
                }

                _archivedStickers = cachedArchivedStickers;

                MTProtoService.GetArchivedStickersAsync(false, new TLLong(0), new TLInt(0),
                                                        result => BeginOnUIThread(() =>
                {
                    UpdateArchivedSetsString(result.Count.Value);
                }),
                                                        error =>
                {
                    Execute.ShowDebugMessage("messages.getArchivedStickers error " + error);
                });
            }));
        }