public virtual void RenewActivation() { try { _licenseCheckerHkcu.ActivateWithKey(Activation.Key); } finally { LoadActivation(); } }
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))); }