Windows应用商店应用程序与本机桌面应用程序之间的通信 [英] Communication between Windows Store app and native desktop application

查看:89
本文介绍了Windows应用商店应用程序与本机桌面应用程序之间的通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

!为了简化操作,我将 Windows应用商店应用程序(也称为Metro或Modern UI)称为应用程序",将常见的桌面应用程序称为应用程序"!

! For the sake of simplifying things I will refer to Windows Store applications (also known as Metro or Modern UI) as "app" and to common desktop applications as "application" !

对于那些已经在市场上建立了应用程序的开发人员,我认为这仍然是与应用程序开发有关的最不清楚但重要的问题之一: 如何管理Windows 8系统上应用程序与应用程序之间的通信? (请不要就原则展开辩论-确实有很多用例需要这样做!)

I believe this is still one of the most unclear yet important questions concerning app-development for developers who already have established applications on the market: How to manage communication between apps and applications on a Windows 8 system? (please let's not start a debate on principles - there're so many use cases where this is really required!)

在过去的几天里,我基本上阅读了数百篇文章,但是仍然不清楚如何从第一次开始就正确地进行.主要是因为我发现了几个相互矛盾的信息. 关于我的问题,我想从最终的Windows 8可能性的角度重新解决这个问题.

I basically read hundrets of articles in the last few days but still it remains unclear how to proceed doing it right from the first time. Mainly because I found several conflicting information. With my question here I'd like to re-approach this problem from the viewpoint of the final Windows 8 possibilities.

鉴于情况:

  • 应用程序和应用程序在同一系统上运行
  • 1:1交流
  • 应用程序是本地的(用Delphi编写)
  • 管理员,或者如果需要,甚至系统特权也可用于该应用程序
  • 在90%的用例中,应用程序请求应用程序执行一项操作,并收到一些文本结果.该应用程序不应为此保留或冻结!
  • 在10%的时间内,应用程序执行一个操作(由某个事件触发)并通知应用程序-结果可能是:在磁贴上或已运行且处于活动状态的应用程序中显示某些信息,或者在可能的情况下运行该应用程序/将其带上到前台.

现在,简单"问题是如何实现?

  • 现在实际上允许本地Web服务器访问吗? (我相信已经很久了,但现在已经是最终版本了)
  • WCF? (->显然 MS不再建议这样做)
  • 本地REST/SOAP服务器上的HTTP请求?
  • WinRT联合API ? (具有RSS/atom响应的另一种形式的Web服务访问)
  • WebSockets (例如
  • Is local webserver access actually allowed now? (I believe it wasn't for a long time but now is since the final release)
  • WCF? (-> apparently MS doesn't recommend that anymore)
  • HTTP requests on a local REST/SOAP server?
  • WinRT syndication API? (another form of webservice access with RSS/atom responses)
  • WebSockets (like MessageWebSocket)?
  • Some other form of TCP/IP communication?
  • Sharing a text file for in- and output (actually simply thinking of this hurts, but at least that's a possibility MS can't block...)
  • Named Pipes are not allowed, right?

这里在SO上对此主题进行了一些讨论,但是由于MS在发布Windows 8的最终版本之前进行了很多更改,因此大多数讨论都不再是最新的. d想为我以及所有其他Windows应用程序和应用程序开发人员找到一个明确且当前的解决方案.谢谢!

There are some discussions on this topic here on SO, however most of them are not up-to-date anymore as MS changed a lot before releasing the final version of Windows 8. Instead of mixing up old and new information I'd like to find a definite and current answer to this problem for me and for all the other Windows application and app developers. Thank you!

推荐答案

如果您说的是应用程序要进入商店,则不允许通过任何机制与本地系统进行通信.在某些调试方案中支持与本地系统的通信,以简化应用程序开发.

If you are talking about an application going into the Store, communication with the local system via any mechanism is not allowed. Communication with the local system is supported in some debug scenarios to make app development easier.

您可以使用文件或协议处理程序从Windows应用商店应用程序启动桌面应用程序,但是没有直接通信.

You can launch desktop applications from Windows Store applications with file or protocol handlers, but there is no direct communication.

因此,重申这一点...已发布的Windows Store应用程序不允许WinRT与桌面之间进行通信.两种环境之间的通信仅允许在调试中进行.

So, to reiterate the point... communication between WinRT and the desktop is not allowed for released Windows Store applications. Communication between the two environments is allowed in debug only.

PG在不同的地方张贴了为什么不允许通信的原因,从安全性到WinRT生命周期(即,您的应用程序被暂停-如何处理该资源,例如资源,套接字,远程应用程序等). -很多故障点)和商店"应用程序不能依赖于外部程序这一事实(即,我需要您的本地桌面应用程序/服务才能运行该应用程序,但是如何安装您的应用程序/服务?集成到Store应用程序中.您可以提供另一个Store桌面应用程序条目,但这是糟糕的用户体验.)当然,这些是高级摘要.

The PG has posted in different places reasons for why communication is not allowed, ranging from security, to the WinRT lifecycle (i.e., you app gets suspended - how does that get handled re: resources, sockets, remote app, etc. -- lots of failure points) and the fact that Store apps cannot have a dependency on external programs (i.e., I need your local desktop app/service for the app to run, but how do I get your app/service installed? You cannot integrate into the Store app. You can provide another Store desktop app entry, but that is a bad user experience.) Those are high level summaries, of course.

这篇关于Windows应用商店应用程序与本机桌面应用程序之间的通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆