public void LoadLicense()
        {
            var dialog = _dialogManager.OpenFileDialog(new FileDialogModel
            {
                Filter      = "License files (*.xml)|*.xml|All files (*.*)|*.*",
                FilterIndex = 1
            });

            var validLicense = false;

            if (dialog.Result.GetValueOrDefault(false))
            {
                var licenseContent = ReadAllTextWithoutLocking(dialog.FileName);

                validLicense = licenseManager.TryInstallLicense(licenseContent);
            }

            if (validLicense && !LicenseExpirationChecker.HasLicenseExpired(licenseManager.CurrentLicense))
            {
                TryClose(true);
            }
            else
            {
                //todo: Display error saying that the license was invalid
            }
        }
Beispiel #2
0
        public void ImportLicense()
        {
            var dialog = windowManager.OpenFileDialog(new FileDialogModel
            {
                Filter      = "License files (*.xml)|*.xml|All files (*.*)|*.*",
                FilterIndex = 1
            });

            var result = LicenseInstallationResult.Failed;

            if (dialog.Result.HasValue && dialog.Result.Value)
            {
                var licenseContent = ReadAllTextWithoutLocking(dialog.FileName);
                result = licenseManager.TryInstallLicense(licenseContent);

                ImportMessage       = InstallationResultMessage[result];
                ImportWasSuccessful = result == LicenseInstallationResult.Succeeded;
            }

            if (result == LicenseInstallationResult.Succeeded)
            {
                ShowLicenseStatus();
                NotifyOfPropertyChange(nameof(CanExtendTrial));
                eventAggregator.PublishOnUIThread(new LicenseUpdated());
                ValidationResult = dialog.Result;
            }
        }
Beispiel #3
0
        public void LoadLicense()
        {
            var dialog = dialogManager.OpenFileDialog(new FileDialogModel
            {
                Filter      = "License files (*.xml)|*.xml|All files (*.*)|*.*",
                FilterIndex = 1
            });

            var validLicense = false;

            ValidationResult = null;

            if (dialog.Result.GetValueOrDefault(false))
            {
                var licenseContent = ReadAllTextWithoutLocking(dialog.FileName);

                validLicense = licenseManager.TryInstallLicense(licenseContent) == LicenseInstallationResult.Succeeded;
            }

            if (validLicense && !licenseManager.CurrentLicense.HasExpired())
            {
                TryClose(true);
            }
            else
            {
                ValidationResult = licenseManager.ValidationResult.Result;
            }
        }