public static void BuyVotesPack(VotesPack votesPack, BalanceTopupSource source, Action successCallback = null, Action errorCallback = null) { FullscreenLoader loader = new FullscreenLoader(); loader.Show(null, true); EventAggregator.Current.Publish((object)new BalanceTopupEvent(source, BalanceTopupAction.purchase_click)); StoreService.Instance.PurchaseVotesPack(votesPack, (Action)(() => { EventAggregator.Current.Publish((object)new BalanceTopupEvent(source, BalanceTopupAction.success)); StorePurchaseManager.UpdateBalanceData((Action)(() => { loader.Hide(false); Action action = successCallback; if (action == null) { return; } action(); })); }), (Action <BackendResult <StorePurchaseResult, ResultCode> >)(result => { loader.HiddenCallback = (Action <FullscreenLoaderHiddenEventArgs>)(args => StorePurchaseManager.HandleStorePurchaseError(result, errorCallback)); loader.Hide(false); }), (Action)(() => loader.Hide(false))); }
private static void ShowWithLoader(string referrer, Action <Action <BackendResult <StockItem, ResultCode> >, CancellationToken> loadAction, long userOrChatId = 0, bool isChat = false) { CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); FullscreenLoader fullscreenLoader = new FullscreenLoader(); fullscreenLoader.HideOnBackKeyPress = true; Action <FullscreenLoaderHiddenEventArgs> action = (Action <FullscreenLoaderHiddenEventArgs>)(args => cancellationTokenSource.Cancel()); fullscreenLoader.HiddenCallback = action; FullscreenLoader loader = fullscreenLoader; loader.Show(null, true); loadAction((Action <BackendResult <StockItem, ResultCode> >)(result => { loader.Hide(false); if (result.ResultCode == ResultCode.Succeeded) { Execute.ExecuteOnUIThread((Action)(() => StickersPackView.Show(result.ResultData, referrer, userOrChatId, isChat))); } else { GenericInfoUC.ShowBasedOnResult((int)result.ResultCode, "", (VKRequestsDispatcher.Error)null); } }), cancellationTokenSource.Token); }
public void CancelTransfer(Action callback = null) { FullscreenLoader loader = new FullscreenLoader(); loader.Show(null, true); MoneyTransfersService.DeclineTransfer(this.Transfer.id, (Action <BackendResult <int, ResultCode> >)(result => { loader.Hide(false); ResultCode resultCode = result.ResultCode; if (resultCode == ResultCode.Succeeded) { this.Transfer.status = 2; EventAggregator.Current.Publish(new MoneyTransferDeclinedEvent(this.Transfer)); Action action = callback; if (action == null) { return; } action.Invoke(); } else { GenericInfoUC.ShowBasedOnResult(resultCode, "", (VKRequestsDispatcher.Error)null); } })); }
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); })); }
public BackendNotEnoughMoneyHandler() { this._loader = new FullscreenLoader() { HideOnBackKeyPress = true }; EventAggregator.Current.Subscribe((object)this); }
private void HidePreview() { if (this._ucPreview == null) { return; } this._loader.Hide(false); this._loader = null; this._ucPreview = null; }
private void HidePreview() { if (this._ucPreview == null) { return; } this._loader.Hide(false); this._loader = (FullscreenLoader)null; this._ucPreview = (PreviewImageUC)null; }
private void SendAsAGift_OnTap(object sender, System.Windows.Input.GestureEventArgs e) { if (this._stockItemHeader == null) { return; } EventAggregator.Current.Publish(new GiftsPurchaseStepsEvent(GiftPurchaseStepsSource.stickers_present, GiftPurchaseStepsAction.store)); EventAggregator.Current.Publish(new StickersPurchaseFunnelEvent(StickersPurchaseFunnelAction.present_button_clicked)); long productId = (long)this._stockItemHeader.ProductId; long userOrChatId = this._stockItemHeader.UserOrChatId; bool isChat = this._stockItemHeader.IsChat; if (productId == 0L || userOrChatId == 0L) { return; } CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); FullscreenLoader fullscreenLoader = new FullscreenLoader(); fullscreenLoader.HideOnBackKeyPress = true; Action <FullscreenLoaderHiddenEventArgs> action = (Action <FullscreenLoaderHiddenEventArgs>)(args => cancellationTokenSource.Cancel()); fullscreenLoader.HiddenCallback = action; FullscreenLoader loader = fullscreenLoader; loader.Show(null, true); GiftsService.Instance.GetGiftInfoFromStore(productId, userOrChatId, isChat, (Action <BackendResult <GiftInfoFromStoreResponse, ResultCode> >)(result => { loader.Hide(false); if (result.ResultCode == ResultCode.Succeeded) { GiftInfoFromStoreResponse resultData = result.ResultData; List <long> userIds = resultData.userIds; GiftsSectionItem giftItem = resultData.giftItem; Gift gift = giftItem.gift; if (userIds == null || userIds.Count == 0) { Execute.ExecuteOnUIThread((Action)(() => MessageBox.Show(isChat ? CommonResources.AllChatParticipantsHaveStickerPack : CommonResources.UserAlreadyHasStickerPack, CommonResources.StickerPack, (MessageBoxButton)0))); } else { if (giftItem == null || gift == null) { return; } Navigator.Current.NavigateToGiftSend(gift.id, "stickers", giftItem.description, gift.thumb_256, giftItem.price, giftItem.gifts_left, userIds, true); } } else { GenericInfoUC.ShowBasedOnResult((int)result.ResultCode, "", (VKRequestsDispatcher.Error)null); } }), new CancellationToken?(cancellationTokenSource.Token)); }
public static void RestorePurchases(string productId = null) { FullscreenLoader loader = new FullscreenLoader(); loader.Show(null, true); StoreService.Instance.RestorePurchases(productId, (Action)(() => StorePurchaseManager.UpdateBalanceData((Action)(() => loader.Hide(false)))), (Action <BackendResult <StorePurchaseResult, ResultCode> >)(result => { loader.HiddenCallback = (Action <FullscreenLoaderHiddenEventArgs>)(args => StorePurchaseManager.HandleStorePurchaseError(result, null)); loader.Hide(false); })); }
private void ShowPreview(string previewUri, BitmapImage originalImage = null, int topOffset = 0) { if (this._ucPreview == null) { this._ucPreview = new PreviewImageUC(); this._loader = new FullscreenLoader(); this._loader.Show((FrameworkElement)this._ucPreview, false); } this._ucPreview.SetImageUri(previewUri, originalImage); ((FrameworkElement)this._ucPreview.imagePreview).Margin = (new Thickness(0.0, (double)topOffset, 0.0, 0.0)); }
public void AcceptTransfer() { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type // MoneyTransferViewModel.<>c__DisplayClass61_1 cDisplayClass611_1 = new MoneyTransferViewModel.<>c__DisplayClass61_1(); // ISSUE: reference to a compiler-generated field // cDisplayClass611_1.<>4__this = this; if (this.Transfer == null) { return; } // ISSUE: reference to a compiler-generated field string acceptUrl = this.Transfer.accept_url; // ISSUE: reference to a compiler-generated field if (!string.IsNullOrEmpty(acceptUrl)) { // ISSUE: reference to a compiler-generated field this.AcceptTransfer(acceptUrl); } else { FullscreenLoader loader = new FullscreenLoader(); loader.Show(null, true); MoneyTransfersService.CheckTransfer(this.Transfer.id, this.Transfer.from_id, this.Transfer.to_id, (Action <BackendResult <MoneyTransfer, ResultCode> >)(result => { loader.Hide(false); ResultCode resultCode = result.ResultCode; if (resultCode == ResultCode.Succeeded) { // ISSUE: variable of a compiler-generated type // MoneyTransferViewModel.<>c__DisplayClass61_1 cDisplayClass611_2 = cDisplayClass611_1; MoneyTransfer resultData = result.ResultData; string str = resultData != null ? resultData.accept_url : null; // ISSUE: reference to a compiler-generated field acceptUrl = str; if (string.IsNullOrEmpty(acceptUrl)) { return; } this.AcceptTransfer(acceptUrl); } else { GenericInfoUC.ShowBasedOnResult(resultCode, "", null); } })); } }
private static void ShowWithLoader(Action <Action <BackendResult <MoneyTransferResponse, ResultCode> >, CancellationToken> loadAction) { CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); FullscreenLoader fullscreenLoader = new FullscreenLoader(); fullscreenLoader.HideOnBackKeyPress = true; Action <FullscreenLoaderHiddenEventArgs> action = (Action <FullscreenLoaderHiddenEventArgs>)(args => cancellationTokenSource.Cancel()); fullscreenLoader.HiddenCallback = action; FullscreenLoader loader = fullscreenLoader; loader.Show(null, true); loadAction((Action <BackendResult <MoneyTransferResponse, ResultCode> >)(result => { loader.Hide(false); ResultCode resultCode = result.ResultCode; if (resultCode == ResultCode.Succeeded) { Execute.ExecuteOnUIThread((Action)(() => { MoneyTransferResponse resultData = result.ResultData; if (resultData == null) { return; } MoneyTransfer transfer = resultData.transfer; User user = resultData.user; if (transfer == null || user == null) { return; } TransferCardView.Show(new MoneyTransferViewModel(transfer, user)); })); } else { GenericInfoUC.ShowBasedOnResult(resultCode, "", null); } }), cancellationTokenSource.Token); }
private void LoadUserIds(Action <long, Action <BackendResult <List <long>, ResultCode> >, CancellationToken> loadAction) { CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); FullscreenLoader fullscreenLoader = new FullscreenLoader(); fullscreenLoader.HideOnBackKeyPress = true; Action <FullscreenLoaderHiddenEventArgs> action = (Action <FullscreenLoaderHiddenEventArgs>)(args => cancellationTokenSource.Cancel()); fullscreenLoader.HiddenCallback = action; FullscreenLoader loader = fullscreenLoader; loader.Show(null, true); loadAction(this._userOrChatId, (Action <BackendResult <List <long>, ResultCode> >)(result => { loader.Hide(false); if (result.ResultCode == ResultCode.Succeeded) { List <long> resultData = result.ResultData; if (resultData == null || resultData.Count == 0) { if (this._categoryName == "stickers") { Execute.ExecuteOnUIThread((Action)(() => MessageBox.Show(CommonResources.AllChatParticipantsHaveStickerPack, CommonResources.StickerPack, (MessageBoxButton)0))); } else { new GenericInfoUC().ShowAndHideLater(CommonResources.Error, null); } } else { Navigator.Current.NavigateToGiftSend(this.GiftId, this._categoryName, this.Description, this.ImageUrl, this.Price, this.GiftsLeft, resultData, this.IsProduct); } } else { GenericInfoUC.ShowBasedOnResult((int)result.ResultCode, "", (VKRequestsDispatcher.Error)null); } }), cancellationTokenSource.Token); }
public void Handle(StickersTapEvent message) { if (this.StickersList == null) { return; } long stickersProductId = message.StickersProductId; int stickerId = message.StickerId; if (stickersProductId == 0L && stickerId == 0) { return; } StockItem stockItem1 = stickersProductId > 0L ? this.StickersList.FirstOrDefault <StockItem>((Func <StockItem, bool>)(item => (long)item.product.id == stickersProductId)) : this.StickersList.FirstOrDefault <StockItem>((Func <StockItem, bool>)(item => item.product.stickers.sticker_ids.Contains(stickerId))); if (stockItem1 != null) { EventAggregator.Current.Publish((object)new StickersSettings.StickersItemTapEvent(new StockItemHeader(stockItem1, false, 0, false))); //EventAggregator.Current.Publish((object) new StickersSettings.StickersItemTapEvent(new StockItemHeader(stockItem1, false))); } else { FullscreenLoader loader = new FullscreenLoader() { HideOnBackKeyPress = true }; loader.Show(null, true); Action <StockItem> processLoadedStockItem = (Action <StockItem>)(stockItem => Execute.ExecuteOnUIThread((Action)(() => { if (!loader.IsShowed) { return; } loader.Hide(false); if (stockItem == null || this.StickersList == null) { return; } if (stockItem.product.active == 1) { if (this.StickersList != null) { this.InsertStickers(0, stockItem); } EventAggregator.Current.Publish((object)new StickersSettings.StickersItemTapEvent(new StockItemHeader(stockItem, false, 0, false))); //EventAggregator.Current.Publish((object) new StickersSettings.StickersItemTapEvent(new StockItemHeader(stockItem, false))); } else { CurrentStickersPurchaseFunnelSource.Source = StickersPurchaseFunnelSource.message; //StickersPackView.Show(stockItem, "message"); StickersPackView.Show(stockItem, "message", 0, false); } }))); if (stickersProductId > 0L) { StoreService instance = StoreService.Instance; int num = 0; List <long> productIds = new List <long>(); productIds.Add(stickersProductId); long purchaseForId = 0; Action <BackendResult <VKList <StockItem>, ResultCode> > callback = (Action <BackendResult <VKList <StockItem>, ResultCode> >)(result => { Action <StockItem> action = processLoadedStockItem; VKList <StockItem> resultData = result.ResultData; StockItem stockItem2; if (resultData == null) { stockItem2 = null; } else { List <StockItem> items = resultData.items; stockItem2 = items != null ? items.FirstOrDefault <StockItem>() : (StockItem)null; } action(stockItem2); }); instance.GetStockItems((StoreProductType)num, productIds, null, purchaseForId, callback); } else { StoreService.Instance.GetStockItemByStickerId((long)stickerId, (Action <BackendResult <StockItem, ResultCode> >)(result => processLoadedStockItem(result.ResultData)), new CancellationToken?()); } } }