Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Licensing Class not triggering at design time

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Licensing Support
View previous topic :: View next topic  
Author Message
Maximusi



Joined: 05 Nov 2018
Posts: 1

PostPosted: Mon Nov 05, 2018 12:49 am    Post subject: Licensing Class not triggering at design time Reply with quote

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?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 4879

PostPosted: Mon Nov 05, 2018 7:05 am    Post subject: Reply with quote

Have you checked out the following thread?

http://www.infralution.com/phpBB2/viewtopic.php?t=442
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Licensing Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group