public void SyncGroup(TLChannelFull channelFull)
        {
            SavedStickers.Remove(_groupSet);

            if (channelFull.HasStickerSet)
            {
                _groupSet.Set.Id = channelFull.Id;

                Execute.BeginOnThreadPool(() =>
                {
                    var result = _stickersService.GetGroupStickerSetById(channelFull.StickerSet);
                    if (result != null)
                    {
                        Execute.BeginOnUIThread(() =>
                        {
                            _groupSet.Documents = new TLVector <TLDocumentBase>(result.Documents);

                            if (_groupSet.Documents != null && _groupSet.Documents.Count > 0)
                            {
                                SavedStickers.Add(_groupSet);
                            }
                            else
                            {
                                SavedStickers.Remove(_groupSet);
                            }
                        });
                    }
                });
            }
        }
예제 #2
0
        public void SyncGroup(TLChannelFull channelFull)
        {
            SavedStickers.Remove(_groupSet);

            var update = true;

            var appData = ApplicationData.Current.LocalSettings.CreateContainer("Channels", ApplicationDataCreateDisposition.Always);

            if (appData.Values.TryGetValue("Stickers" + channelFull.Id, out object stickersObj))
            {
                var stickersId = (long)stickersObj;
                if (stickersId == channelFull.StickerSet?.Id)
                {
                    update = false;
                }
            }

            if (channelFull.HasStickerSet && update)
            {
                _groupSet.With = CacheService.GetChat(channelFull.Id) as TLChannel;
                _groupSet.Full = channelFull;

                Execute.BeginOnThreadPool(() =>
                {
                    var result = _stickersService.GetGroupStickerSetById(channelFull.StickerSet);
                    if (result != null)
                    {
                        Execute.BeginOnUIThread(() =>
                        {
                            _groupSet.Documents = new TLVector <TLDocumentBase>(result.Documents);

                            if (_groupSet.Documents != null && _groupSet.Documents.Count > 0)
                            {
                                SavedStickers.Add(_groupSet);
                            }
                            else
                            {
                                SavedStickers.Remove(_groupSet);
                            }
                        });
                    }
                });
            }
        }