在旧应用程序中处理新的库功能
我们正在开发一个新的库版本,其中包含一些其他应用程序使用的 UI 控件。 其中一些控件具有旧应用程序不知道的新功能。 默认情况下,我们将禁用新功能,但我们希望为某些特定应用程序启用它们。 这些应用程序可能存在于同一台计算机上。
您建议如何实施?
更新: 我想出的最佳解决方案是使用 Process.GetCurrentProcess() 并使用 proc.MainModule.FileVersionInfo.InternalName 之类的东西来查找指定覆盖值的注册表项。 也许还可以查看版本号来检查它是否太旧而无法了解新功能。 这个方法有问题吗?
更新: 添加的功能封装在控件内,只是它们在某些上下文中有意义,而在其他上下文中则不然。
We are working on a new library version that contains some UI controls that are used by other applications. Some of these controls have new features that the old applications don't know about. We will disable the new features by default, but there are specific apps for which we'd like to enable them. The apps are likely to exist on the same machine.
How would you recommend implementing this?
Update:
The best solution I've come up with is to use Process.GetCurrentProcess() and use something like the proc.MainModule.FileVersionInfo.InternalName to look for a registry key that specifies the override value. Perhaps also looking at a version number to check that it's too old to know about the new features. Are there problems with this method?
Update:
The added features are encapsulated within the control, it's just that they make sense in some contexts and not in others.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为你可以。 您将无法更改旧应用程序的界面,也无法接收或返回任何新数据。 因此,新控件必须像旧控件一样对待旧应用程序。 现在,如果新控件中的行为完全封装在控件内(例如固定或最小化或类似的操作),那么这些功能可能适用于您的旧应用程序。 您可以处理让旧应用程序使用新控件的问题,假设它们是强命名的,并且在 GAC 中使用 发布商政策。
I don't think that you can. You are not going to be able to change the interface to the old applications and you will not be able to receive or return any new data. So, the new controls will have to behave to the old applications just like the old controls. Now, if you have behaviors in the new controls that are completely encapsulated within the control (like pinning or minimizing or something like that), those features would likely work on your old applications. You can handle the nuts and bots of getting the old applications to use the new controls assuming they are strongly named and in the GAC using Publisher Policies.