示例#1
0
        private async void PurchaseButtonClicked()
        {
            LoadAnimationRunning  = true;
            LoadAnimationVisible  = true;
            PurchaseButtonEnabled = false;
            try
            {
                SubscriptionType selected = SubscriptionType.Basic;
                var subCode = SubscriptionUtility.GetInfoFromSubType(selected).SubscriptionCode;
                try
                {
                    await PurchaseSubscription(subCode);

                    await _alertUtility.Display("Purchase Complete", "Thank you for your purchase!", "Ok");

                    _nav.PopToRoot();
                }
                catch (Exception ex)
                {
                    _toastService.LongToast($"Failed to purchase subscription. {ex.Message}");
                }
            }
            catch (Exception ex)
            {
                _toastService.LongToast($"Something went wrong when trying to purchase subscription. {ex.Message}");
            }
            finally
            {
                try
                {
                    PurchaseButtonEnabled = true;
                    LoadAnimationRunning  = false;
                    LoadAnimationVisible  = false;
                }
                catch { }
            }
        }
        private async Task PurchaseButtonClicked()
        {
            LoadAnimationRunning  = true;
            LoadAnimationVisible  = true;
            PurchaseButtonEnabled = false;
            try
            {
                var code = SubscriptionUtility.GetSingleReportInfo(_validation).Code;
                try
                {
                    await PurchaseItem(code);

                    await _alertUtility.Display("Purchase Complete", "Thank you for your purchase!", "Ok");

                    _nav.PopToRoot();
                }
                catch (Exception ex)
                {
                    _toastService.LongToast($"Failed to purchase report. {ex.Message}");
                }
            }
            catch (Exception ex)
            {
                _toastService.LongToast($"Something went wrong when trying to purchase report. {ex.Message}");
            }
            finally
            {
                try
                {
                    PurchaseButtonEnabled = true;
                    LoadAnimationRunning  = false;
                    LoadAnimationVisible  = false;
                }
                catch { }
            }
        }