Private Function CheckRegistration() As Boolean
Try
Dim oVendor As New EHL7_mc2005.HL7Vendor
Dim sComment As String = "", sMessage As String = ""
Dim oLicense As EHL7_mc2005.ProductLicense
CheckRegistration = True
With oVendor
If .IsRegistered Then
'The objects are registered. They should work, BUT
'We'll test one more thing
If Not .LicenseExpired Then
oLicense = Nothing
oVendor = Nothing
Exit Function
End If
End If
End With
oLicense = oVendor.NewProductLicense()
'At this point we know that the objects are either unregistered
'OR they are using a DEMO license which has expired. Either way, some
'kind of action must be taken before we can allow the application to continue
'in this example we are using the User Interface to pop up a dialog
'for the EasyHL7 Account Number, Password, and a Comment.
If MsgBox("Show the user interface with the option to activate a Developer's license?", _
MsgBoxStyle.YesNo, "Show Which Method") = MsgBoxResult.No Then
'By passing FALSE in (or omitting) the optional 4th parameter
'there will be no option for the user to activate
'the computer with a developer's license
If Not oLicense.ShowActivation1(, , , False) Then
If oLicense.IsError Then
MsgBox(oLicense.LastError, MsgBoxStyle.ApplicationModal, "Error")
End If
oLicense = Nothing
CheckRegistration = False
Exit Function
End If
Else
'By passing TRUE in the optional 4th parameter there will be an option
'for the user to activate the computer with a developer's license
If Not oLicense.ShowActivation1(, , , True) Then
If oLicense.IsError Then
MsgBox(oLicense.LastError, MsgBoxStyle.ApplicationModal, "Error")
End If
oLicense = Nothing
CheckRegistration = False
Exit Function
End If
End If
oLicense = Nothing
oVendor = Nothing
CheckRegistration = True
Exit Function
Catch ex As Exception
MsgBox(ex.ToString)
oLicense = Nothing
CheckRegistration = False
Exit Function
End Try
End Function
|