Ejemplo n.º 1
0
 private void UpdateState(bool animate = false)
 {
     if (this.CurrentDataContext == null || this.CurrentDataContext.IsEmoji)
     {
         base.Visibility = Visibility.Collapsed;
     }
     else
     {
         StoreProduct stickerProduct = this.CurrentDataContext.StickerProduct;
         if (stickerProduct == null)
         {
             return;
         }
         if (BatchDownloadManager.IsDownloaded(stickerProduct.id.ToString()))
         {
             base.Visibility = Visibility.Collapsed;
         }
         else
         {
             base.Visibility = Visibility.Visible;
             int id = stickerProduct.id;
             if (BatchDownloadManager.IsDownloading(id.ToString()))
             {
                 ((UIElement)this.progressBar).Visibility = Visibility.Visible;
                 ((UIElement)this.ButtonDownload).Opacity = 0.0;
                 id = stickerProduct.id;
                 double to = BatchDownloadManager.DownloadProgress(id.ToString());
                 if (!animate)
                 {
                     ProgressBar progressBar = this.progressBar;
                     id = stickerProduct.id;
                     double num = BatchDownloadManager.DownloadProgress(id.ToString());
                     ((RangeBase)progressBar).Value = num;
                 }
                 else
                 {
                     ((DependencyObject)this.progressBar).Animate(((RangeBase)this.progressBar).Value, to, RangeBase.ValueProperty, 100, new int?(), null, null);
                 }
             }
             else
             {
                 ((UIElement)this.progressBar).Visibility = Visibility.Collapsed;
                 ((UIElement)this.ButtonDownload).Opacity = 1.0;
                 ((RangeBase)this.progressBar).Value      = 0.0;
             }
             Uri uriSource = VeryLowProfileImageLoader.GetUriSource(this.previewImage);
             if (uriSource == null || uriSource.OriginalString != stickerProduct.photo_140)
             {
                 VeryLowProfileImageLoader.SetUriSource(this.previewImage, stickerProduct.photo_140 == null ?  null : new Uri(stickerProduct.photo_140));
             }
             this.textBlockAuthor.Text = (stickerProduct.author ?? "");
             this.textBlockTitle.Text  = (stickerProduct.title ?? "");
             this.textBlockDesc.Text   = (stickerProduct.description ?? "");
         }
     }
 }