async void UpdateSubscription() { var subscriptionStore = new SubscriptionStore(); await subscriptionStore.CheckAndUpdateSubscriptionStatus(); subscriptionStore.Dispose(); }
async void LoadDataFromStore() { IsLoading = true; var products = await SubscriptionStore.GetSubscriptionInfo(); if (products != null) { foreach (var item in products) { if (item.ProductId == SubscriptionStore.MonthlySubscriptionID) { // monthly data MonthlyFeeText = item.LocalizedPrice + "/" + AppResources.month; } if (item.ProductId == SubscriptionStore.AnnuallySubscriptionID) { AnnualFeeText = item.LocalizedPrice + "/" + AppResources.year; } } } var purchasedGoods = await SubscriptionStore.CheckAndUpdateSubscriptionStatus(); if (purchasedGoods != null) { IsSubscribed = true; if (purchasedGoods.Item2.ProductId == SubscriptionStore.MonthlySubscriptionID) { SubscribedTenure = AppResources.monthly; SubscribedDate = AppResources.subscriptionstarted + " " + purchasedGoods?.Item2.TransactionDateUtc.Date.ToString("D"); SubscribedPrice = MonthlyFeeText; } else if (purchasedGoods.Item2.ProductId == SubscriptionStore.AnnuallySubscriptionID) { SubscribedTenure = AppResources.annualy; SubscribedDate = AppResources.subscriptionstarted + " " + purchasedGoods?.Item2.TransactionDateUtc.Date.ToString("D"); SubscribedPrice = AnnualFeeText; } } IsLoading = false; }