public static void BuyStickersPack(StockItemHeader stockItemHeader, string referrer = "", Action successCallback = null, Action errorCallback = null)
        {
            StoreBuyProductParams buyParams = new StoreBuyProductParams(StoreProductType.stickers, stockItemHeader.ProductId)
            {
                StickerReferrer = referrer
            };
            FullscreenLoader loader = new FullscreenLoader();

            loader.Show(null, true);
            StoreService.Instance.BuyProduct(buyParams, (Action <BackendResult <StoreBuyProductResult, ResultCode> >)(result =>
            {
                loader.Hide(false);
                Action action = successCallback;
                if (action != null)
                {
                    action();
                }
                stockItemHeader.SetPurchasedState();
                EventAggregator.Current.Publish((object)new StickersPurchaseFunnelEvent(StickersPurchaseFunnelAction.success));
                EventAggregator.Current.Publish((object)new StickersPackPurchasedEvent(stockItemHeader));
            }), (Action <BackendResult <StorePurchaseResult, ResultCode> >)(result =>
            {
                loader.HiddenCallback = (Action <FullscreenLoaderHiddenEventArgs>)(args => StorePurchaseManager.HandleStorePurchaseError(result, errorCallback));
                loader.Hide(false);
            }));
        }
示例#2
0
        public static void Show(StockItemHeader stockItemHeader, string referrer)
        {
            StickersPackView stickersPackView = new StickersPackView();

            stickersPackView.Init(stockItemHeader, referrer);
            DialogService dialogService = new DialogService();

            dialogService.AnimationType      = DialogService.AnimationTypes.None;
            dialogService.AnimationTypeChild = DialogService.AnimationTypes.None;
            SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.Transparent);

            dialogService.BackgroundBrush = (Brush)solidColorBrush;
            int num1 = 0;

            dialogService.IsOverlayApplied = num1 != 0;
            int num2 = 0;

            dialogService.HideOnNavigation = num2 != 0;
            Action <Action> action = (Action <Action>)(callback => stickersPackView.AnimateHide(false, callback));

            dialogService.OnClosingAction    = action;
            StickersPackView._flyout         = dialogService;
            StickersPackView._flyout.Opened += (EventHandler)((sender, args) =>
            {
                stickersPackView.AnimateShow();
                EventAggregator.Current.Publish(new StickersPurchaseFunnelEvent(StickersPurchaseFunnelAction.sticker_page));
            });
            StickersPackView._flyout.Child = (FrameworkElement)stickersPackView;
            StickersPackView._flyout.Show(null);
        }
示例#3
0
        public List <SpriteListItemData> CreateSpriteListItemData()
        {
            List <SpriteListItemData> spriteListItemDataList1 = new List <SpriteListItemData>()
            {
                new SpriteListItemData()
                {
                    IsEmoji = true
                }
            };

            if (this.StickersList == null)
            {
                return(spriteListItemDataList1);
            }
            List <SpriteListItemData> spriteListItemDataList2 = spriteListItemDataList1;
            SpriteListItemData        spriteListItemData      = new SpriteListItemData();

            spriteListItemData.IsRecentStickers = true;
            StockItem stockItem1 = new StockItem();

            stockItem1.product = new StoreProduct()
            {
                stickers = this.RecentStickers
            };
            int             num             = 0;
            StockItemHeader stockItemHeader = new StockItemHeader(stockItem1, num != 0);

            spriteListItemData.StickerStockItemHeader = stockItemHeader;
            spriteListItemDataList2.Add(spriteListItemData);
            spriteListItemDataList1.AddRange(this.StickersList.Select <StockItem, SpriteListItemData>((Func <StockItem, SpriteListItemData>)(stockItem => new SpriteListItemData()
            {
                StickerStockItemHeader = new StockItemHeader(stockItem, false)
            })));
            return(spriteListItemDataList1);
        }
示例#4
0
 private void GridRoot_OnTap(object sender, System.Windows.Input.GestureEventArgs e)
 {
   if (!this.CurrentDataContext.IsStickersPack)
     return;
   StockItemHeader stickerStockItemHeader = this.CurrentDataContext.StickerStockItemHeader;
   if (stickerStockItemHeader == null || stickerStockItemHeader.IsPurchased)
     return;
   CurrentStickersPurchaseFunnelSource.Source = StickersPurchaseFunnelSource.keyboard;
   StickersPackView.Show(stickerStockItemHeader, "keyboard");
 }
        private void OnTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            StockItemHeader dataContext = base.DataContext as StockItemHeader;

            if (dataContext == null)
            {
                return;
            }
            CurrentStickersPurchaseFunnelSource.Source = StickersPurchaseFunnelSource.keyboard;
            StickersPackView.Show(dataContext, "store");
        }
示例#6
0
        private void OnTap(object sender, GestureEventArgs e)
        {
            StockItemHeader stockItemHeader = this.DataContext as StockItemHeader;

            if (stockItemHeader == null)
            {
                return;
            }
            CurrentStickersPurchaseFunnelSource.Source = StickersPurchaseFunnelSource.keyboard;
            StickersPackView.Show(stockItemHeader, "store");
        }
示例#7
0
        private void ButtonBuy_OnTap(object sender, GestureEventArgs e)
        {
            e.Handled = true;
            StockItemHeader viewModel = this.ViewModel;

            if (viewModel == null)
            {
                return;
            }
            StorePurchaseManager.BuyStickersPack(viewModel, this.Referrer, null, null);
        }
示例#8
0
        private void Activate_OnTap(object sender, GestureEventArgs e)
        {
            FrameworkElement frameworkElement = sender as FrameworkElement;
            StockItemHeader  stockItemHeader  = (frameworkElement != null ? frameworkElement.DataContext : null) as StockItemHeader;

            if (stockItemHeader == null)
            {
                return;
            }
            this._viewModel.Activate(stockItemHeader);
        }
示例#9
0
        public void Handle(StickersPackPurchasedEvent message)
        {
            StockItemHeader stockItemHeader = message.StockItemHeader;

            this.InsertStickers(0, stockItemHeader.StockItem);
            EventAggregator.Current.Publish(new StickersSettings.StickersKeyboardOpenRequestEvent(stockItemHeader));
            if (!message.IsGift)
            {
                return;
            }
            this.HasStickersUpdates = true;
        }
示例#10
0
        private void Add_OnTap(object sender, GestureEventArgs e)
        {
            e.Handled = true;
            StockItemHeader viewModel = this.ViewModel;

            if (viewModel == null || this._isActivating)
            {
                return;
            }
            this._isActivating = true;
            StorePurchaseManager.ActivateStickersPack(viewModel, (Action <bool>)(activated => Execute.ExecuteOnUIThread((Action)(() => this._isActivating = false))));
        }
示例#11
0
        private void ButtonPurchase_OnTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            e.Handled = true;
            StockItemHeader dataContext = base.DataContext as StockItemHeader;

            if (dataContext == null)
            {
                return;
            }
            CurrentStickersPurchaseFunnelSource.Source = StickersPurchaseFunnelSource.keyboard;
            StorePurchaseManager.BuyStickersPack(dataContext, "keyboard", null, null);
        }
示例#12
0
        private void ButtonPurchase_OnTap(object sender, GestureEventArgs e)
        {
            e.Handled = true;
            StockItemHeader stockItemHeader = this.DataContext as StockItemHeader;

            if (stockItemHeader == null)
            {
                return;
            }
            CurrentStickersPurchaseFunnelSource.Source = StickersPurchaseFunnelSource.keyboard;
            StorePurchaseManager.BuyStickersPack(stockItemHeader, "keyboard", null, null);
        }
示例#13
0
        public void Handle(GiftSentEvent message)
        {
            StockItemHeader stockItemHeader = this._stockItemHeader;
            int?            nullable1       = stockItemHeader != null ? new int?(stockItemHeader.ProductId) : new int?();
            long?           nullable2       = nullable1.HasValue ? new long?(nullable1.GetValueOrDefault()) : new long?();
            long            num             = -message.GiftId;

            if ((nullable2.GetValueOrDefault() == num ? (!nullable2.HasValue ? 1 : 0) : 1) != 0)
            {
                return;
            }
            Execute.ExecuteOnUIThread((Action)(() => this.Hide(false)));
        }
示例#14
0
        public void Handle(StickersPackActivatedDeactivatedEvent message)
        {
            int             productId       = message.StockItemHeader.ProductId;
            StockItemHeader stockItemHeader = this._stockItemHeader;
            int?            nullable        = stockItemHeader != null ? new int?(stockItemHeader.ProductId) : new int?();
            int             valueOrDefault  = nullable.GetValueOrDefault();

            if ((productId == valueOrDefault ? (nullable.HasValue ? 1 : 0) : 0) == 0)
            {
                return;
            }
            this.HideWithDelay();
        }
示例#15
0
        public void Handle(StickersPackActivatedDeactivatedEvent message)
        {
            int             productId       = message.StockItemHeader.ProductId;
            StockItemHeader stockItemHeader = this._stockItemHeader;
            int?            nullable        = stockItemHeader != null ? new int?(stockItemHeader.ProductId) : new int?();
            int             valueOrDefault  = nullable.GetValueOrDefault();

            if ((productId == valueOrDefault ? (nullable.HasValue ? 1 : 0) : 0) == 0)
            {
                return;
            }
            new DelayedExecutor(800).AddToDelayedExecution((Action)(() => Execute.ExecuteOnUIThread((Action)(() => this.Hide(false)))));
        }
示例#16
0
        private void Init(StockItemHeader stockItemHeader, string referrer)
        {
            this._stockItemHeader = stockItemHeader;
            this.DataContext      = (object)this._stockItemHeader;
            if (!string.IsNullOrEmpty(referrer))
            {
                this.ucStickersPackInfo.Referrer = referrer;
            }
            string description = this._stockItemHeader.Description;

            if (!string.IsNullOrEmpty(description))
            {
                this.textBlockDescription.Visibility = Visibility.Visible;
                this.textBlockDescription.Text       = description;
            }
            this._currentPage = (PhoneApplicationPage)FramePageUtils.CurrentPage;
            Content content = Application.Current.Host.Content;

            this._pageHeightPortrait  = content.ActualHeight;
            this._pageHeightLandscape = content.ActualWidth;
            this._height = 0.0;
            this._height = this._height + this.gridSlideView.Height;
            double    num1    = this._height;
            double    num2    = this.ucStickersPackInfo.Height + this.ucStickersPackInfo.Margin.Top;
            Thickness margin  = this.ucStickersPackInfo.Margin;
            double    bottom1 = margin.Bottom;
            double    num3    = num2 + bottom1;

            this._height = num1 + num3;
            double num4         = this._height;
            double actualHeight = this.textBlockDescription.ActualHeight;

            margin = this.textBlockDescription.Margin;
            double top  = margin.Top;
            double num5 = actualHeight + top;

            margin = this.textBlockDescription.Margin;
            double bottom2 = margin.Bottom;
            double num6    = num5 + bottom2;

            this._height = num4 + num6;
            this._height = Math.Round(this._height);
            this._contentMarginTopPortrait  = Math.Round((this._pageHeightPortrait - this._height) / 2.0);
            this._contentMarginTopLandscape = Math.Round((this._pageHeightLandscape - this._height) / 2.0);
            this.UpdateValuesForOrientation();
            this.PrepareAnimations();
        }
示例#17
0
 private void OpenKeyboardOrPopup(StockItemHeader stockItemHeader)
 {
     Execute.ExecuteOnUIThread((Action)(() =>
     {
         if (this._parentPage != FramePageUtils.CurrentPage)
         {
             return;
         }
         if (base.IsHitTestVisible)
         {
             this.TryOpenStickersPackKeyboard((long)stockItemHeader.ProductId, 0);
         }
         else
         {
             CurrentStickersPurchaseFunnelSource.Source = StickersPurchaseFunnelSource.message;
             StickersPackView.Show(stockItemHeader, "message");
         }
     }));
 }
示例#18
0
 public static void DeactivateStickersPack(StockItemHeader stockItemHeader, Action <bool> callback = null)
 {
     StoreService.Instance.DeactivateProduct(stockItemHeader.ProductId, (Action <BackendResult <bool, ResultCode> >)(result =>
     {
         bool flag = result.ResultCode == ResultCode.Succeeded;
         if (flag)
         {
             stockItemHeader.IsActive = false;
             EventAggregator.Current.Publish((object)new StickersPackActivatedDeactivatedEvent(stockItemHeader, false));
         }
         else
         {
             GenericInfoUC.ShowBasedOnResult((int)result.ResultCode, "", (VKRequestsDispatcher.Error)null);
         }
         Action <bool> action = callback;
         if (action == null)
         {
             return;
         }
         int num = flag ? 1 : 0;
         action(num != 0);
     }));
 }
示例#19
0
        public List <SpriteListItemData> CreateSpriteListItemData()
        {
            List <SpriteListItemData> spriteListItemDataList1 = new List <SpriteListItemData>()
            {
                new SpriteListItemData()
                {
                    IsEmoji = true
                }
            };

            if (this.StickersList == null)
            {
                return(spriteListItemDataList1);
            }
            List <SpriteListItemData> spriteListItemDataList2 = spriteListItemDataList1;
            SpriteListItemData        spriteListItemData      = new SpriteListItemData();

            spriteListItemData.IsRecentStickers = true;
            StockItem stockItem1 = new StockItem();

            stockItem1.product = new StoreProduct()
            {
                stickers = this.RecentStickers
            };
            int             num1            = 0;
            long            userOrChatId    = 0;
            int             num2            = 0;
            StockItemHeader stockItemHeader = new StockItemHeader(stockItem1, num1 != 0, userOrChatId, num2 != 0);

            spriteListItemData.StickerStockItemHeader = stockItemHeader;
            spriteListItemDataList2.Add(spriteListItemData);
            spriteListItemDataList1.AddRange((IEnumerable <SpriteListItemData>)Enumerable.Select <StockItem, SpriteListItemData>(this.StickersList, (Func <StockItem, SpriteListItemData>)(stockItem => new SpriteListItemData()
            {
                StickerStockItemHeader = new StockItemHeader(stockItem, false, 0, false)
            })));
            return(spriteListItemDataList1);
        }
示例#20
0
        private void Init(StockItemHeader stockItemHeader, string referrer)
        {
            this._stockItemHeader = stockItemHeader;
            base.DataContext      = this._stockItemHeader;
            if (!string.IsNullOrEmpty(referrer))
            {
                this.ucStickersPackInfo.Referrer = referrer;
            }
            string description = this._stockItemHeader.Description;

            if (!string.IsNullOrEmpty(description))
            {
                ((UIElement)this.textBlockDescription).Visibility = Visibility.Visible;
                this.textBlockDescription.Text = description;
            }
            if (this._stockItemHeader.Price > 0 && (this._stockItemHeader.CanPurchaseFor || this._stockItemHeader.IsChat))
            {
                ((UIElement)this.gridSendAsAGift).Visibility = Visibility.Visible;
            }
            this._currentPage = (PhoneApplicationPage)FramePageUtils.CurrentPage;
            Content content = Application.Current.Host.Content;

            this._pageHeightPortrait  = content.ActualHeight;
            this._pageHeightLandscape = content.ActualWidth;
            this._height = 0.0;
            this._height = this._height + ((FrameworkElement)this.gridSlideView).Height;
            double    height1 = this._height;
            double    height2 = ((FrameworkElement)this.ucStickersPackInfo).Height;
            Thickness margin1 = ((FrameworkElement)this.ucStickersPackInfo).Margin;
            // ISSUE: explicit reference operation
            double    top1    = margin1.Top;
            double    num1    = height2 + top1;
            Thickness margin2 = ((FrameworkElement)this.ucStickersPackInfo).Margin;
            // ISSUE: explicit reference operation
            double bottom1 = ((Thickness)@margin2).Bottom;
            double num2    = num1 + bottom1;

            this._height = height1 + num2;
            double    height3      = this._height;
            double    actualHeight = ((FrameworkElement)this.textBlockDescription).ActualHeight;
            Thickness margin3      = ((FrameworkElement)this.textBlockDescription).Margin;
            // ISSUE: explicit reference operation
            double    top2    = ((Thickness)@margin3).Top;
            double    num3    = actualHeight + top2;
            Thickness margin4 = ((FrameworkElement)this.textBlockDescription).Margin;
            // ISSUE: explicit reference operation
            double bottom2 = ((Thickness)@margin4).Bottom;
            double num4    = num3 + bottom2;

            this._height = height3 + num4;
            if (((UIElement)this.gridSendAsAGift).Visibility == Visibility.Visible)
            {
                double    height4 = this._height;
                double    height5 = ((FrameworkElement)this.gridSendAsAGift).Height;
                Thickness margin5 = ((FrameworkElement)this.gridSendAsAGift).Margin;
                // ISSUE: explicit reference operation
                double    top3    = ((Thickness)@margin5).Top;
                double    num5    = height5 + top3;
                Thickness margin6 = ((FrameworkElement)this.gridSendAsAGift).Margin;
                // ISSUE: explicit reference operation
                double bottom3 = ((Thickness)@margin6).Bottom;
                double num6    = num5 + bottom3;
                this._height = height4 + num6;
            }
            this._height = Math.Round(this._height);
            this._contentMarginTopPortrait  = Math.Round((this._pageHeightPortrait - this._height) / 2.0);
            this._contentMarginTopLandscape = Math.Round((this._pageHeightLandscape - this._height) / 2.0);
            this.UpdateValuesForOrientation();
            this.PrepareAnimations();
        }
示例#21
0
 public StickersPackActivatedDeactivatedEvent(StockItemHeader stockItemHeader, bool isActive)
 {
     this.StockItemHeader = stockItemHeader;
     this.IsActive        = isActive;
 }
示例#22
0
 public StickersPackPurchasedEvent(StockItemHeader stockItemHeader)
 {
     this.StockItemHeader = stockItemHeader;
 }
示例#23
0
 public StickersUpdatedEvent(StockItemHeader stockItemHeader)
 {
     this.StockItemHeader = stockItemHeader;
 }
示例#24
0
 public StickersKeyboardOpenRequestEvent(StockItemHeader stockItemHeader)
 {
     this.StockItemHeader = stockItemHeader;
 }
示例#25
0
 public StickersItemTapEvent(StockItemHeader stockItemHeader)
 {
     this.StockItemHeader = stockItemHeader;
 }