Inheritance: ILicenseInformation
Beispiel #1
0
 /// <summary>
 /// The private constructor
 /// </summary>
 private InAppPurchases()
 {
     // Set some default values:
     _runningMode = RunningMode.Testing;
     _licenseInformation = null;
     _noAdsOptionIsActivated = false;
 }
        //debug 
        //private const string XML_NOK = "in-app-purchase_nok.xml";
        //private const string XML_OK = "in-app-purchase_ok.xml";
        

        public PlayerDetailPage()
        {
            this.InitializeComponent();

            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;

            // 
            licenseInformation = CurrentApp.LicenseInformation;
            //licenseInformation = CurrentAppSimulator.LicenseInformation;


            gamesPlayedTextBlocks.Add(mmxvGamesPlayed);
            gamesPlayedTextBlocks.Add(cxGamesPlayed);
            gamesPlayedTextBlocks.Add(AboGamesPlayed);
            gamesPlayedTextBlocks.Add(JYLYGamesPlayed);

            bestScoreTextBlocks.Add(mmxvBestScore);
            bestScoreTextBlocks.Add(cxBestScore);
            bestScoreTextBlocks.Add(AboBestScore);
            bestScoreTextBlocks.Add(JYLYBestScore);

            avgScoreTextBlocks.Add(mmxvAvgScore);
            avgScoreTextBlocks.Add(cxAvgScore);
            avgScoreTextBlocks.Add(AboAvgScore);
            avgScoreTextBlocks.Add(JYLYAvgScore);

            skillLevelTextBlocks.Add(mmxvSkillLevel);
            skillLevelTextBlocks.Add(cxSkillLevel);
            skillLevelTextBlocks.Add(AboSkillLevel);
            skillLevelTextBlocks.Add(JYLYSkillLevel);
        }
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            // Remove these lines of code before publishing!
            // The actual CurrentApp will create a WindowsStoreProxy.xml
            // in the package's \LocalState\Microsoft\Windows Store\ApiData
            // folder where it stores the actual purchases.
            // Here we're just giving it a fake version of that file
            // for testing.
            StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Assets");
            StorageFile proxyFile = await proxyDataFolder.GetFileAsync("test.xml");
            await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);
            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

            // You may want to put this at the App level
            AppLicenseInformation = CurrentAppSimulator.LicenseInformation;

            if (AppLicenseInformation.ProductLicenses["MyInAppOfferToken"].IsActive)
            {
                // Customer can access this feature.
                FeatureRectangle.Visibility = Visibility.Visible;
                PurchaseFeatureButton.Visibility = Visibility.Collapsed;
            }
            else
            {
                // Customer can NOT access this feature.
                FeatureRectangle.Visibility = Visibility.Collapsed;
                PurchaseFeatureButton.Visibility = Visibility.Visible;
            }
        }
Beispiel #4
0
		private bool InitializeLicense()
		{
			licenseInformation = CurrentApp.LicenseInformation;

			//licenseInformation.LicenseChanged += licenseInformation_LicenseChanged;

			return licenseInformation.IsTrial;
		}
        static WindowsStoreManager()
        {
#if DEBUG
            LicenseInformation = CurrentAppSimulator.LicenseInformation;
#else
            LicenseInformation = CurrentApp.LicenseInformation; 
#endif
            LicenseInformation.LicenseChanged += LicenseInformation_OnLicenseChanged;   
        }
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += this.OnSuspending;

#if DEBUG
            LicenseInformation = CurrentAppSimulator.LicenseInformation;
            Task.Run(() => LoadInAppPurchaseProxyFileAsync());
#else
            LicenseInformation = CurrentApp.LicenseInformation;
#endif
        }
        //debug
        //private const string XML_NOK = "in-app-purchase_nok.xml";
        //private const string XML_OK = "in-app-purchase_ok.xml";

        public BuyProPackPage()
        {
            this.InitializeComponent();

            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
            
            //licenseInformation = CurrentAppSimulator.LicenseInformation;
            //
            licenseInformation = CurrentApp.LicenseInformation;
        }
Beispiel #8
0
        // Summary:
        //     Not implemented for Windows Phone. Gets the license expiration date and time
        //     relative to the system clock.
        //
        // Returns:
        //     The date and time that the app's trial license will expire.
        public LicenseInformation(Windows.ApplicationModel.Store.LicenseInformation li)
        {
            IsActive        = li.IsActive;
            IsTrial         = li.IsTrial;
            ExpirationDate  = li.ExpirationDate;
            ProductLicenses = new Dictionary <string, ProductLicense>();

            foreach (string key in li.ProductLicenses.Keys)
            {
                ProductLicenses.Add(key, ProductLicense.Create(li.ProductLicenses[key]));
            }
        }
        public static void RegisterOnNavigatedTo(LicenseInformation licenseInformation)
        {
            Config.Instance.LicenseInformation = licenseInformation;

            var config = Config.Instance;

            //if (config.RegisterSetAds)
            //    Ads.Instance.SetRemoveAds();

            //if (config.RegisterPivotBackButton)
            //    Windows.Phone.UI.Input.HardwareButtons.BackPressed += PivotBackButton.Instance.HardwareButtons_BackPressed;
        }
Beispiel #10
0
        public void Init()
        {
            // some app initialization functions 

            // Get the license info
            // The next line is commented out for testing.

            licenseInformation = CurrentApp.LicenseInformation;

            // The next line is commented out for production/release.       
            //licenseInformation = CurrentAppSimulator.LicenseInformation;

        }
        public App()
        {
            Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync();
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            // Only for IAP simulation purposes
#if DEBUG
            licenseInformation = CurrentAppSimulator.LicenseInformation;
#else
            licenseInformation = CurrentApp.LicenseInformation;
#endif
        }
        public static void AppInit()
        {
            // some app initialization functions 

            // Get the license info
            mLicenseInformation = CurrentApp.LicenseInformation;

            // add event handler to catch changes in license state.
            //mLicenseInformation.LicenseChanged += new LicenseChangedEventHandler(LicenseChangedEventHandler);

            // other app initialization functions
            //GetListingInfo();
        }
        private void InitializeLicense()
        {
            //licenseInformation = CurrentAppSimulator.LicenseInformation;
            licenseInformation = CurrentApp.LicenseInformation;

            licenseInformation.LicenseChanged += () =>
            {
                IsTrial = licenseInformation.IsActive ? licenseInformation.IsTrial : true; // A license is inactive only when there's an error.
            };

            IsTrial = licenseInformation.IsTrial;

            isInitialized = true;
        }
Beispiel #14
0
        public AppInfoProvider()
        {
#if DEBUG
            _licenseInfo = CurrentAppSimulator.LicenseInformation;
#else
            try
            {
                _licenseInfo = CurrentApp.LicenseInformation;
            }
            catch
            {
                _licenseInfo = CurrentAppSimulator.LicenseInformation;
            }
#endif
        }
Beispiel #15
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
                Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
                Microsoft.ApplicationInsights.WindowsCollectors.Session);
            this.InitializeComponent();
            this.Suspending += OnSuspending;
            this.UnhandledException += OnUnhandledException;

            // Get the license info
            // The next line is commented out for testing.
            // licenseInformation = CurrentApp.LicenseInformation;

            // The next line is commented out for production/release.       
            licenseInformation = CurrentApp.LicenseInformation;

            // Initialize App settings
            AppSettings = new Dictionary<string, object>();
            AppSettings.Add(REOPEN_FILE, true);
            AppSettings.Add(RESTORE_VIEW, true);
            AppSettings.Add(SHOW_RECENT_FILES, true);
            AppSettings.Add(DEBUG_LOGGING, true);
            AppSettings.Add(INKING_WARNING, true);
            AppSettings.Add(ERASER_WARNING, true);
            AppSettings.Add(TUTORIAL, true);
            AppSettings.Add(CONFIRM_SAVING, true);
            

            // Load App settings
            List<string> keys = new List<string>(AppSettings.Keys);
            foreach (string key in keys)
            {
                object obj = ApplicationData.Current.RoamingSettings.Values[key];
                if (obj != null)
                {
                    AppSettings[key] = obj;
                }
            }

            // Enable Logging
            EventLevel eLevel;
            if ((bool)AppSettings[App.DEBUG_LOGGING])
                eLevel = EventLevel.Verbose;
            else eLevel = EventLevel.Informational;
            libraListener = new StorageFileEventListener(LOG_FILE_NAME);
            libraListener.EnableEvents(AppEventSource.Log, eLevel);
            AppEventSource.Log.Info("********** App is starting **********");
        }
Beispiel #16
0
#pragma warning restore 67

        /// <summary>
        /// Creates a LicenseInformation class based upon a Windows.ApplicationModel.Store.LicenseInformation object
        /// </summary>
        /// <param name="source">A valid Windows.ApplicationModel.Store.LicenseInformation object</param>
        /// <returns>A LicenseInformation class with all properties mapped from source</returns>
        public static LicenseInformation Create(Windows.ApplicationModel.Store.LicenseInformation source)
        {
            var licenseInformation = new LicenseInformation()
            {
                IsActive        = source.IsActive,
                IsTrial         = source.IsTrial,
                ExpirationDate  = source.ExpirationDate,
                ProductLicenses = source.ProductLicenses.ToDictionary(key => key.Key, value => ProductLicense.Create(value.Value))
            };

#if WINDOWS_PHONE && !DEBUG //The Windows Phone  new Microsoft.Phone.Marketplace.LicenseInformation().IsTrial(); is what really determines the Trial vs. Full license status in production for WP8
            licenseInformation.IsTrial = new Microsoft.Phone.Marketplace.LicenseInformation().IsTrial();
#endif

            return(licenseInformation);
        }
Beispiel #17
0
        //debug 
        //private const string XML_NOK = "in-app-purchase_nok.xml";
        //private const string XML_OK = "in-app-purchase_ok.xml";

        public MainPage()
        {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;

            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
            pivot.SelectionChanged += pivot_SelectionChanged;

            //licenseInformation = CurrentAppSimulator.LicenseInformation;

            licenseInformation = CurrentApp.LicenseInformation;

            pivot.PivotItemLoading += pivot_PivotItemLoading;
        }
        public async void InitializeManager()
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("Purchasing\\license.xml");

                await CurrentAppSimulator.ReloadSimulatorAsync(file);

                mLicenseInfo = CurrentAppSimulator.LicenseInformation;
            }
            else
#endif
            {
                mLicenseInfo = CurrentApp.LicenseInformation;
            }

        }
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            // Enable Azure Application Insights
            WindowsAppInitializer.InitializeAsync();



            this.InitializeComponent();
            this.Suspending += this.OnSuspending;

            //Only for IAP simulation purposes
#if DEBUG
            licenseInformation = CurrentAppSimulator.LicenseInformation;
#else
            licenseInformation = CurrentApp.LicenseInformation;
#endif
            this.UnhandledException += this.Application_UnhandledException;
        }
Beispiel #20
0
 public void Initialize()
 {
     if (Initialized == false)
     {
         if (StoreConfig.STORE_TEST_MODE)
         {
             SoomlaUtils.LogDebug(TAG, "WARNING You are running in Store Test Mode! Don't forget to disable the test mode before you publish the app.");
             SetupMockIAP();
             licInfosMock = MockCurApp.LicenseInformation;
         }
         else
         {
             licInfos = CurApp.LicenseInformation;
         }
         marketProductInfos = new Dictionary <string, MarketProductInfos>();
         //LoadListingInfo();
         Initialized = true;
     }
 }
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            // Remove these lines of code before publishing!
            // The actual CurrentApp will create a WindowsStoreProxy.xml
            // in the package's \LocalState\Microsoft\Windows Store\ApiData
            // folder where it stores the actual purchases.
            // Here we're just giving it a fake version of that file
            // for testing.
            //StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Assets");
            //StorageFile proxyFile = await proxyDataFolder.GetFileAsync("test.xml");
            //await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);
            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            licenseInformation = CurrentApp.LicenseInformation;
            //licenseInformation = CurrentAppSimulator.LicenseInformation;
            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        }
        public StoreScreen(ScreenManager screenManager)
            : base(screenManager)
        {
            TransitionDuration = TimeSpan.FromSeconds(1);

            // setup the big ups button
            string bigUpsButtonText = "Send Big Ups to Omega Entertainment (FREE!)";
            int bigUpsButtonWidth = (int)(screenManager.Game.GraphicsManager.SpriteFont.MeasureString(bigUpsButtonText).X * 1.1f);
            int bigUpsButtonHeight = screenManager.Game.WorldViewport.Height / 10;
            bigUpsButton = new Button(this, bigUpsButtonText, Color.White, new Rectangle(screenManager.Game.WorldViewport.Width / 2 - bigUpsButtonWidth / 2, screenManager.Game.WorldViewport.Height / 2 - bigUpsButtonHeight / 2, bigUpsButtonWidth, bigUpsButtonHeight), Color.Red);
            bigUpsButton.Selected += bigUpsButton_Selected;

            // setup the back button
            string backButtonText = "Back";
            Vector2 backButtonSize = new Vector2(screenManager.Game.GraphicsManager.SpriteFont.MeasureString(backButtonText).X * 1.1f);
            backButton = new Button(this, backButtonText, Color.White, new Rectangle((int)(screenManager.Game.WorldViewport.Width * 0.025f), (int)(screenManager.Game.WorldViewport.Height * 0.025f), (int)backButtonSize.X, (int)backButtonSize.Y), Color.Orange);
            backButton.Selected += backButton_Selected;
            licenseInformation = CurrentAppSimulator.LicenseInformation;
        }        
        private async void InAppPurchase_Loaded(object sender, RoutedEventArgs e)
        {
            StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Data");
            StorageFile proxyFile = await proxyDataFolder.GetFileAsync("WindowsStoreProxy.xml");
            await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);

            appLicenseInformation = CurrentAppSimulator.LicenseInformation;

            if(appLicenseInformation.ProductLicenses["1"].IsActive)
            {
                RedRect.Visibility = Visibility.Visible;
                BuyBtn.Visibility = Visibility.Collapsed;
            }
            else
            {
                RedRect.Visibility = Visibility.Collapsed;
                BuyBtn.Visibility = Visibility.Visible;
            }
        }
Beispiel #24
0
        public void Initialize()
        {
            if(Initialized==false)
            {
                if (StoreConfig.STORE_TEST_MODE)
                {
                    SoomlaUtils.LogDebug(TAG, "WARNING You are running in Store Test Mode! Don't forget to disable the test mode before you publish the app.");
                    SetupMockIAP();
                    licInfosMock = MockCurApp.LicenseInformation;

                }
                else
                {
                    licInfos = CurApp.LicenseInformation;
                }
                marketProductInfos = new Dictionary<string, MarketProductInfos>();
                //LoadListingInfo();
                Initialized = true;
            }
        }
Beispiel #25
0
        private async void DoPurchase(string productId)
        {
            try
            {
                bool licenceActiv = false;
                if (StoreConfig.STORE_TEST_MODE)
                {
                    // Kick off purchase; don't ask for a receipt when it returns
                    await MockCurApp.RequestProductPurchaseAsync(productId, false);

                    licInfosMock = MockCurApp.LicenseInformation;
                    licenceActiv = licInfosMock.ProductLicenses[productId].IsActive;
                }
                else
                {
                    // Kick off purchase; don't ask for a receipt when it returns
                    await CurApp.RequestProductPurchaseAsync(productId, false);

                    licInfos     = CurApp.LicenseInformation;
                    licenceActiv = licInfos.ProductLicenses[productId].IsActive;
                }

                if (licenceActiv)
                {
                    OnItemPurchasedCB(productId);
                }
                else
                {
                    SoomlaUtils.LogDebug(TAG, "Purchase cancelled " + productId);
                    OnItemPurchaseCancelCB(productId, false);
                }
            }
            catch (Exception ex)
            {
                // When the user does not complete the purchase (e.g. cancels or navigates back from the Purchase Page), an exception with an HRESULT of E_FAIL is expected.
                SoomlaUtils.LogDebug(TAG, ex.Message);
                OnItemPurchaseCancelCB(productId, true);
            }
        }
        public async Task Init(Data.MagazineViewModel mag)
        {
            _item = mag;
            product_id = mag.FileName.Replace(".pdf", "");
            relativePath = mag.RelativePath;
            licenseInformation = CurrentAppSimulator.LicenseInformation;

            var appListing = await CurrentAppSimulator.LoadListingInformationAsync();
            var productListings = appListing.ProductListings;
            ProductListing product = null;
            try {
                product = productListings["yearlysubscritpion"];

            } catch { }

            statusContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;
            buttonContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            subscribeBtn.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            subscribeBtn1.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            buyMag.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

            this.Visibility = Windows.UI.Xaml.Visibility.Visible;

            if (product != null)
            {
                if (!licenseInformation.ProductLicenses[product.ProductId].IsActive)
                {
                    string receipt = "";
                    try {
                        receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();
                        receipt = DownloadManager.GetProductReceiptFromAppReceipt(product.ProductId, receipt);

                    } catch { }
                    if (receipt != "")
                    {
                        await DownloadManager.StoreReceiptAsync("yearlysubscritpion", receipt);
                        var url = DownloadManager.GetUrl("yearlysubscritpion", receipt, relativePath);
                        if (!url.Equals("NoReceipt"))
                        {
                            Bought(this, url);
                            return;
                        }
                        else
                        {
                            subscribeBtn.Content = "Subscribe to Wind for 1 year: " + product.FormattedPrice;
                            subscribeBtn.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        }
                    }
                    else 
                    {
                        var url = await DownloadManager.GetUrl("yearlysubscritpion", relativePath);
                        if (!url.Equals("NoReceipt"))
                        {
                            Bought(this, url);
                            return;
                        }
                        else
                        {
                            subscribeBtn.Content = "Subscribe to Wind for 1 year: " + product.FormattedPrice;
                            subscribeBtn.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        }
                    }
                }
                else
                {
                    //var productLicense1 = licenseInformation.ProductLicenses["Subscription1"];
                    //var longdateTemplate = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("longdate");
                    //var text = "Subscription1 expires on: " + longdateTemplate.Format(productLicense1.ExpirationDate);
                    //var remainingDays = (productLicense1.ExpirationDate - DateTime.Now).Days;
                    if (Bought != null)
                    {
                        var url = await DownloadManager.GetUrl("yearlysubscritpion", relativePath);
                        if (url.Equals("NoReceipt"))
                        {
                            string receipt = "";
                            try {
                                receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();

                            }  catch { }
                            if (receipt != "")
                            {
                                await DownloadManager.StoreReceiptAsync("yearlysubscritpion", receipt);
                                url = DownloadManager.GetUrl("yearlysubscritpion", receipt, relativePath);
                                if (!url.Equals("NoReceipt"))
                                {
                                    Bought(this, url);
                                    return;
                                }
                                else
                                {
                                    var messageDialog = new MessageDialog("No Receipt");
                                    var task = messageDialog.ShowAsync().AsTask();
                                }
                            }
                            else
                            {
                                var messageDialog = new MessageDialog("No Receipt");
                                var task = messageDialog.ShowAsync().AsTask();
                            }
                        }
                        else
                        {
                            Bought(this, url);
                            return;
                        }
                    }
                    else
                    {
                        var messageDialog = new MessageDialog("Purchase successfull");
                        var task = messageDialog.ShowAsync().AsTask();
                    }
                }
            }

            try {
                product = productListings["monthlysubscription"];

            } catch { }

            if (product != null)
            {
                if (!licenseInformation.ProductLicenses[product.ProductId].IsActive)
                {
                    string receipt = "";
                    try
                    {
                        receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();
                        receipt = DownloadManager.GetProductReceiptFromAppReceipt(product.ProductId, receipt);

                    }
                    catch { }
                    if (receipt != "")
                    {
                        await DownloadManager.StoreReceiptAsync("monthlysubscription", receipt);
                        var url = DownloadManager.GetUrl("monthlysubscription", receipt, relativePath);
                        if (!url.Equals("NoReceipt"))
                        {
                            Bought(this, url);
                            return;
                        }
                        else
                        {
                            subscribeBtn1.Content = "Subscribe to Wind for 6 months: " + product.FormattedPrice;
                            subscribeBtn1.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        }
                    }
                    else
                    {
                        var url = await DownloadManager.GetUrl("monthlysubscription", relativePath);
                        if (!url.Equals("NoReceipt"))
                        {
                            Bought(this, url);
                            return;
                        }
                        else
                        {
                            subscribeBtn1.Content = "Subscribe to Wind for 6 months: " + product.FormattedPrice;
                            subscribeBtn1.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        }
                    }
                }
                else
                {
                    if (Bought != null)
                    {
                        var url = await DownloadManager.GetUrl("monthlysubscription", relativePath);
                        if (url.Equals("NoReceipt"))
                        {
                            string receipt = "";
                            try
                            {
                                receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();

                            }
                            catch { }
                            if (receipt != "")
                            {
                                await DownloadManager.StoreReceiptAsync("monthlysubscription", receipt);
                                url = DownloadManager.GetUrl("monthlysubscription", receipt, relativePath);
                                if (!url.Equals("NoReceipt"))
                                {
                                    Bought(this, url);
                                    return;
                                }
                                else
                                {
                                    var messageDialog = new MessageDialog("No Receipt");
                                    var task = messageDialog.ShowAsync().AsTask();
                                }
                            }
                            else
                            {
                                var messageDialog = new MessageDialog("No Receipt");
                                var task = messageDialog.ShowAsync().AsTask();
                            }
                        }
                        else
                        {
                            Bought(this, url);
                            return;
                        }
                    }
                    else
                    {
                        var messageDialog = new MessageDialog("Purchase successfull");
                        var task = messageDialog.ShowAsync().AsTask();
                    }
                }
            }

            try {
                product = productListings[product_id];

            } catch { }

            if (product != null)
            {
                if (!licenseInformation.ProductLicenses[product.ProductId].IsActive)
                {
                    string receipt = "";
                    try
                    {
                        receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();
                        receipt = DownloadManager.GetProductReceiptFromAppReceipt(product.ProductId, receipt);

                    }
                    catch { }
                    if (receipt != "")
                    {
                        await DownloadManager.StoreReceiptAsync(product_id, receipt);
                        var url = DownloadManager.GetUrl(product_id, receipt, relativePath);
                        if (!url.Equals("NoReceipt"))
                        {
                            Bought(this, url);
                            return;
                        }
                        else
                        {
                            buyMag.Content = "Buy " + mag.Title + " for: " + product.FormattedPrice;
                            buyMag.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        }
                    }
                    else
                    {
                        var url = await DownloadManager.GetUrl(product_id, relativePath);
                        if (!url.Equals("NoReceipt"))
                        {
                            Bought(this, url);
                            return;
                        }
                        else
                        {
                            buyMag.Content = "Buy " + mag.Title + " for: " + product.FormattedPrice;
                            buyMag.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        }
                    }
                }
                else
                {
                    if (Bought != null)
                    {
                        var url = await DownloadManager.GetUrl(product_id, relativePath);
                        if (url.Equals("NoReceipt"))
                        {
                            string receipt = "";
                            try
                            {
                                receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();

                            }
                            catch { }
                            if (receipt != "")
                            {
                                await DownloadManager.StoreReceiptAsync(product_id, receipt);
                                url = DownloadManager.GetUrl(product_id, receipt, relativePath);
                                if (!url.Equals("NoReceipt"))
                                {
                                    Bought(this, url);
                                    return;
                                }
                                else
                                {
                                    var messageDialog = new MessageDialog("No Receipt");
                                    var task = messageDialog.ShowAsync().AsTask();
                                }
                            }
                            else
                            {
                                var messageDialog = new MessageDialog("No Receipt");
                                var task = messageDialog.ShowAsync().AsTask();
                            }
                        }
                        else
                        {
                            Bought(this, url);
                            return;
                        }
                    }
                    else
                    {
                        var messageDialog = new MessageDialog("Purchase successfull");
                        var task = messageDialog.ShowAsync().AsTask();
                    }
                }
            }

            if (product != null)
            {
                var url = await DownloadManager.GetUrl(product_id, relativePath);
                if (!licenseInformation.ProductLicenses[product.ProductId].IsActive)
                {
                    string receipt = "";
                    try
                    {
                        receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();
                        receipt = DownloadManager.GetProductReceiptFromAppReceipt(product.ProductId, receipt);

                    }
                    catch { }
                    if (receipt != "")
                    {
                        Bought(this, url);
                    }
                    else
                    {
                        buyMag.Content = "Buy " + mag.Title + " for: " + product.FormattedPrice;
                        buyMag.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    }
                }
                else
                {
                    if (Bought != null)
                    {
                        this.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                        if (url.Equals("NoReceipt"))
                        {
                            string receipt = "";
                            try
                            {
                                receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();

                            }
                            catch { }
                            if (receipt != null)
                            {
                                Bought(this, url);
                            }
                            else
                            {
                                var messageDialog = new MessageDialog("No Receipt");
                                var task = messageDialog.ShowAsync().AsTask();
                            }
                        }
                        else
                        {
                            Bought(this, url);
                        }
                    }
                    else
                    {
                        var messageDialog = new MessageDialog("Purchase successfull");
                        var task = messageDialog.ShowAsync().AsTask();
                    }
                }
            }

            statusContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            buttonContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;
        }
Beispiel #27
0
        //Icon is pulled when shell loads as well as after first login
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            // Remove these lines of code before publishing!
            // The actual CurrentApp will create a WindowsStoreProxy.xml
            // in the package's \LocalState\Microsoft\Windows Store\ApiData
            // folder where it stores the actual purchases.
            // Here we're just giving it a fake version of that file
            // for testing.
            //StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Assets");
            //StorageFile proxyFile = await proxyDataFolder.GetFileAsync("test.xml");
            //await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);
            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            licenseInformation = CurrentApp.LicenseInformation;
            //licenseInformation = CurrentAppSimulator.LicenseInformation;
            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

            if (licenseInformation.ProductLicenses["RemoveAds"].IsActive)
            {
            }
            else
            {
                AdMediator_A46236.Visibility = Visibility.Visible;
            }

            if (localSettings.Values["SummonerName"] != null)
            {
                SummonerTextBlock.Text = (string)localSettings.Values["SummonerName"];
                string Icon = String.Format("http://ddragon.leagueoflegends.com/cdn/5.20.1/img/profileicon/{0}.png", localSettings.Values["SummonerIconID"]);
                SummonerIconBrush.ImageSource = new BitmapImage(new Uri(Icon, UriKind.Absolute));
                SummonerButton.Visibility = Visibility.Collapsed;
                SummonerIconGrid.Visibility = Visibility.Visible;
                InitialAccountCreation = false;
            }
        }
Beispiel #28
0
 public static async System.Threading.Tasks.Task<bool> RemoveAdsClick(object sender, RoutedEventArgs e)
 {
     if (!CurrentApp.LicenseInformation.ProductLicenses["removedAds"].IsActive)
     {
         try
         {
             PurchaseResults result = await CurrentApp.RequestProductPurchaseAsync("removedAds");
             if (result.Status == ProductPurchaseStatus.Succeeded)
             {
                 // Update license information
                 licenseInformation = CurrentApp.LicenseInformation;
                 return true;
             }
             else return false;
         }
         catch (Exception)
         {
             // The in-app purchase was not completed because 
             // an error occurred.
             return false;
         }
     }
     else
     {
         // The customer already owns this feature.
         return true;
     }
 }
Beispiel #29
0
        private async void DoPurchase(string productId)
        {
            try
            {
                bool licenceActiv = false;
                if (StoreConfig.STORE_TEST_MODE)
                {
                    // Kick off purchase; don't ask for a receipt when it returns
                    await MockCurApp.RequestProductPurchaseAsync(productId, false);
                    licInfosMock = MockCurApp.LicenseInformation;
                    licenceActiv = licInfosMock.ProductLicenses[productId].IsActive;
                }
                else
                {
                    // Kick off purchase; don't ask for a receipt when it returns
                    await CurApp.RequestProductPurchaseAsync(productId, false);
                    licInfos = CurApp.LicenseInformation;
                    licenceActiv = licInfos.ProductLicenses[productId].IsActive;
                }

                if (licenceActiv)
                {
                    
                    OnItemPurchasedCB(productId);
                }
                else
                {
                    SoomlaUtils.LogDebug(TAG,"Purchase cancelled " + productId);
                    OnItemPurchaseCancelCB(productId, false);
                }


            }
            catch (Exception ex)
            {
                // When the user does not complete the purchase (e.g. cancels or navigates back from the Purchase Page), an exception with an HRESULT of E_FAIL is expected.
                SoomlaUtils.LogDebug(TAG,ex.Message);
                OnItemPurchaseCancelCB(productId, true);
            }
        }
Beispiel #30
0
        private void initializeLicense()
        {
            // Initialize the license info for use in the app that is uploaded to the Store.
            // uncomment for release
            licenseInformation = CurrentApp.LicenseInformation;

            // Initialize the license info for testing.
            // comment the next line for release
            //licenseInformation = CurrentAppSimulator.LicenseInformation;
            
            // Register for the license state change event.
            licenseInformation.LicenseChanged += new LicenseChangedEventHandler(licenseChangedEventHandler);

            licenseChangedEventHandler();
        }
        public async Task Init(Data.MagazineViewModel mag, bool local = false)
        {
            thumbnail.Source = mag.Image;
            title.Text = mag.Title;
            subtitle.Text = mag.Subtitle;

            if (local)
            {
                _item = mag;

                noOptions.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                subscribeBtnContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                subscribeBtn1Container.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                buyMagContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                getSampleContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

                openContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;
                delete.Text = "Delete";
                deleteContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;

                if (_item.IsSampleDownloaded)
                    subtitle.Text += " SAMPLE";

                this.Visibility = Windows.UI.Xaml.Visibility.Visible;

                return;
            }

            if (mag.IsSampleDownloaded)
            {
                getSample.Text = "Open sample";
                getSampleButton.Content = "\xe16f";
            }
            else
            {
                getSample.Text = "Download sample";
                getSampleButton.Content = "\xe118";
            }

            _item = mag;
            product_id = mag.FileName.Replace("_.pdf", "");
            relativePath = mag.RelativePath;
            licenseInformation = CurrentAppSimulator.LicenseInformation;

            var appListing = await CurrentAppSimulator.LoadListingInformationAsync();
            var productListings = appListing.ProductListings;
            ProductListing product = null;
            
            //statusContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;
            //buttonContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            subscribeBtnContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            subscribeBtn1Container.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            buyMagContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            getSampleContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;
            openContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            deleteContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

            this.Visibility = Windows.UI.Xaml.Visibility.Visible;

            try
            {
                product = productListings[product_id];

            }
            catch { }

            if (product != null)
            {
                if (!licenseInformation.ProductLicenses[product.ProductId].IsActive)
                {
                    string receipt = "";
                    try
                    {
                        receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();
                        receipt = DownloadManager.GetProductReceiptFromAppReceipt(product.ProductId, receipt);

                    }
                    catch { }
                    if (receipt != "")
                    {
                        await DownloadManager.StoreReceiptAsync(product_id, receipt);
                        var app = Application.Current as App;
                        var url = DownloadManager.GetUrl(product_id, receipt, relativePath, app.ClientName, app.MagazineName);
                        if (!url.Equals("NoReceipt"))
                        {
                            Bought(this, url);
                            return;
                        }
                        else
                        {
                            noOptions.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                            buyMag.Text = "Buy this number for: " + product.FormattedPrice;
                            buyMagContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        }
                    }
                    else
                    {
                        var app = Application.Current as App;
                        var url = await DownloadManager.GetUrl(product_id, relativePath, app.ClientName, app.MagazineName);
                        if (!url.Equals("NoReceipt"))
                        {
                            Bought(this, url);
                            return;
                        }
                        else
                        {
                            noOptions.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                            buyMag.Text = "Buy this number for: " + product.FormattedPrice;
                            buyMagContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        }
                    }
                }
                else
                {
                    if (Bought != null)
                    {
                        var app = Application.Current as App;
                        var url = await DownloadManager.GetUrl(product_id, relativePath, app.ClientName, app.MagazineName);
                        if (url.Equals("NoReceipt"))
                        {
                            string receipt = "";
                            try
                            {
                                receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();

                            }
                            catch { }
                            if (receipt != "")
                            {
                                await DownloadManager.StoreReceiptAsync(product_id, receipt);
                                url = DownloadManager.GetUrl(product_id, receipt, relativePath, app.ClientName, app.MagazineName);
                                if (!url.Equals("NoReceipt"))
                                {
                                    Bought(this, url);
                                    return;
                                }
                                else
                                {
                                    var messageDialog = new MessageDialog("No Receipt");
                                    var task = messageDialog.ShowAsync().AsTask();
                                }
                            }
                            else
                            {
                                var messageDialog = new MessageDialog("No Receipt");
                                var task = messageDialog.ShowAsync().AsTask();
                            }
                        }
                        else
                        {
                            Bought(this, url);
                            return;
                        }
                    }
                    else
                    {
                        var messageDialog = new MessageDialog("Purchase successfull");
                        var task = messageDialog.ShowAsync().AsTask();
                    }
                }
            }

            product = null;

            try {

                product = productListings["yearlysubscription"];

            } catch { }

            if (product != null)
            {
                if (!licenseInformation.ProductLicenses[product.ProductId].IsActive)
                {
                    string receipt = "";
                    try {
                        receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();
                        receipt = DownloadManager.GetProductReceiptFromAppReceipt(product.ProductId, receipt);

                    } catch { }
                    if (receipt != "")
                    {
                        await DownloadManager.StoreReceiptAsync("yearlysubscription", receipt);
                        var app = Application.Current as App;
                        var url = DownloadManager.GetUrl("yearlysubscription", receipt, relativePath, app.ClientName, app.MagazineName);
                        if (!url.Equals("NoReceipt"))
                        {
                            Bought(this, url);
                            return;
                        }
                        else
                        {
                            noOptions.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                            subscribeBtn.Text = "Subscribe for 1 year: " + product.FormattedPrice;
                            subscribeBtnContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        }
                    }
                    else 
                    {
                        var app = Application.Current as App;
                        var url = await DownloadManager.GetUrl("yearlysubscription", relativePath, app.ClientName, app.MagazineName);
                        if (!url.Equals("NoReceipt"))
                        {
                            Bought(this, url);
                            return;
                        }
                        else
                        {
                            noOptions.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                            subscribeBtn.Text = "Subscribe for 1 year: " + product.FormattedPrice;
                            subscribeBtnContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        }
                    }
                }
                else
                {
                    //var productLicense1 = licenseInformation.ProductLicenses["Subscription1"];
                    //var longdateTemplate = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("longdate");
                    //var text = "Subscription1 expires on: " + longdateTemplate.Format(productLicense1.ExpirationDate);
                    //var remainingDays = (productLicense1.ExpirationDate - DateTime.Now).Days;
                    if (Bought != null)
                    {
                        var app = Application.Current as App;
                        var url = await DownloadManager.GetUrl("yearlysubscription", relativePath, app.ClientName, app.MagazineName);
                        if (url.Equals("NoReceipt"))
                        {
                            string receipt = "";
                            try {
                                receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();

                            }  catch { }
                            if (receipt != "")
                            {
                                await DownloadManager.StoreReceiptAsync("yearlysubscription", receipt);
                                url = DownloadManager.GetUrl("yearlysubscription", receipt, relativePath, app.ClientName, app.MagazineName);
                                if (!url.Equals("NoReceipt"))
                                {
                                    Bought(this, url);
                                    return;
                                }
                                else
                                {
                                    var messageDialog = new MessageDialog("No Receipt");
                                    var task = messageDialog.ShowAsync().AsTask();
                                }
                            }
                            else
                            {
                                var messageDialog = new MessageDialog("No Receipt");
                                var task = messageDialog.ShowAsync().AsTask();
                            }
                        }
                        else
                        {
                            Bought(this, url);
                            return;
                        }
                    }
                    else
                    {
                        var messageDialog = new MessageDialog("Purchase successfull");
                        var task = messageDialog.ShowAsync().AsTask();
                    }
                }
            }

            product = null;

            try {
                product = productListings["monthlysubscription"];

            } catch { }

            if (product != null)
            {
                if (!licenseInformation.ProductLicenses[product.ProductId].IsActive)
                {
                    string receipt = "";
                    try
                    {
                        receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();
                        receipt = DownloadManager.GetProductReceiptFromAppReceipt(product.ProductId, receipt);

                    }
                    catch { }
                    if (receipt != "")
                    {
                        await DownloadManager.StoreReceiptAsync("monthlysubscription", receipt);
                        var app = Application.Current as App;
                        var url = DownloadManager.GetUrl("monthlysubscription", receipt, relativePath, app.ClientName, app.MagazineName);
                        if (!url.Equals("NoReceipt"))
                        {
                            Bought(this, url);
                            return;
                        }
                        else
                        {
                            noOptions.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                            subscribeBtn1.Text = "Subscribe for 1 month: " + product.FormattedPrice;
                            subscribeBtn1Container.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        }
                    }
                    else
                    {
                        var app = Application.Current as App;
                        var url = await DownloadManager.GetUrl("monthlysubscription", relativePath, app.ClientName, app.MagazineName);
                        if (!url.Equals("NoReceipt"))
                        {
                            Bought(this, url);
                            return;
                        }
                        else
                        {
                            noOptions.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                            subscribeBtn1.Text = "Subscribe for 1 month: " + product.FormattedPrice;
                            subscribeBtn1Container.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        }
                    }
                }
                else
                {
                    if (Bought != null)
                    {
                        var app = Application.Current as App;
                        var url = await DownloadManager.GetUrl("monthlysubscription", relativePath, app.ClientName, app.MagazineName);
                        if (url.Equals("NoReceipt"))
                        {
                            string receipt = "";
                            try
                            {
                                receipt = await CurrentAppSimulator.GetAppReceiptAsync().AsTask();

                            }
                            catch { }
                            if (receipt != "")
                            {
                                await DownloadManager.StoreReceiptAsync("monthlysubscription", receipt);
                                url = DownloadManager.GetUrl("monthlysubscription", receipt, relativePath, app.ClientName, app.MagazineName);
                                if (!url.Equals("NoReceipt"))
                                {
                                    Bought(this, url);
                                    return;
                                }
                                else
                                {
                                    var messageDialog = new MessageDialog("No Receipt");
                                    var task = messageDialog.ShowAsync().AsTask();
                                }
                            }
                            else
                            {
                                var messageDialog = new MessageDialog("No Receipt");
                                var task = messageDialog.ShowAsync().AsTask();
                            }
                        }
                        else
                        {
                            Bought(this, url);
                            return;
                        }
                    }
                    else
                    {
                        var messageDialog = new MessageDialog("Purchase successfull");
                        var task = messageDialog.ShowAsync().AsTask();
                    }
                }
            }

            if (buyMagContainer.Visibility == Windows.UI.Xaml.Visibility.Collapsed)
            {
                if (subscribeBtnContainer.Visibility == Windows.UI.Xaml.Visibility.Visible)
                {
                    //subscribeBtnContainer.Margin = new Thickness(0, 22, 0, 10);
                }
                else if (subscribeBtn1Container.Visibility == Windows.UI.Xaml.Visibility.Visible)
                {
                    //subscribeBtn1.Margin = new Thickness(0, 22, 0, 10);
                }
                else
                {
                    noOptions.Visibility = Windows.UI.Xaml.Visibility.Visible;
                }
            }

            //statusContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            //buttonContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;
        }
        /// <summary>
        /// Populates the page with content passed during navigation. Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session. The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            FavoritesDataSource favoritesDataSource = (FavoritesDataSource)App.Current.Resources["favoritesDataSource"];
            if (favoritesDataSource != null)
            {
                var items = new ObservableCollection<ConnectionData>(favoritesDataSource.Favorites.OrderBy(f => f.Name));
                this.DefaultViewModel["Items"] = items;

                this.emptyHint.Visibility = this.itemGridView.Items.Count == 0 ? Visibility.Visible : Visibility.Collapsed;
                this.SetupAppBar();
            }

#if DEBUG
            this.licenseInformation = CurrentAppSimulator.LicenseInformation;
#else
            this.licenseInformation = CurrentApp.LicenseInformation;
#endif
            this.RefreshTrialHint();
            this.licenseInformation.LicenseChanged += RefreshTrialHint;

            if (TerminalManager.Terminals.Count > 0)
            {
                this.previewGrid.ItemsSource = TerminalManager.Terminals;
                this.TopAppBar.IsOpen = true;
                await Task.Delay(1000);
                this.TopAppBar.IsOpen = false;
            }
            else
            {
                this.TopAppBar = null;
            }
        }
        public static void Init()
        {
#if DEBUG
            licenseInformation = Debug ? CurrentAppSimulator.LicenseInformation : CurrentApp.LicenseInformation;
#else
            licenseInformation = CurrentApp.LicenseInformation;
#endif
        }
        public async Task<InAppPurchaseHelper> Setup()
        {
            // license
            if (Simulate)
            {
#if DEBUG
                await SetupSimulation();
                m_License = CurrentAppSimulator.LicenseInformation;
                m_Listing = await CurrentAppSimulator.LoadListingInformationAsync();
                CanPurchase = true;
#endif
            }
            else
            {
                try
                {
                    m_License = CurrentApp.LicenseInformation;
                    m_Listing = await CurrentApp.LoadListingInformationAsync();
                    CanPurchase = true;
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(string.Format("Setup/License [{0}, {1}, {2}]", this.Key, this.Simulate, e.Message));
                    CanPurchase = false;
                }
            }

            if (!CanPurchase)
                return this; // :(

            try
            {
                // test setup
                m_License.LicenseChanged += () => { RaiseLicenseChanged(IsPurchased); };
                IReadOnlyDictionary<string, ProductLicense> _Licenses = m_License.ProductLicenses;
                if (!_Licenses.Any(x => x.Key.Equals(Key, StringComparison.CurrentCultureIgnoreCase)))
                    throw new KeyNotFoundException(Key);

                IReadOnlyDictionary<string, ProductListing> _Products = m_Listing.ProductListings;
                if (!_Products.Any(x => x.Key.Equals(Key, StringComparison.CurrentCultureIgnoreCase)))
                    throw new KeyNotFoundException(Key);

                // product
                m_Product = _Products[Key];
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("Setup/Tests [{0}, {1}, {2}]", this.Key, this.Simulate, e.Message));
                CanPurchase = false;
            }
            return this;
        }