Avinash patil
Avinash patil

Reputation: 1799

Passing parameters from WPF application to another WPF application?

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?

Upvotes: 3

Views: 1995

Answers (3)

Nahum
Nahum

Reputation: 7197

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

Upvotes: 1

fhnaseer
fhnaseer

Reputation: 7277

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.

Upvotes: 2

Mark Feldman
Mark Feldman

Reputation: 16119

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.

Upvotes: 1

Related Questions