Example #1
0
        async Task ForceSubscriptionAsync(PatronSubscriptionPrice p)
        {
            var now = DateTime.UtcNow;
            var id  = "force" + now.Ticks;

            await AddSubscriptionAsync(id, now, p);
        }
Example #2
0
        static async Task AddSubscriptionAsync(string transactionId, DateTime transactionDate, PatronSubscriptionPrice p)
        {
            var sub = new PatronSubscription();

            sub.TransactionId = transactionId;
            sub.PurchaseDate  = transactionDate;
            sub.ProductId     = p.Id;
            sub.NumMonths     = p.NumMonths;

            var db = CKContainer.DefaultContainer.PrivateCloudDatabase;
            await db.SaveRecordAsync(sub.Record);

            var v = visibleForm;

            if (v != null)
            {
                NSTimer.CreateScheduledTimer(1.0, nst => {
                    v.BeginInvokeOnMainThread(async() => {
                        for (var i = 0; i < 3; i++)
                        {
                            try {
                                await v.RefreshPatronDataAsync();
                            } catch (Exception ex) {
                                Log.Error(ex);
                            }
                            try {
                                await DocumentAppDelegate.Shared.CurrentDocumentListController.LoadDocs();
                            } catch (Exception ex) {
                                Log.Error(ex);
                            }
                            await Task.Delay(TimeSpan.FromSeconds(2.0));
                        }
                    });
                });
            }
        }
Example #3
0
			public PatronForceSubscriptionSection (PatronSubscriptionPrice[] prices)
				: base ()
			{
				this.prices = prices;
				Hint = "Did you already donate but are not receiving credit?";
				var c = new Command ("Already Paid", this.SelectPayAsync);
				Items.Add(c);
			}
Example #4
0
			public PatronBuySection (PatronSubscriptionPrice[] prices)
				: base (prices)
			{
				Hint = "These one-time purchases do not auto-renew and are saved in iCloud.";
			}
Example #5
0
		async Task ForceSubscriptionAsync (PatronSubscriptionPrice p)
		{
			var now = DateTime.UtcNow;
			var id = "force" + now.Ticks;
			await AddSubscriptionAsync (id, now, p);
		}
Example #6
0
		static async Task AddSubscriptionAsync (string transactionId, DateTime transactionDate, PatronSubscriptionPrice p)
		{
			var sub = new PatronSubscription ();
			sub.TransactionId = transactionId;
			sub.PurchaseDate = transactionDate;
			sub.ProductId = p.Id;
			sub.NumMonths = p.NumMonths;

			var db = CKContainer.DefaultContainer.PrivateCloudDatabase;
			await db.SaveRecordAsync (sub.Record);

			var v = visibleForm;
			if (v != null) {
				NSTimer.CreateScheduledTimer (1.0, nst => {
					v.BeginInvokeOnMainThread (async () => {
						for (var i = 0; i < 3; i++) {
							try {
								await v.RefreshPatronDataAsync ();
							} catch (Exception ex) {
								Log.Error (ex);
							}
							try {
								await DocumentAppDelegate.Shared.CurrentDocumentListController.LoadDocs ();
							} catch (Exception ex) {
								Log.Error (ex);
							}
							await Task.Delay (TimeSpan.FromSeconds (2.0));
						}
					});
				});
			}
		}