从传递WPF应用程序的参数到另一个WPF应用程序

从传递WPF应用程序的参数到另一个WPF应用程序

本文介绍了从传递WPF应用程序的参数到另一个WPF应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WPF(C#)开发了两个应用,这是独立于对方。假设项目A和B.它们被单独开发。我已连接的项目,在项目中的按钮,该按钮我开始为项目B与的Process.Start()的点击;

I have two applications developed in WPF(c#) which are independent on each other. Suppose Project A and B. they are developed separately. i have connected those projects with the Button in project A, on click of that button i am starting project B with Process.start();

现在我需要为String(登录)参数传递到另一个应用程序(b),所以用户不需要重新登录。
我已经看到了命令行参数传递,但我不希望使用它们。
Application.Current.Properties [parameterStringID] 是没有用的,因为我有A和B

now i need to pass String (login) parameter to the another application (B) so user dont need to login again.I have already seen the Command line argument passing but i dont want to use them.also Application.Current.Properties["parameterStringID"] is not useful because i have different app.config for A and B

有没有办法做到这一点?

Is there any way to do this?

推荐答案

您可以发送命令行参数,以您的应用程序是这样。

You can send commandline arguments to your application like this.

var applicationPath = "Path to application B exe";
var process = new Process();
process.StartInfo = new ProcessStartInfo(applicationExePath);
process.Arguments = "/login=abc /password=def";
process.Start();



而在你的ApplicationB开始,处理命令行参数。

And in your ApplicationB start, handle commandline arguments.

这篇关于从传递WPF应用程序的参数到另一个WPF应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 06:20