简体   繁体   English

在单独的过程中从插件获取WPF应用程序中的TextBox焦点

[英]Get TextBox focus in WPF app from plugins in separate process

We are using the System.AddIn structure for creating an application for hosting apps. 我们正在使用System.AddIn结构来创建用于托管应用程序的应用程序。 What we would like is to hook up to the event that a TextBox gets focus in these separate apps. 我们想要的是让TextBox专注于这些单独的应用程序。

How can we do that? 我们该怎么做?

I know the processes, so I can access those and maybe listen on the message pump? 我知道这些过程,因此我可以访问这些过程,也许可以收听消息泵? But how? 但是如何? What messages to listen for and how to determine if that control getting focus is actually a TextBox (WPF type)? 要侦听哪些消息以及如何确定该控件是否获得焦点实际上是TextBox(WPF类型)?

Hope for your help! 希望对您有所帮助!

I don't think you can do it in an "out of the box" way. 我认为您不能以“开箱即用”的方式来做。

A solution could be create a duplex WCF service exposed by all wpf processes. 一个解决方案是创建一个由所有wpf进程公开的双工WCF服务。

Then the client can connect to the services and use a Register method to listen to events. 然后,客户端可以连接到服务,并使用Register方法来侦听事件。

The service implementation will then dispatch events to the registered clients. 然后,服务实现将事件分发给已注册的客户端。 It takes some time but I think it is the only way. 这需要一些时间,但我认为这是唯一的方法。

现在,我们正在研究使用EventManager.RegisterClassHandler方法在单独的appdomain中注册并为每个开发人员处理适配器中的实现的可能性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM