本文介绍了在AutomationFactory外壳对象和Lightswitch之间传递数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小的LightSwitch应用程序,当我按下一个按钮(LightSwitch自定义控件)时,它会调用一种方法来通过AutomationFactory运行Shell程序.现在,我希望能够通过LightSwitch与该过程进行通信. 我想传达的内容包括:

I have this little LightSwitch application that, when I press a button (LightSwitch Custom Control), invokes a method to run a shell program via AutomationFactory.   Now, I want to be able to communicate with this process from LightSwitch.   Things I would like to communicate include:

1.从该过程中获取有关处理数据的进展情况的状态.我需要以每秒30左右的速度进行更新.该值将是程序的printf语句的输出.我将需要介绍这个 LightSwitch应用程序中的信息,也可能通过自定义控件.

1. Getting a status back from the process regarding how far along it is in processing my data.  I need updates at a rate of about 30 per second.  This value would be the output of the program's printf statement.  I will need to present this information in the LightSwitch application, probably also through a Custom Control.

2.从该过程中获取状态,表示该过程已完成数据处理,并准备处理更多数据.程序将在命令窗口中生成等效的提示,以表明这一点.也可能是 预定的文本,通过程序的printf命令显示.

2. Getting a status back from the process indicating that it has completed processing the data and is ready for more data.   This would be indicated by the program generating the equivalent of a prompt in a command window.  It could also be predetermined text, displayed via the program's printf command.

3.从进程中返回状态,表示该进程已正常终止.同样,一条消息,指示该过程已以异常方式终止.假设该程序将在程序正常终止时 退出.

3. Getting a status back from the process indicating that it has terminated normally.  Likewise a message indicating that the process has terminated in an abnormal fashion.  Assumption is that the process will terminate normally when the program exits.

4.向程序发送一条命令,指示它应停止处理数据并返回到命令提示符.同样,正在发送命令,指示程序应停止处理数据并终止.

4. Sending, a command to program indicating it should stop processing data and return to the command prompt.  Likewise, Sending, a command to program indicating it should stop processing data and terminate.

在这一点上,我只是在寻找一些一般的方向.如果有更好的方法,我可以改用AutomationFactory.谢谢.

At this point, I am just looking for a little general direction.  I could change away from AutomationFactory if there is a better approach.  Any advice appreciated.  Thank you.

Mark 

Mark  

推荐答案

因此,基本思想是使用AutomationFactory创建一个Shell对象,以在Silverlight应用程序确定的端口上启动外部进程,然后使用双工服务与该进程进行通信.

So the basic idea is to use the AutomationFactory to create a shell object to start the external process on a port that the Silverlight application determines and then communicate with the process using the duplex service.


这篇关于在AutomationFactory外壳对象和Lightswitch之间传递数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 15:28