如何将数据从子应用程序传递到父应用程序?

问题描述:

我的解决方案中有两个应用程序,我需要在这两个exe之间进行通信。

应用程序1:Windows窗体。

应用程序2:WPF。



应用程序2从应用程序1(Windows窗体)启动,应用程序2包含两个按钮(允许和取消)。在单击允许按钮时,我们正在更新布尔值。我们需要应用程序1中的布尔值。请找到以下代码。

I have two Applications in my solution, i need to communicate between these two exe.
Application 1 : Windows Form.
Application 2 : WPF.

Application 2 launched from Application 1(Windows Form),Application 2 contains two buttons(Allow and Cancel). On Clicking Allow Button,we are updating Boolean value.We need the Boolean value in Application 1.Please find the below code.

ProcessStartInfo startInfo = new ProcessStartInfo(" Application 2.exe" )); $
startInfo.UseShellExecute = true;

startInfo.Verb =" runas";

startInfo.CreateNoWindow = false;

var sinfo = System.Diagnostics.Process.Start(startInfo);
$
sinfo.WaitForExit();

======== =======
$
这里等待应用程序2的bool值
$
=============== >


请分享代码以从其他应用程序获取数据。

ProcessStartInfo startInfo = new ProcessStartInfo("Application 2.exe"));
startInfo.UseShellExecute = true;
startInfo.Verb = "runas";
startInfo.CreateNoWindow = false;
var sinfo = System.Diagnostics.Process.Start(startInfo);
sinfo.WaitForExit();
===============
Here waiting for the bool value from Application 2
===============

Please share the code to get the data from other Application.