Beispiel #1
0
 public static void RateCounterCustom(int count, string message, string title, string buttonColoredConten)
 {
     try
     {
         var settingsContainer = ApplicationData.Current.RoamingSettings;
         settingsContainer.Values[RateKey] = false;
         int started = 0;
         if (settingsContainer.Values.ContainsKey(StartedKey))
         {
             started = (int)settingsContainer.Values[StartedKey];
         }
         started++;
         settingsContainer.Values[StartedKey] = started;
         if (started == count)
         {
             settingsContainer.Values[RateKey] = true;
         }
         Rating.RateAndReview(message, title, buttonColoredConten);
     }
     catch (Exception ex)
     {
         Reporting.DisplayMessage(ex.Message);
         return;
     }
 }
Beispiel #2
0
        public async static Task <bool> LicenseRequestDirectAsync(string productKey, bool InternetEnabled)
        {
            bool IsSuccess = false;

            if (!licenseInformation.ProductLicenses[productKey].IsActive)
            {
                if (NetworkInterface.GetIsNetworkAvailable() == InternetEnabled)
                {
                    try
                    {
                        if (!licenseInformation.ProductLicenses[productKey].IsActive)
                        {
#if DEBUG
                            await CurrentAppSimulator.RequestProductPurchaseAsync(productKey);
#else
                            var result = await CurrentApp.RequestProductPurchaseAsync(productKey);
#endif

                            if (licenseInformation.ProductLicenses[productKey].IsActive)
                            {
                                HelperUWP.Reporting.DisplayMessage("Product Purchased Successfully." + HelperUWP.Reporting.AppName, "Successfully Purchased");
                                IsSuccess = true;
                            }
                            else
                            {
                                HelperUWP.Reporting.DisplayMessage("Product key was not purchased" + HelperUWP.Reporting.AppName + " Please restart app and try again" + " -> UpradePage");
                                IsSuccess = false;
                            }
                        }
                        else
                        {
                            Reporting.DisplayMessage("Product already purchased");
                            IsSuccess = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        HelperUWP.Reporting.DisplayMessage(ex.Message + "Product key was not purchased" + HelperUWP.Reporting.AppName + " Please restart app and try again" + "->UpradePage");
                        IsSuccess = false;
                    }
                }
                else
                {
                    HelperUWP.Reporting.NoConnections();
                }
            }
            else
            {
                IsSuccess = true;
            }



            return(IsSuccess);
        }
Beispiel #3
0
        /// <summary>
        /// Create a purchase message dialog with custom product key, Title, Description
        /// </summary>
        /// <param name="productKey"></param>
        /// <param name="title"></param>
        /// <param name="description"></param>
        public async static Task <bool> DownloadLicenseDialogAsync(string productKey, string title, string description, string buttonColored, string buttonColorLess, bool InternetEnabled)
        {
            bool IsSuccessPurchase = false;

            try
            {
                if (!licenseInformation.ProductLicenses[productKey].IsActive)
                {
                    MessageDialog dialog = new MessageDialog(description, title);
                    dialog.Commands.Add(new UICommand(buttonColored, async(com) =>
                    {
                        if (NetworkInterface.GetIsNetworkAvailable() == InternetEnabled)
                        {
                            try
                            {
#if DEBUG
                                await CurrentAppSimulator.RequestProductPurchaseAsync(productKey);
#else
                                var result = await CurrentApp.RequestProductPurchaseAsync(productKey);
#endif

                                if (licenseInformation.ProductLicenses[productKey].IsActive)
                                {
                                    HelperUWP.Reporting.DisplayMessage("Successfully Purchased the product forever! " + HelperUWP.Reporting.AppName, "Successfully Purchased");
                                    IsSuccessPurchase = true;
                                }
                                else
                                {
                                    HelperUWP.Reporting.DisplayMessage("Product key was not purchased" + HelperUWP.Reporting.AppName + " Please restart app and try again" + " -> UpradePage");
                                    IsSuccessPurchase = false;
                                }
                            }
                            catch (Exception ex)
                            {
                                HelperUWP.Reporting.DisplayMessage(ex.Message + "Product key was not purchased" + HelperUWP.Reporting.AppName + " Please restart app and try again" + "->UpradePage");
                                IsSuccessPurchase = false;
                            }
                        }
                        else
                        {
                            HelperUWP.Reporting.NoConnections();
                        }
                    }));
                    dialog.Commands.Add(new UICommand(buttonColorLess, (com) =>
                    {
                    }));
                    await dialog.ShowAsync();
                }
                else
                {
                    Reporting.DisplayMessage("Product key already purchased");
                    IsSuccessPurchase = true;
                }
            }
            catch (Exception ex)
            {
                HelperUWP.Reporting.DisplayMessage(ex.Message + ":Product key was not purchased" + HelperUWP.Reporting.AppName + " Please restart app and try again" + "->UpradePage");
                IsSuccessPurchase = false;
            }
            return(IsSuccessPurchase);
        }