Exemplo n.º 1
0
        private void UpdateMasksAsync(TLAllStickers cachedMasks)
        {
            var hash = cachedMasks != null ? cachedMasks.Hash : TLString.Empty;

            IsWorking = true;
            MTProtoService.GetMaskStickersAsync(hash,
                                                result => BeginOnUIThread(() =>
            {
                Execute.ShowDebugMessage(result.ToString());

                Status    = string.Empty;
                IsWorking = false;

                var masks = result as TLAllStickers43;
                if (masks != null)
                {
                    Items.Clear();

                    var cachedMasks29 = cachedMasks as TLAllStickers29;
                    if (cachedMasks29 != null)
                    {
                        masks.ShowStickersTab = cachedMasks29.ShowStickersTab;
                        masks.RecentlyUsed    = cachedMasks29.RecentlyUsed;
                        masks.Date            = TLUtils.DateToUniversalTimeTLInt(0, DateTime.Now);
                    }
                    var cachedMasks43 = cachedMasks as TLAllStickers43;
                    if (cachedMasks43 != null)
                    {
                        masks.RecentStickers = cachedMasks43.RecentStickers;
                    }

                    cachedMasks = masks;
                    StateService.SaveMasksAsync(cachedMasks);

                    UpdateSets(masks, () => { });
                }
            }),
                                                error => BeginOnUIThread(() =>
            {
                Status    = string.Empty;
                IsWorking = false;
                Execute.ShowDebugMessage("messages.getMaskStickers error " + error);
            }));
        }