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 

Any way to show license key in the about page

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



Joined: 23 Apr 2007
Posts: 80

PostPosted: Sun May 06, 2007 11:25 pm    Post subject: Any way to show license key in the about page Reply with quote

Is there any way to put the license key, once installed, in a label, on the 'About' form?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon May 07, 2007 9:00 am    Post subject: Reply with quote

Just store the EncryptedLicense in a shared (or static) variable, provide a property to get it and then from your about box simply set the label. So if you read the license in a module called MyModule and add a property called License to return the license you would simple call:

label.Text = MyModule.License.LicenseKey

in the constructor of the AboutBox
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Sputnik



Joined: 23 Apr 2007
Posts: 80

PostPosted: Sat Jun 09, 2007 8:53 pm    Post subject: Reply with quote

Infralution wrote:
Just store the EncryptedLicense in a shared (or static) variable


Technically, I understand that - I've got a property setup in my Vars module, where I store the License_parameters, license_file, evaluation monitor, days of use, etc.

I guess what I'm missing is how to get and store the "EncryptedLicense"

I've tried doing quite a few versions of the following, to no avail:
Private enc As EncryptedLicense
Public ReadOnly Property License() As String
Get
License = enc
End Get
End Property
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Jun 11, 2007 12:59 am    Post subject: Reply with quote

The License property should not be declared as a string. Use the following in your module

Code:
Private myLicense As EncryptedLicense
Public ReadOnly Property MyLicense() As EncryptedLicense
    Get
        return myLicense
    End Get
    Set
        myLicense = Value
    End Set
End Property


Then in your code that reads the license set the MyLicense property. For example below I've modified the code from the sample licensed app project:

Code:
Dim sProvider As New EncryptedLicenseProvider
MyLicense = sProvider.GetLicense(LICENSE_PARAMETERS, LICENSE_FILE)

' check if there is a valid license for the application
'
If MyLicense Is Nothing Then
    ' if there is no valid license then display the standard license install form
    ' to allow the user to enter a license key
    '
    Dim licenseForm As New LicenseInstallForm
    MyLicense = licenseForm.ShowDialog("MyApp", "www.mycompany.com", LICENSE_FILE)
End If


The MyLicense property can now be accessed from your About form something like:

Code:
If MyLicense is Nothing then
   licLabel.Text = "Unlicensed"
Else
   licLabel.Text = MyLicense.LicenseKey
End If

_________________
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