动态加载的程序集显示形式?
有没有办法允许动态加载的程序集中的类实例显示表单?
我有这个插件系统,它在不同的域中加载程序集(用于根据需要卸载它们)。 这些程序集可能有设置,我希望每个程序集都能向最终用户呈现一个表单以允许对其进行编辑。 程序集中的每个扩展都需要为此实现一个特殊的接口。 但是,在显示插件管理器类中的表单时,我收到一个异常,即 Form 类不可序列化。 除了从 Form 派生并自己实现 ISerialized 之外,还有其他方法可以做到这一点吗?
请发送任何提示、技巧和(希望是:D)解决方案! ...阿让...
Is there a way to allow an instance of a class from a dynamically loaded assembly to show a form?
I have this plugin system which loads assemblies in separate domains (for unloading them as needed). These assemblies might have settings, and I was hoping I could have each assembly present a form to the end user to allow for editing them. Each extension in an assembly needs to implement a special interface just for this.
However, on showing the form from my plugin manager class, I get an exception that the Form class isn't serializable.
Apart from deriving from Form and implementing ISerializable myself, is there another way to do this?
Tx for any hints, tips, and (hopefully :D) solutions!
...Arjan...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
序列化问题是因为 Form 类不是通过引用封送的,并且您尝试跨域调用该类上的方法。 如果他们需要显示的唯一形式是用户设置,那么您最好定义在插件之间传递的某种“设置”类。
The serialization issue is because the Form class isn't Marshal by reference and you're trying to invoke a method on the class across domains. If the only form they need to show is for user settings, you might be better of defining some sort of "settings" class that is passed between the plugins.