/// <summary>Performs post-processing updates for actions performed through the <see cref="LicensingGui"/>.</summary> /// <remarks><para>This method is called by the <see cref="LicensingGui.LicenseManagementActionComplete"/> event handler method. In the /// sample application form source code (i.e. MainForm.cs), this method is similarly named PostProcessingUpdates. This might be named /// something like licensingGui1_LicenseManagementActionComplete in your application.</para></remarks> /// <param name="lic">The <see cref="License"/> being processed.</param> /// <param name="licGui">The <see cref="LicensingGui"/> used to process updates for the license.</param> /// <param name="e">The post-processing event arguments returned from the <see cref="LicensingGui"/> object.</param> /// <param name="newValidationSuccessful">Whether or not validation after processing updates has passed successfully.</param> internal static void PostProcessingUpdates(ref SampleLicense lic, ref LicensingGui licGui, ref LicenseManagementActionCompleteEventArgs e, out bool newValidationSuccessful) { //If an action was processed, run some post-processing actions. if (LicenseManagementActionTypes.ManualTriggerCode == e.ActionType) { //A trigger code needs to be processed... if (!lic.ProcessTriggerCode(e.LicenseID, e.Password, e.TriggerCodeNumber, e.TriggerCodeEventData)) { //If trigger code processing failed, show the error in the license management dialog. e.PostProcessingSuccessful = false; e.LastError = lic.LastError; } //Reload and revalidate the license file. if (lic.LoadFile(LicenseConfiguration.LicenseFilePath)) { newValidationSuccessful = lic.Validate(); } else { newValidationSuccessful = false; } } else if (LicenseError.ERROR_WEBSERVICE_RETURNED_FAILURE == e.LastError.ErrorNumber) { //The last action failed because the license is no longer valid in SOLO Server, so remove the license from the system. if (ShouldLicenseBeRevoked(lic.LastError.ExtendedErrorNumber)) { RevokeLicense(ref lic, ref licGui); newValidationSuccessful = false; } else { //The web service returned an error, which should be disabled to the user. e.PostProcessingSuccessful = false; e.LastError = lic.LastError; } } else if (LicenseManagementActionTypes.OnlineDeactivation == e.ActionType || LicenseManagementActionTypes.ManualDeactivation == e.ActionType) { RevokeLicense(ref lic, ref licGui); newValidationSuccessful = false; return; } else if (e.ProcessedSuccessfully && (LicenseManagementActionTypes.OnlineActivation == e.ActionType || LicenseManagementActionTypes.OnlineRefresh == e.ActionType || LicenseManagementActionTypes.ManualActivation == e.ActionType || LicenseManagementActionTypes.ManualRefresh == e.ActionType)) { //This was a successful activation or license refresh attempt, which means we have a new license to process. lic.ProcessNewLicense(ref e, out newValidationSuccessful); } newValidationSuccessful = lic.Validate(); }