View previous topic :: View next topic |
Author |
Message |
Jammer
Joined: 01 Oct 2017 Posts: 16
|
Posted: Wed Mar 07, 2018 9:37 pm Post subject: Evaluation Timer Doesn't Appear to Prevent App Launch |
|
|
I'm testing this implementation in development (I'm still on a trial of ILS).
while (!LicData.IsValid)
{
EvaluationMonitor evaluationMonitor = new RegistryEvaluationMonitor("<snipped>");
EvaluationDialog evaluationDialog = new EvaluationDialog
{
TrialDays = 1,
ExtendedTrialDays = 1
};
EvaluationDialogResult dialogResult = evaluationDialog.ShowDialog(evaluationMonitor);
if (dialogResult == EvaluationDialogResult.Exit)
{
// exit the app
Current.Shutdown();
return false;
}
if (dialogResult == EvaluationDialogResult.Continue) break; // exit the loop
if (dialogResult == EvaluationDialogResult.InstallLicense)
{
LicData.InstallLicense();
}
}
The dialog pops up but still has the continue evaluation button and allows me to just click that and launch the app.
Is this a limitation of the trial? I was hoping to test licensing the app. Or have I got a logical error in the code above? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
|
Back to top |
|
|
Jammer
Joined: 01 Oct 2017 Posts: 16
|
Posted: Thu Mar 08, 2018 7:55 am Post subject: |
|
|
Thanks for the reply. I had already read that which is why I'd set the values to the the same value in my code. The "Continue Evaluation" button is always enabled.
"If you don't want the continue button to be enabled at all once the TrialDays period has expired then you can just set ExtendedTrialDays to the same value as TrialDays."
As far as I can tell this is exactly what I've done but it's still enabling the button. |
|
Back to top |
|
|
Jammer
Joined: 01 Oct 2017 Posts: 16
|
Posted: Thu Mar 08, 2018 7:00 pm Post subject: |
|
|
I've just launched the app to check this and I've noticed that the property:
FirstUseDate
Is displaying what I would expect to see if I called DateTime.Now. Whereas the first time I ran this code with the current password value I'm using was the 02/02/2018 - 6 days ago.
I was expecting this component to read a date from a key but it always displays the result of DateTime.Now recorded for the FirstUseDate.
In fact whenever a run the app, FirstUseDate and LastUseDate are always identical values and the same value as my local system date time!
If I run the code like this (password is the same btw):
EvaluationMonitor evaluationMonitor = new RegistryEvaluationMonitor("<snip>", false, false)
I get a NullReferenceException with this stack trace:
at Infralution.Licensing.WPF.RegistryEvaluationMonitor.Decrypt(Byte[] data)
at Infralution.Licensing.WPF.RegistryEvaluationMonitor.DecryptDate(Byte[] data)
at Infralution.Licensing.WPF.RegistryEvaluationMonitor.ReadData(String productId, DateTime& firstUseDate, DateTime& lastUseDate, Int32& usageCount)
at Infralution.Licensing.WPF.RegistryEvaluationMonitor..ctor(String password, Boolean countUsageOncePerDay, Boolean suppressExceptions)
How can I successfully test this feature? |
|
Back to top |
|
|
Jammer
Joined: 01 Oct 2017 Posts: 16
|
Posted: Thu Mar 08, 2018 7:51 pm Post subject: |
|
|
Right, I think I know what might have happened.
I think I ran it first with a different password and I think it's now finding something to read but since the password changed it can no longer decrypt it. I've just checked my source control log and I don't have a record of the previous password to revert to.
Bugger.
How can I recover (yes, I know I'm stupid) my dev box from this state? |
|
Back to top |
|
|
Jammer
Joined: 01 Oct 2017 Posts: 16
|
Posted: Thu Mar 08, 2018 8:10 pm Post subject: |
|
|
Wow, sorry for the spam!!
I've just figured this all out. I've pulled the source from the RegistryEvaluation class so I could step through. I then pulled the keys and it's back up and running.
I'll put more effort into not doing stupid things. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Mar 09, 2018 12:31 am Post subject: |
|
|
Thanks for letting us know. Great that you've got it solved _________________ Infralution Support |
|
Back to top |
|
|
|