- Start Visual Studio 2005.
- Choose File->New->Project from the menu.
- In the New Project dialog box, choose either "Visual C#" or "Visual Basic" in the Projects Type List, and choose "Class Library" in the Templates List.
- Type the project name as "LogAddIn" in the Project Name field, and then choose OK. If desired, type a new location for your project or select a directory using the Browse button, and then chooseOK.
- In the "Solution Explorer" window right-click on the "References" folder, and select "Add Reference..." from the context menu. In the "Add Reference" dialog box, select the "Browse" tab and browse to Leadtools for .NET "C:\LEADTOOLS 17.5\Bin\DotNet\Win32" folder and select the following DLLS:
[Showing a C# code example]
Leadtools.Dicom.dll
Leadtools.Dicom.AddIn.dll
- Press the OK button to add the above DLLs to the application.
- In the "Solution Explorer" window right-click "LogAddIn" and select Add->Class from the context menu. In the "Add New Item" dialog, type Module.cs in the "Name" field. Click "Add" to add the class to the project.
- Open the Module.cs file and add the following using statements:
using Leadtools.Dicom.AddIn;
using System.IO;
using System.Diagnostics;
- Define the module class as listed below:
public class Module : ModuleInit
{
public override void Load(string ServiceDirectory, string DisplayName)
{
// Do any add-in initialization here. For instance, set up
// the logging infrastructure.
//
}
}
- In the "Solution Explorer" window right-click Class1.cs and select Rename from the context menu. Type ReceiveNotify.cs and press enter.
- Open the ReceiveNotify.cs file and add the following using statements:
using Leadtools.Dicom.AddIn;
using Leadtools.Dicom.AddIn.Interfaces;
using System.Diagnostics;
- Add NotifyReceiveMessageBase to the ReceiveNotify class derivation list. Your class should look like the following:
public class ReceiveNotify : NotifyReceiveMessageBase
{
}
- Override the messages you are interested in logging. This tutorial only overrides two methods to show what is possible. For a more detailed implementation of logging refer to the Leadtools.AddIn.DicomLog example.
public class ReceiveNotify : NotifyReceiveMessageBase
{
public override void OnReceiveAssociateAccept(DicomClient Client, Leadtools.Dicom.DicomAssociate association)
{
Debug.WriteLine("Receive Associate Accept");
}
public override void OnReceiveCEchoRequest(DicomClient Client, byte presentationID, int messageID, string affectedClass)
{
Debug.WriteLine("Receive Echo Request");
}
}
- In the "Solution Explorer" window right-click "LogAddIn" and select Add->Class from the context menu. In the "Add New Item" dialog, type SendNotify.cs in the "Name" field. Click "Add" to add the class to the project.
- Open the SendNotify.cs file and add the following using statements:
using Leadtools.Dicom;
using Leadtools.Dicom.AddIn;
using Leadtools.Dicom.AddIn.Interfaces;
using System.Diagnostics;
- Add NotifySendMessageBase to the ReceiveNotify class derivation list. Your class should look like the following:
public class SendNotify : NotifySendMessageBase
{
}
- Override the messages you are interested in logging. This tutorial only overrides two methods to show what is possible. For a more detailed implementation of logging refer to the Leadtools.AddIn.DicomLog example.
public class SendNotify : NotifySendMessageBase
{
public override void OnSendAssociateAccept(DicomClient Client, DicomAssociate associate)
{
base.OnSendAssociateAccept(Client, associate);
}
public override void OnSendCEchoRequest(DicomClient Client, byte presentationID, int messageID, string affectedClass)
{
base.OnSendCEchoRequest(Client, presentationID, messageID, affectedClass);
}
}
- Build the class library and take the output and put it in the AddIn directory of your previously created server.
- If the server is running stop it. Start the server.
- Connect to the server and perform an association and make a C-ECHO request.