protected virtual ProductRights DetermineRights() { ProductRights rights = ProductRights.None; // Apply License override if applicable if (LicenseServices.LicenseInformation.HasRegisteredLicenseKey) { rights = DetermineRightsFromLicense(LicenseServices.LicenseInformation.RegisteredLicense); } else if (LicenseServices.LicenseInformation.HasDefaultLicenseKey) { rights = DetermineRightsFromLicense(LicenseServices.LicenseInformation.DefaultLicense); } if (LicenseServices.LicenseInformation.HasLicenseOverrideCommand) { rights = ApplyLicenseCommand(rights, LicenseServices.LicenseInformation.LicenseOverrideCommand); } return(rights); }
protected virtual ProductRights ApplyLicenseCommand(ProductRights rights, ProductLicenseCommand licenseCommand) { switch (LicenseServices.LicenseInformation.LicenseOverrideCommand.Action) { case ProductLicenseAction.Enable: //rights.FeatureRights = ProductFeatureRights.Full; // If the command is to enable, then we simply remove the override command and let the license rights apply. // This behaviour prohibits enabling of an expired license (user will need new license) rights.FeatureRights = rights.FeatureRights; break; case ProductLicenseAction.DisableSoftware: rights.FeatureRights = ProductFeatureRights.None; break; case ProductLicenseAction.CrippleSoftware: rights.FeatureRights = ProductFeatureRights.Partial; break; } return(rights); }
static ProductRights() { _none = new ProductRights(); }