コード例 #1
0
        private async Task Load()
        {
            Web.UserInteractionEnabled = false;
            Web.LoadHtmlString("", NSBundle.MainBundle.BundleUrl);

            _activityView.Alpha = 1;
            _activityView.StartAnimating();
            View.Add(_activityView);

            try
            {
                var productData = (await _inAppPurchaseService.RequestProductData(FeaturesService.ProEdition)).Products.FirstOrDefault();
                var enabled = _featuresService.IsProEnabled;
                var model = new UpgradeDetailsModel(productData != null ? productData.LocalizedPrice() : null, enabled);
                var content = new UpgradeDetailsRazorView {
                    Model = model
                }.GenerateString();
                LoadContent(content);
                Web.UserInteractionEnabled = true;
            }
            finally
            {
                UIView.Animate(0.2f, 0, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseInOut,
                               () => _activityView.Alpha = 0, () =>
                {
                    _activityView.RemoveFromSuperview();
                    _activityView.StopAnimating();
                });
            }
        }
コード例 #2
0
        private async Task Load()
        {
            Web.UserInteractionEnabled = false;
            Web.LoadHtmlString("", NSBundle.MainBundle.BundleUrl);

            _activityView.Alpha = 1;
            _activityView.StartAnimating();
            View.Add(_activityView);

            try
            {
                var request = _inAppPurchaseService.RequestProductData(FeaturesService.ProEdition).WithTimeout(TimeSpan.FromSeconds(30));
                var productData = (await request).Products.FirstOrDefault();
                var enabled = _featuresService.IsProEnabled;
                var model = new UpgradeDetailsModel(productData != null ? productData.LocalizedPrice() : null, enabled);
                var content = new UpgradeDetailsView {
                    Model = model
                }.GenerateString();
                LoadContent(content);
                Web.UserInteractionEnabled = true;
            }
            catch (Exception e)
            {
                AlertDialogService.ShowAlert("Error Loading Upgrades", e.Message);
            }
            finally
            {
                UIView.Animate(0.2f, 0, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseInOut,
                               () => _activityView.Alpha = 0, () =>
                {
                    _activityView.RemoveFromSuperview();
                    _activityView.StopAnimating();
                });
            }
        }
コード例 #3
0
        public async Task ActivatePro()
        {
            var productData = (await _inAppPurchaseService.RequestProductData(ProEdition)).Products.FirstOrDefault();

            if (productData == null)
            {
                throw new InvalidOperationException("Unable to activate CodeHub Pro");
            }
            await _inAppPurchaseService.PurchaseProduct(productData);
        }
コード例 #4
0
ファイル: FeaturesService.cs プロジェクト: yippeeapp/CodeHub
        public async Task ActivatePro()
        {
            var productData = (await _inAppPurchaseService.RequestProductData(ProEdition)).Products.FirstOrDefault();

            if (productData == null)
            {
                throw new InvalidOperationException("Unable to activate CodeHub Pro");
            }
            await _inAppPurchaseService.PurchaseProduct(productData);

            _defaultValueService.Set(ProEdition, true);
            _defaultValueService.Set(PushNotifications, true);
            var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;

            appDelegate?.RegisterUserForNotifications();
        }
コード例 #5
0
 public System.Threading.Tasks.Task <StoreKit.SKProductsResponse> RequestProductData(params string[] productIds)
 {
     using (_networkActivity.ActivateNetwork())
         return(_inAppPurcahseService.RequestProductData(productIds));
 }