我有两个不同的WinForm应用程序,程序App1和APP2。 APP1称APP2的exe文件(使用DOS命令窗口),并发送消息到开始APP2。该APP2开始执行,一旦它完成它的任务,它发回的消息,APP1的执行是成功的。我怎样才能acheieve使用WCF此功能。前面相同的code是写在FoxPro和该FINC使用的内存管理来实现的。
I have two different winform application, App1 and app2. App1 calls the exe of app2 (using DOS command window) and sends a message to start the app2. The app2 starts executing and once it finishes its task it sends back the message to app1 that the execution was successful. How can I acheieve this functionality using WCF. earlier the same code was written in foxpro and this finc was achieved using memory management.
基本上是:
在一边实例化一个服务器
on one side instanciate a "server"
UIIServiceHost = new ServiceHost(typeof(UIInterop));
UIIServiceHost.Open();
在这里UIInterop是一个类implementaing IUIInterop这是一个服务合同
where UIInterop is a class implementaing IUIInterop that is a Service Contract
using System.ServiceModel;
[ServiceContract]
public interface IUIInterop {
[OperationContract]
void SetControlValue (UIControl c);
}
[DataContract]
public class UIControl {
[DataMember]
public String Name { get; set; }
[DataMember]
public String Value { get; set; }
}
生成代理类=> UIInteropClient
Generate a proxy class => UIInteropClient
在另一边使用代理类实现一个客户端
on the other side implement a client using the proxy class
using ( UIInteropClient proxy = new UIInteropClient("nameDependingOfAppConfig") ) {
proxy.SetControlValue(new UIControl {});
}
=====编辑=====
===== EDIT =====
的类和接口名称只表示我缺乏想象力
the name of classes and interfaces only reflect my lack of imagination