使用 Hydra (Remobjects) 在 Delphi Prism 中创建插件

发布于 2024-07-30 12:30:54 字数 330 浏览 7 评论 0原文

我必须在 Delphi Prism 中为 Delphi 中已有的应用程序创建一个插件。 我已在 www.remobjects.com 上阅读了有关 Hydra 3.0 的所有内容,并有一些疑问。

  1. 您能否给我一个示例,说明如何创建用于 Delphi Host 和 .Net Plugin 之间通信的自定义接口。(使用 C# 或 Delphi Prism)

    您能否给我
  2. ModuleController 在 Hydra 插件中的作用是什么以及它如何在那里工作?

  3. 管理器组件的角色?

提前谢谢了。

I have to create a plugin in Delphi Prism for Application that is already in Delphi.
I have read all about Hydra 3.0 in www.remobjects.com and have some queries.

  1. Can you please give me an example how to create custom Interfaces for communication between Delphi Host and .Net Plugin.(either in C# or Delphi Prism)

  2. what is the role of ModuleController in Hydra plugin and how it works there?

  3. Role of Manager Component?

Many Thanks in Advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮世清欢 2024-08-06 12:30:54

我自己刚刚开始“九头蛇”之旅,但我会尽力回答你们的问题。

Q1. 如果没有更多有关您情况的信息,这个问题很难回答。 您可以访问 Delphi 代码库吗? 您是否正在向已有插件的现有应用程序添加插件,或者您刚刚开始向您的应用程序添加 Hydra 插件框架? 现在,我猜测您正在向现有主机应用程序添加一个新插件,并且您有 .pas 文件,其中包含将用于主机和插件之间通信的自定义接口。 如果是这种情况,那么以下内容应该适合您。

  • 您需要启动一个新的“RemObjects Hydar”-> Visual Studio 中的“插件模块”项目。
  • 通过“工具”-> 导入包含通信接口的 .pas 文件。 “九头蛇”-> “从Delphi单元导入接口”
  • 添加一个新的“RemObjects Hydra”-> 将“(Non-)Visual Plugin”项添加到您的项目中
  • 将接口添加到新的插件类并实现该接口的方法。

应该就是这样。 您的主机应用程序现在将能够查询您的插件以查看它实现了哪些接口,然后调用它所需的方法。

这类似于您导入的接口文件应该是什么样子

type
  {$REGION Attributes}
  [Guid('9D445B3E-CA9F-4C67-815A-F5EC6BAB5D60')]
  {$ENDREGION}
  IMyInterface = public interface(IHYCrossPlatformInterface)
    method MyMethod(const MyInput: String; out MyOutput: String);
  end;

这类似于您的插件类应该是什么样子

type
  [Plugin, NonVisualPlugin]
  MyPlugin = public partial class(RemObjects.Hydra.NonVisualPlugin, IMyInterface)
  private
  protected
    method Dispose(aDisposing: boolean); override;
    method MyMethod(const MyInput: String; out MyOutput: String);
  public
    constructor;
  end;

Q2。 据我所知,模块控件负责向主机应用程序注册插件模块中的所有插件。 您还可以从插件中使用它来与主机应用程序进行通信。

Q3。 我假设您指的是 THYModuleManager。 这用于(除其他外)在运行时加载所有插件。

希望有帮助。

I'm just starting out on the "Hydra" journey myself but I'll do my best to answer your questions.

Q1. This one is hard to answer without some more info about your situation. Do you have access to the Delphi code base? Are you adding a plugin to an existing application that already has plugins, or are you just starting to add the Hydra plugin framework to your application? For now I'll guess that you are adding a new plugin to an existing host application and you have the .pas file containing the custom interfaces you are going to use for your communications between the host and your plugin. If that's the case then the following should work for you.

  • You need to start a new "RemObjects Hydar" -> "Plugin Module" project in Visual Studio.
  • Import the .pas file that contains the communication interfaces by going "Tools" -> "Hydra" -> "Import Interfaces from Delphi Unit"
  • Add a new "RemObjects Hydra" -> "(Non-)Visual Plugin" item to your project
  • Add the interface to your new plugin class and implement the interface's methods.

That should be about it. Your Host application will now be able to query your plugin to see which interface(s) it implements and then call the methods it requires.

This is something like what your imported interface file should look like

type
  {$REGION Attributes}
  [Guid('9D445B3E-CA9F-4C67-815A-F5EC6BAB5D60')]
  {$ENDREGION}
  IMyInterface = public interface(IHYCrossPlatformInterface)
    method MyMethod(const MyInput: String; out MyOutput: String);
  end;

This is something like what your plugin class should look like

type
  [Plugin, NonVisualPlugin]
  MyPlugin = public partial class(RemObjects.Hydra.NonVisualPlugin, IMyInterface)
  private
  protected
    method Dispose(aDisposing: boolean); override;
    method MyMethod(const MyInput: String; out MyOutput: String);
  public
    constructor;
  end;

Q2. As far as I know the module control is responsible for registering all the plugins in your plugin module with the host application. You can also use it from your plugin(s) to communicate with the host application.

Q3. I assume you are referring to the THYModuleManager. This is used (among other things) to load all your plugins at runtime.

Hope that helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文