Maximusi
Joined: 05 Nov 2018 Posts: 1
|
Posted: Mon Nov 05, 2018 12:49 am Post subject: Licensing Class not triggering at design time |
|
|
Good Morning,
I don't know whether I am being really thick here but I have created a Class library which has two files in it:
> Licensing.vb
This imports Infralution.Licensing.Forms and inherits EncryptedLicenseProvider. It contains license_Parameters as string as well as _licensedfile which has a path to a .lic file (file doesn't actually exist) and lastly in public sub new has mybase.new(license_parameters, _licensefile)
> MyClassName.vb
This also imports Infralution.Licensing.Forms and contains <LicenseProvider>
This contains this code as varibles:
Code: | Private Const PRODUCT_NAME As String = "MVC.Tools.Encryption"
Shared _lastDesignContext As LicenseContext
Shared _licenseChecked As Boolean = False |
Then under Public sub new:
Code: | Public Sub New()
MyBase.New()
If LicenseManager.CurrentContext.UsageMode = LicenseUsageMode.Designtime Then
If Not LicenseManager.IsLicensed(GetType(MyClassName)) Then
If Not LicenseManager.CurrentContext Is _lastDesignContext Then
Dim license As EncryptedLicense = Nothing
While license Is Nothing
Dim evaluationMonitor As New RegistryEvaluationMonitor("evalpasswordhere")
Dim dialog As New EvaluationDialog(evaluationMonitor, PRODUCT_NAME)
Dim dialogResult As EvaluationDialogResult = dialog.ShowDialog()
If dialogResult = EvaluationDialogResult.Exit Then
Throw New LicenseException(GetType(MyClassName), Me, "Control not Licensed")
End If
If dialogResult = EvaluationDialogResult.Continue Then Exit While
If dialogResult = EvaluationDialogResult.InstallLicense Then
Dim licenseForm As New EncryptedLicenseInstallForm()
license = licenseForm.ShowDialog(New MyControlLicenseProvider(), license, PRODUCT_NAME)
End If
End While
_lastDesignContext = LicenseManager.CurrentContext
End If
End If
Else
If Not _licenseChecked Then
If Not IsLicensed() Then
MessageBox.Show("This application was created using an unlicensed version and will have limited functionality.", "Unlicensed Application")
End If
End If
End If
_licenseChecked = True
End Sub |
This IsLicensed() routine is:
Code: | Private Function IsLicensed()
Return LicenseManager.IsLicensed(GetType(MyClassName))
End Function |
Now I have created a Forms app added reference to this DLL and used it in designtime without a problem and then when I run the application It displays the message box saying "This application was created using an unlicensed version and will have limited functionality" which I put in.
The problem is just nothing appears to be happening during design time.
What have I missed? |
|