请问一下,在C#WPF中我需要写两个应用程序,如何使这两个应用程序之间进行值传递?

解决方案 »

  1.   

    将第2个程序中的App.xaml的属性StartupUri="xxx.xaml"删掉,
    自已重写启动项
    protected override void OnStartup(StartupEventArgs e)
            {
                string[] arg = e.Args;            
                MainWindow main = new MainWindow(arg[0]);
                main.Show();            base.OnStartup(e);
            }
    //第1个程序来启动第2个:
    string exe = AppDomain.CurrentDomain.BaseDirectory + "test2.exe"; //第1个程序的名字及所在路径
    string agrs="";//各个参数,可以用分隔符,在第2个程序再解析
    Process.Start(exe, agrs);