コード例 #1
0
        public async Task CheckAndSetVersion()
        {
            if (context == null)
            {
                context = StoreContext.GetDefault();
                // If your app is a desktop app that uses the Desktop Bridge, you
                // may need additional code to configure the StoreContext object.
                // For more info, see https://aka.ms/storecontext-for-desktop.
                Swedish.IInitializeWithWindow initWindow = (Swedish.IInitializeWithWindow)(object) context;
                initWindow.Initialize(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle);
            }

            bool userOwnsSubscription = await CheckIfUserHasSubscriptionAsync();

            if (userOwnsSubscription)
            {
                Common.fullVersion = true;
            }

            Common.SetVersion();
        }
コード例 #2
0
        public async Task OpenBuyNowDialogue()
        {
            if (context == null)
            {
                context = StoreContext.GetDefault();
                // If your app is a desktop app that uses the Desktop Bridge, you
                // may need additional code to configure the StoreContext object.
                // For more info, see https://aka.ms/storecontext-for-desktop.
                Swedish.IInitializeWithWindow initWindow = (Swedish.IInitializeWithWindow)(object) context;
                initWindow.Initialize(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle);
            }

            // Get the StoreProduct that represents the subscription add-on.
            subscriptionStoreProduct = await GetSubscriptionProductAsync();

            if (subscriptionStoreProduct == null)
            {
                return;
            }

            // Prompt the customer to purchase the subscription.
            await PromptUserToPurchaseAsync();
        }