コード例 #1
0
ファイル: Rating.cs プロジェクト: YiHaiHuang/HelperUWP
 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;
     }
 }
コード例 #2
0
        public static async void DisplayMessageDebug(Exception DebugMessage)
        {
#if DEBUG
            await Reporting.TextViewerAsync(DebugMessage.ToString());
#else
#endif
        }
コード例 #3
0
        public static async void DisplayMessageDebugExemption(Exception exeption)
        {
#if DEBUG
            await Reporting.TextViewerAsync(exeption.ToString());
#else
#endif
        }
コード例 #4
0
ファイル: LicenseInfo.cs プロジェクト: YiHaiHuang/HelperUWP
        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);
        }
コード例 #5
0
        public static async void DisplayMessageExemption(Exception exeption)
        {
#if DEBUG
            await Reporting.TextViewerAsync(exeption.ToString());
#else
            string        exc    = exeption.Message;
            MessageDialog dialog = new MessageDialog("There is an internal error" + "\"" + " Or try to restart your computer" + "," + " ErrorMessage " + "\"" + "\"" + exc + "\"", "Error");
            dialog.Commands.Add(new UICommand("Close", (com) =>
            {
            }));
            dialog.Commands.Add(new UICommand("Report", async(com) =>
            {
                string body = "ErrorMessage \"";
                var mailto  = new Uri(EmailAds + AppName + "&body=" + body + exc + " " + Environment.NewLine + DeviceInfo.GetDeviceInformation() + Environment.NewLine + "\"");
                await Launcher.LaunchUriAsync(mailto);
            }));
            await dialog.ShowAsync();
#endif
        }
コード例 #6
0
ファイル: LicenseInfo.cs プロジェクト: YiHaiHuang/HelperUWP
        /// <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);
        }