예제 #1
0
        internal static bool ValidateLicense(string featureDescription, Window owner)
        {
            Settings      @default      = Settings.Default;
            LicenseEngine licenseEngine = new LicenseEngine();
            bool          flag          = licenseEngine.VerifyLicense(@default.App_LicenseKey, @default.App_LicenseEmail);

            if (!flag)
            {
                string           localizedString  = LocalizationProvider.GetLocalizedString("Pro_OneOfManyFeatures", false, "MarkdownPadStrings");
                string           localizedString2 = LocalizationProvider.GetLocalizedString("Pro_LearnMore", false, "MarkdownPadStrings");
                string           localizedString3 = LocalizationProvider.GetLocalizedString("Pro_OnlyAvailableInPro", false, "MarkdownPadStrings");
                MessageBoxResult messageBoxResult = CustomMessageBox.ShowYesNo(string.Concat(new string[]
                {
                    featureDescription,
                    " ",
                    localizedString,
                    StringUtilities.GetNewLines(2),
                    localizedString2
                }), localizedString3, LocalizationProvider.GetLocalizedString("Yes", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("No", false, "MarkdownPadStrings"), MessageBoxImage.Asterisk);
                if (messageBoxResult == MessageBoxResult.Yes)
                {
                    UpgradeProWindow upgradeProWindow = new UpgradeProWindow
                    {
                        Owner = owner
                    };
                    upgradeProWindow.ShowDialog();
                }
            }
            return(flag);
        }
예제 #2
0
        private void VerifyLicense()
        {
            if (string.IsNullOrEmpty(this.LicenseKey) || string.IsNullOrEmpty(this.LicenseEmail))
            {
                return;
            }
            LicenseEngine licenseEngine = new LicenseEngine();
            bool          flag          = licenseEngine.VerifyLicense(this.LicenseKey, this.LicenseEmail);

            if (!licenseEngine.LicenseProcessed)
            {
                return;
            }
            if (!flag)
            {
                CustomMessageBox.ShowOK(LocalizationProvider.GetLocalizedString("License_FailedMessage", false, "MarkdownPadStrings") + StringUtilities.GetNewLines(2) + LocalizationProvider.GetLocalizedString("License_PleaseVerify", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("License_FailedTitle", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("OK", false, "MarkdownPadStrings"), MessageBoxImage.Exclamation);
                return;
            }
            CustomMessageBox.ShowOK(LocalizationProvider.GetLocalizedString("License_SuccessMessage", false, "MarkdownPadStrings") + StringUtilities.GetNewLines(2) + licenseEngine.LicensedToMessage, LocalizationProvider.GetLocalizedString("License_SuccessTitle", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("OK", false, "MarkdownPadStrings"), MessageBoxImage.Asterisk);
            this._settings.App_LicenseEmail = this.LicenseEmail;
            this._settings.App_LicenseKey   = this.LicenseKey;
            this.IsLicensed = true;
            base.Close();
        }