繁体   English   中英

将参数从另一个应用程序传递到部署在文件存储(而非Web)上的wpf clickonce应用程序

[英]Passing parameters to wpf clickonce application deployed on filestore (not web) from another application

我无法将参数从一个WPF应用程序传递到另一个。 我正在尝试将其作为带有参数(字符串)的新进程启动,但是没有传递任何内容。

这是我尝试的方法: AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData为null。

ApplicationDevelopment.CurrentDevelopment.ActivationUri.Query为null

Environment.GetCommandLineArguments为我提供了应用程序的路径

我正在这样启动应用程序:System.Diagnostics.Process.Start(filepath,“ argumentTest”);

两个应用程序都单击一次部署,在第二个发布选项中,我选中了“允许将URL参数传递给应用程序”

我正在这样启动应用程序:System.Diagnostics.Process.Start(filepath,“ argumentTest”);

filePath应该参考此处建议的快捷方式:

StringBuilder sb = new StringBuilder();
sb.Append(Environment.GetFolderPath(Environment.SpecialFolder.Programs));
sb.Append("\\");
sb.Append("WpfApplicationClickOnce"); //pubslisher name
sb.Append("\\");
sb.Append("WpfApplicationClickOnce.appref-ms "); //application name
string shortcutPath = sb.ToString();

Process.Start(shortcutPath, "argumentTest");

然后,您应该能够使用AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData检索数据。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM