问题
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();
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?
回答1:
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();
And in your ApplicationB start, handle commandline arguments.
回答2:
I've solved this in the past by using either anonymous or named pipes, .NET has quite good support for them. There are a few good articles about them on the MSDN site.
回答3:
do all your applications have similar login method?
make a AviCompany Login windows service .
the service will be also a WCF service that provides method "Login"
see my chart
https://www.lucidchart.com/documents/view/410f-6e48-52c16052-a63b-4a5e0a009f85
来源:https://stackoverflow.com/questions/20838440/passing-parameters-from-wpf-application-to-another-wpf-application