View previous topic :: View next topic |
Author |
Message |
PeterJ
Joined: 12 May 2017 Posts: 8
|
Posted: Fri May 12, 2017 3:34 pm Post subject: Background Automatic renewal of expiring license |
|
|
Hi again,
Some of our software is designed to run for several weeks at a time, but is also sold on a subscription model run as pay per month.
So we plan to implement ILS using Expiry dates that we will automatically update at our end every time their payment arrives.
Each time the application starts up, it calls GetLicense, which (perfectly!) automatically requests an updated license if it sees that the current one has expired. This will of course pick up the new expiry date from our server and all is well.
The scenario I need to handle though is:
1) Application starts up, license has 2 days left on it's license
2) The customers payment arrives, we update the Expiry date giving them another 30 days
2) Time passes, and now we are at 3 days later, the application has not been restarted, so how do we get the updated expiry date from our server?
Do any of the built in Background checks automatically pull down new Expiry Information, or should we build a timer into our product that fires at (for example) ExpiryDate-1Day (then every 6 hours or so) and calls GetLicense(true,true) to silently force a round trip to the server, or is there another method that we should use?
Another scenario of course is that the customer HASN'T paid, so we haven't extended the expiry date - again, as there are no "expired" events raised by any of the ILS objects, I presume we should be checking that ourselves - and I suppose, given the above scenario, we can then call GetLicense and prompt the user accordingly with a warning that it's nearly expired/ has expired
Thanks for your help, |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon May 15, 2017 11:04 pm Post subject: |
|
|
The StartBackgroundReauthentication method starts a background process that will automatically update the license (including the expiry date) if it has been updated. By default this will update the license once per day (24 hours) and continue to do so while the application is running. You can however change the reauthentication interval. If the license has expired then the Background reauthentication will, by default exit the application. If the license has been updated and the expiry date extended then it will just continue to work - so I think it will do exactly what you want. _________________ Infralution Support |
|
Back to top |
|
|
PeterJ
Joined: 12 May 2017 Posts: 8
|
Posted: Tue May 16, 2017 4:20 pm Post subject: |
|
|
Ok understood.
We'll be using the WPF library, how does the background auth trigger the exit of the application? I suspect we will likely need to intercept that so we can gracefully announce and shutdown |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue May 16, 2017 10:23 pm Post subject: |
|
|
By default it calls:
System.Windows.Application.Current.Dispatcher.InvokeShutdown()
and displays an error message. You can change this behaviour by handling the AuthenticatedLicenseProvider.BackgroundReauthenticationFailed event yourself. _________________ Infralution Support |
|
Back to top |
|
|
PeterJ
Joined: 12 May 2017 Posts: 8
|
Posted: Thu May 18, 2017 8:59 am Post subject: |
|
|
That's great news - thanks for the info - we're off to your store to purchase now then |
|
Back to top |
|
|
|