Initialize() Method
Summary
Initializes a ServiceAdministrator object.
Syntax
Public Overloads Function Initialize() As Boolean
public:
bool Initialize();
Return Value
true if the ServiceAdministrator object was successfully intialized.
Example
Check to see if ServiceAdministrator object has been successfully initialized.
using Leadtools;
using Leadtools.Dicom.AddIn.Common;
using Leadtools.Dicom.AddIn.Interfaces;
public void LockCheck()
{
ServiceAdministrator admin = new ServiceAdministrator(@"C:\LEADTOOLS 20\Bin\Dotnet\Win32");
if (!admin.IsEval)
{
//
// If it isn't an eval then we need to set the license file.
//
if (admin.IsLocked)
{
//admin.Unlock("Substitute Your Code");
string MY_LICENSE_FILE = "d:\\temp\\TestLic.lic";
string MY_DEVELOPER_KEY = "xyz123abc";
RasterSupport.SetLicense(MY_LICENSE_FILE, MY_DEVELOPER_KEY);
if (admin.IsLocked)
{
Console.WriteLine("Invalid license");
return;
}
else
{
//
// Once unlocked initialize the services
//
admin.Initialize();
foreach (KeyValuePair<string, DicomService> service in admin.Services)
{
Console.WriteLine(service.Value.Settings.AETitle);
foreach (IAddInOptions option in service.Value.AddInOptions)
{
Console.WriteLine("Option: {0}", option.Text);
}
}
}
}
Console.WriteLine("License file valid.");
}
else
{
if (admin.IsExpired)
{
Console.WriteLine("Evaluation has expired");
}
}
}
Imports Leadtools
Imports Leadtools.Dicom.AddIn.Common
Imports Leadtools.Dicom.AddIn.Interfaces
Public Sub LockCheck()
Dim admin As ServiceAdministrator = New ServiceAdministrator("C:\LEADTOOLS 20\Bin\DotNet4\Win32")
If (Not admin.IsEval) Then
'
' If it isn't an eval then we need to unlock
'
If admin.IsLocked Then
'admin.Unlock("Substitute Your Code")
Dim MY_LICENSE_FILE As String = "d:\temp\TestLic.lic"
Dim MY_DEVELOPER_KEY As String = "xyz123abc"
RasterSupport.SetLicense(MY_LICENSE_FILE, MY_DEVELOPER_KEY)
If admin.IsLocked Then
Console.WriteLine("Invalid license")
Return
Else
'
' Once unlocked the Services property will be valid
'
admin.Initialize()
For Each service As KeyValuePair(Of String, DicomService) In admin.Services
Console.WriteLine(service.Value.Settings.AETitle)
For Each o As IAddInOptions In service.Value.AddInOptions
Console.WriteLine("Option: {0}", o.Text)
Next o
Next service
End If
End If
Console.WriteLine("License file valid.")
Else
If admin.IsExpired Then
Console.WriteLine("Evaluation has expired")
End If
End If
End Sub