public async Task <int> InsertSticker(StickerResponse sticker)
 {
     using (var ds = new StickersDataSource())
     {
         return(await ds.StickersRepository.Create(sticker));
     }
 }
 public async Task RemoveSticker(StickerResponse sticker)
 {
     using (var ds = new StickersDataSource())
     {
         await ds.StickersRepository.Remove(sticker);
     }
 }
        private async void StickerGroup_OnClick(object sender, ItemClickEventArgs e)
        {
            var clickedItem = (StickerResponse)e.ClickedItem;

            _lastSelectedItem = clickedItem;
            await Locator.ViewModels.StickerListVm.GetStickers(clickedItem);

            if (AdaptiveStates.CurrentState == NarrowState)
            {
                // Use "drill in" transition for navigating from master list to detail view
                App.RootFrame.Navigate(typeof(StickerDetailSelectionPage), null, new DrillInNavigationTransitionInfo());
            }
            else
            {
                // Play a refresh animation when the user switches detail items.
                //EnableContentTransitions();
            }
        }
        public async Task GetStickers(StickerResponse stickerPack)
        {
            IsLoading = true;
            try
            {
                var manifestResult = await _stickerManager.GetStickerAndManifestPack(stickerPack.ManifestUrl);

                var resultCheck = await ResultChecker.CheckSuccess(manifestResult);

                if (!resultCheck)
                {
                    return;
                }
                var manifest = JsonConvert.DeserializeObject <StickerResponse>(manifestResult.ResultJson);
                var newList  = SizetypeConverter.ConvertStringToSizeProperty(manifestResult.ResultJson);
                if (newList.Any())
                {
                    StickerCollection = new ObservableCollection <StickerSelection>();
                    var stickerUrls = newList.First().Urls.ToList();
                    for (int index = 0; index < stickerUrls.Count; index++)
                    {
                        StickerCollection.Add(new StickerSelection()
                        {
                            Number      = index + 1,
                            ManifestUrl = stickerPack.ManifestUrl,
                            PackageId   = stickerPack.StickerPackageId,
                            Type        = stickerPack.Type,
                            ImageUrl    = stickerUrls[index]
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                // TODO: Throw error to user.
            }
            IsLoading = false;
        }