How to fire an event when MaxDaysOffline is reached
When the MaxDaysOffline period is exceeded, QLM executes the action specified in the property OfflinePeriodExceededAction.
If your application is developed in .NET, one of the possible actions is to fire an event. To fire an event when MaxDaysOffline is reached, you must create an event handler and register it as follows:
privatevoidRegisterEvent(){ // Assuming lv is an instance of the LicenseValidator class // Configure QLM to fire an eventlv.QlmLicenseObject.OfflinePeriodExceededAction=EOfflinePeriodExceededAction.FireEvent; //Specify the event to firelv.QlmLicenseObject.OfflinePeriodExceeded_Event+= OnOfflinePeriodExceeded; // Enable server side validationlv.QlmLicenseObject.ValidateOnServer=true;}privatevoidOnOfflinePeriodExceeded(object sender,OfflinePeriodExceeded_EventArgs e){String msg =String.Format("Offline period exceeded. Error: {0}",e.errorMessage);MessageBox.Show(msg);}
By default, while the application is running, QLM will try to connect to the server once per day. For testing purposes, you will want to accelerate this process. Add the function below to your application and call it after calling RegisterEvent(). Remember to remove the call to MaxDaysOfflineTest before shipping your product.
privatevoidMaxDaysOfflineTest(){ // Assuming lv is an instance of the LicenseValidator class // Start the timer immediatelylv.QlmLicenseObject.QlmTimerDelayStart=0; // Verify connectivity every minutelv.QlmLicenseObject.QlmTimerFrequency=1; // specify the number of days a client can remain offlinelv.QlmLicenseObject.MaxDaysOffline=0; // Enable NO connectivity simulation modelv.QlmLicenseObject.SimulateNoConnectivity=true;}