Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.03.09
Implementing AddIn Options
  1. Start Visual Studio 2005.
  2. Choose File->New->Project from the menu.
  3. 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.
  4. Type the project name as SampleOptions 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 choose OK.
  5. 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 \LEAD Technologies\LEADTOOLS 16\Bin\DotNet\Win32 folder and select the following DLLS:

    [Showing a C# code example]

    
    Leadtools.dll
    Leadtools.Dicom.dll
    Leadtools.Dicom.AddIn.dll
    System.Windows.Forms		
    
    Press the OK button to add the above DLLs to the application.
  6. In the Solution Explorer window right-click Class1.cs and select Rename from the context menu. Type AddInOptions.cs and press Enter.
  7. Open the AddInOptions.cs file and add the following using statements:
    
    using Leadtools.Dicom.AddIn;
    using Leadtools.Dicom.AddIn.Interfaces;
    using Systems.Windows.Forms;				
    
  8. Add IAddInOptions to the AddInOptions class derivation list. Your class should look like the following:
            
    public class AddInOptions : IAddInOptions
    {
    }                  
    
  9. Right-click on SampleOptions and select Add-> New Item... from the context menu. In the Add New Item dialog select Resources File. In the Name: textbox change the name to Resource.resx. Click the Add button.
  10. In the Solution Explorer double-click the Resource.resx file to open the resouce editor. Click the Add Resource button and select Add Existing File…. Navigate to the icon file to be used as the image for this addin. Rename the Icon in the resource editor to OptionImage.
  11. The LEADTOOLS PACS Framework admin makes use of separate application domains to enable the loading of the same IAddOptions for individual services. To enable this behavior the AddInOptions class needs to be derived from MarshalByRefObject and marked as Serializable. After making these changes your class should now look as follows:
     
    [Serializable]
    public class AddInOptions : MarshalByRefObject,IAddInOptions
    {
    }                 
    
  12. Right-click on IAddInOptions and select “Implement Interface->Implement Interface” from the context menu. Your class should now look as follows:
    
    [Serializable]
    public class AddInOptions : MarshalByRefObject,IAddInOptions
    {
        #region IAddInOptions Members
        
        public void Configure(System.Windows.Forms.IWin32Window Parent, 
        Leadtools.Dicom.AddIn.Common.ServerSettings Settings, 
        string ServerDirectory)
        {
            throw new Exception(The method or operation is not implemented.);
        }
    
        public AddInImage Image
        {
            get 
            { 
                throw new Exception(The method or operation is not implemented.); 
            }
        }
        
        public string Text
        {
            get 
            { 
                throw new Exception(The method or operation is not implemented.); 
            }
        }
    
       #endregion
    }
  13. Make the following changes to the AddInOptions class.

    1. Display a message box in the Configure method.
    2. Assign the AddInImage property.
    3. Assign the text property.
    After making these changes your class should look as follows:
    
    [Serializable]
    public class AddInOptions : MarshalByRefObject,IAddInOptions
    {
        #region IAddInOptions Members
        
        public void Configure(System.Windows.Forms.IWin32Window Parent, Leadtools.Dicom.AddIn.Common.ServerSettings Settings, string ServerDirectory)
             {
                //
                // For a production application you would call a user
                // defined dialog box to configure the addin options.
                //
                MessageBox.Show(Configure called);
             }

      public AddInImage Image   {   get { //          // The image has to be converted to AddInImage so that it is safe          // to cross appdomains. Png allows us to keep transparency         // intact.         using (System.IO.MemoryStream ms = new System.IO.MemoryStream())         {         SampleOptions.Resource.OptionImage.ToBitmap().Save(ms, System.Drawing.Imaging.ImageFormat.Png);         ms.Position = 0;             return new System.Drawing.Bitmap(ms);          }     } }   public string Text   {   get {        return Sample AddIn; } }    #endregion }

  14. Build the class library and take the output and put it in the AddIn directory of your previously created server.
  15. Start the DICOM Server manager. If the service you install the AddIn to is not listed in the Server combo box please select it. The available options should appear as icons in the AddIn Options list box. Double-click on the option you created. A message box should appear.
Leadtools.Dicom.Scu requires a Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features