View previous topic :: View next topic |
Author |
Message |
Sputnik
Joined: 23 Apr 2007 Posts: 80
|
Posted: Sun May 06, 2007 11:25 pm Post subject: Any way to show license key in the about page |
|
|
Is there any way to put the license key, once installed, in a label, on the 'About' form? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon May 07, 2007 9:00 am Post subject: |
|
|
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 |
|
|
Sputnik
Joined: 23 Apr 2007 Posts: 80
|
Posted: Sat Jun 09, 2007 8:53 pm Post subject: |
|
|
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 |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Jun 11, 2007 12:59 am Post subject: |
|
|
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 |
|
|
|