private async void OnGiveGold(Photo photo) { try { await _authEnforcementHandler.CheckUserAuthentication(); await _navigationFacade.ShowGiveGoldDialog(photo); } catch (SignInRequiredException) { // User canceled the Sign-in dialog. } catch (ServiceException) { await _dialogService.ShowGenericServiceErrorNotification(); } }
private async void OnGiveGold(Photo photo) { _telemetryClient.TrackEvent(TelemetryEvents.GiveGoldInitiated); try { await _authEnforcementHandler.CheckUserAuthentication(); await _navigationFacade.ShowGiveGoldDialog(photo); } catch (SignInRequiredException) { // Swallow exception. User canceled the Sign-in dialog. } catch (ServiceException) { await _dialogService.ShowGenericServiceErrorNotification(); } }
/// <summary> /// Purchases Gold with the given productId. /// </summary> /// <remarks> /// Please see <see cref="InAppPurchases" /> for available /// IAPs. /// </remarks> /// <param name="productId">The productId to purchase.</param> /// <exception cref="InAppPurchaseException">Thrown when an error occurs during purchase.</exception> /// <returns>The task.</returns> public async Task PurchaseGold(string productId) { await _authEnforcementHandler.CheckUserAuthentication(); // Kick off the purchase var purchaseResults = await CurrentAppProxy.RequestProductPurchaseAsync(productId); if (purchaseResults.Status == ProductPurchaseStatus.Succeeded || purchaseResults.Status == ProductPurchaseStatus.NotFulfilled) { await DoFulfillment(); } else { // ProductPurchaseStatus is either AlreadyPurchased or NotPurchased, // while latter implies either user cancellation or other failures. throw new InAppPurchaseException(); } }