Ejemplo n.º 1
0
 public virtual void RenewActivation()
 {
     try
     {
         _licenseCheckerHkcu.ActivateWithKey(Activation.Key);
     }
     finally
     {
         LoadActivation();
     }
 }
Ejemplo n.º 2
0
        private Option <Activation, LicenseError> RenewActivation()
        {
            var activation = _licenseChecker.GetSavedActivation();

            if (activation.Exists(a => a.ActivationMethod == ActivationMethod.Offline))
            {
                return(activation);
            }

            if (activation.Exists(IsActivationPeriodStillValid))
            {
                return(activation);
            }

            var licenseKey = activation.Match(
                some: a => a.Key.Some <string, LicenseError>(),
                none: e => _licenseChecker.GetSavedLicenseKey());

            return(licenseKey.Match(
                       some: key => _licenseChecker.ActivateWithKey(key),
                       none: e => Option.None <Activation, LicenseError>(LicenseError.NoLicenseKey)));
        }