编写程序实现LEADTOOLS DICOM演示程序 Add in Options

发布时间:2017/03/28 00:03 发布者:Richard.Ma

返回博客中心

 

  1. 打开 Visual Studio 2005.
  2. 选择 文件->新建->项目.
  3. 新建项目 对话框中, 在项目类型列表中选择 Visual C#VB , 并在模板列表中选择 类库.
  4. 在项目名称字段中键入项目名称为SampleOptions,然后单击 确定。 如果需要,键入项目的新位置或使用浏览按钮选择目录,然后单击确定
  5. 在“解决方案资源管理器”窗口中,右键单击“引用”,然后从菜单中选择“添加引用”。 在“添加引用”对话框中,选择“浏览”选项卡,然后转至 LEADTOOLS 19 \ Bin \ DotNet \ Win32文件夹,选择以下DLLS:

    • Leadtools.dll
    • Leadtools.Dicom.dll
    • Leadtools.Dicom.AddIn.dll
    • System.Windows.Forms

     

  6. 单击确定按钮将上述DLL添加到应用程序。

  7. 在解决方案资源管理器窗口中,右键单击Class1.cs,然后从上下文菜单中选择重命名。 键入AddInOptions.cs确定
  8. 打开AddInOptions.cs文件并添加以下使用语句:

    C#

    using Leadtools.Dicom.AddIn; 
    using Leadtools.Dicom.AddIn.Interfaces; 
    using Systems.Windows.Forms; 

     

  9. 将IAddInOptions添加到AddInOptions类派生列表中。你的类应该如下所示:

    C#

    public class AddInOptions : IAddInOptions 
    { 
    } 

     

  10. 右键单击SampleOptions,然后从菜单中选择添加-> 新项目...。 在“添加新项”对话框中,选择“资源文件”。 在名称:文本框中将名称更改为Resource.resx。 单击添加按钮。

  11. 在解决方案资源管理器中,双击Resource.resx文件以打开资源编辑器。 单击添加资源按钮,然后选择添加现有文件...。 导航到要用作此插件的图像的图标文件。 将资源编辑器中的图标重命名为OptionImage。
  12. 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:LEADTOOLS PACS Framework管理员使用单独的应用程序域来启用单个服务的相同IAddOptions的加载。 要启用此行为,AddInOptions类需要从MarshalByRefObject派生并标记为Serializable。 进行这些更改后,你的类现在应如下所示:

    C#

    [Serializable] 
    public class AddInOptions : MarshalByRefObject,IAddInOptions 
    { 
    } 

     

  13. 右键单击IAddInOptions,然后从上下文菜单中选择“实现接口 - >实现接口”。 你的类现在应该如下:

    C#

    [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 
    } 

     

  14. 对AddInOptions类进行以下更改:

    • 在配置方法中显示一个消息框。
    • 分配AddInImage属性。
    • 分配文本属性。

    After making these changes your class should look as follows:

    C#

    [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 add-in 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 
    } 

     

  15. 构建类库并获取输出,然后将其放在先前创建的服务器的AddIn目录中。

  16. 启动DICOM服务器管理器。 如果安装加载项的服务未列在“服务器”组合框中,请选择它。 可用选项应在AddIn Options列表框中显示为图标。 双击您创建的选项。 将出现一个消息框。

关于葡萄城

赋能开发者!葡萄城是专业的集开发工具、商业智能解决方案、低代码开发平台于一身的软件和服务提供商,为超过 75% 的全球财富 500 强企业提供服务。葡萄城专注控件软件领域30年,希望通过模块化的开发控件、灵活的低代码应用开发平台等一系列开发工具、解决方案和服务,帮助开发者快速响应复杂多变的业务需求,最大程度地发挥开发者的才智和潜能,让开发者的 IT 人生更从容更美好。

了解详情,请访问葡萄城官网